File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/Xorg_Configuration.pm
Criterion Covered Total %
statement 61 71 85.9
branch 31 40 77.5
condition 1 3 33.3
subroutine 9 10 90.0
pod 0 7 0.0
total 102 131 77.8


line stmt bran cond sub pod time code
1             # Copyright (c) 2005 - 2006 Hans Jeuken. All rights reserved.
2             # This program is free software; you can redistribute it and/or
3             # modify it under the same terms as Perl itself.
4              
5             # This file was generated from the 'xorg.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.01
9             #kate author Jan Janssen (medhefgo@web.de)
10             #generated: Sun Feb 3 22:02:06 2008, localtime
11              
12             package Syntax::Highlight::Engine::Kate::Xorg_Configuration;
13              
14             our $VERSION = '0.16';
15              
16 1     1   825 use strict;
  1         2  
  1         36  
17 1     1   4 use warnings;
  1         2  
  1         57  
18 1     1   5 use base('Syntax::Highlight::Engine::Kate::Template');
  1         3  
  1         887  
19              
20             sub new {
21 2     2 0 1825 my $proto = shift;
22 2   33     13 my $class = ref($proto) || $proto;
23 2         1009 my $self = $class->SUPER::new(@_);
24 2         40 $self->attributes({
25             'Alert' => 'Error',
26             'Comment' => 'Comment',
27             'Float' => 'Float',
28             'Int' => 'DecVal',
29             'Keyword' => 'Keyword',
30             'Normal Text' => 'Normal',
31             'Section' => 'Function',
32             'Section Name' => 'String',
33             'Value' => 'DataType',
34             'Value2' => 'Others',
35             });
36 2         44 $self->contextdata({
37             'Comment' => {
38             callback => \&parseComment,
39             attribute => 'Comment',
40             lineending => '#pop',
41             },
42             'Keyword' => {
43             callback => \&parseKeyword,
44             attribute => 'Keyword',
45             lineending => '#pop',
46             },
47             'Section' => {
48             callback => \&parseSection,
49             attribute => 'Normal Text',
50             },
51             'Section Content' => {
52             callback => \&parseSectionContent,
53             attribute => 'Normal Text',
54             },
55             'xorg' => {
56             callback => \&parsexorg,
57             attribute => 'Normal Text',
58             },
59             });
60 2         14 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
61 2         88 $self->basecontext('xorg');
62 2         14 $self->keywordscase(1);
63 2         10 $self->initialize;
64 2         6 bless ($self, $class);
65 2         26 return $self;
66             }
67              
68             sub language {
69 0     0 0 0 return 'x.org Configuration';
70             }
71              
72             sub parseComment {
73 380     380 0 879 my ($self, $text) = @_;
74             # type => 'DetectSpaces'
75 380 100       1410 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
76 96         315 return 1
77             }
78             # context => '##Alerts'
79             # type => 'IncludeRules'
80 284 50       1082 if ($self->includePlugin('Alerts', $text)) {
81 0         0 return 1
82             }
83             # type => 'DetectIdentifier'
84 284 100       1129 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
85 106         425 return 1
86             }
87 178         582 return 0;
88             };
89              
90             sub parseKeyword {
91 1972     1972 0 5785 my ($self, $text) = @_;
92             # attribute => 'Value'
93             # char => '"'
94             # char1 => '"'
95             # type => 'RangeDetect'
96 1972 100       6812 if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'Value')) {
97 230         834 return 1
98             }
99             # attribute => 'Value'
100             # char => '''
101             # char1 => '''
102             # type => 'RangeDetect'
103 1742 50       6405 if ($self->testRangeDetect($text, '\'', '\'', 0, 0, undef, 0, '#stay', 'Value')) {
104 0         0 return 1
105             }
106             # attribute => 'Float'
107             # type => 'Float'
108 1742 100       10433 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
109 74         356 return 1
110             }
111             # attribute => 'Int'
112             # type => 'Int'
113 1668 50       6148 if ($self->testInt($text, 0, undef, 0, '#stay', 'Int')) {
114 0         0 return 1
115             }
116             # String => '[\w\d]+'
117             # attribute => 'Value2'
118             # type => 'RegExpr'
119 1668 100       6018 if ($self->testRegExpr($text, '[\\w\\d]+', 0, 0, 0, undef, 0, '#stay', 'Value2')) {
120 4         17 return 1
121             }
122             # char => '#'
123             # context => 'Comment'
124             # type => 'DetectChar'
125 1664 50       6861 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', undef)) {
126 0         0 return 1
127             }
128 1664         4901 return 0;
129             };
130              
131             sub parseSection {
132 100     100 0 266 my ($self, $text) = @_;
133             # attribute => 'Section Name'
134             # char => '"'
135             # char1 => '"'
136             # context => 'Section Content'
137             # type => 'RangeDetect'
138 100 100       350 if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, 'Section Content', 'Section Name')) {
139 34         120 return 1
140             }
141             # attribute => 'Section Name'
142             # char => '''
143             # char1 => '''
144             # context => 'Section Content'
145             # type => 'RangeDetect'
146 66 50       296 if ($self->testRangeDetect($text, '\'', '\'', 0, 0, undef, 0, 'Section Content', 'Section Name')) {
147 0         0 return 1
148             }
149             # attribute => 'Alert'
150             # type => 'DetectIdentifier'
151 66 50       296 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', 'Alert')) {
152 0         0 return 1
153             }
154             # char => '#'
155             # context => 'Comment'
156             # type => 'DetectChar'
157 66 50       304 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', undef)) {
158 0         0 return 1
159             }
160 66         180 return 0;
161             };
162              
163             sub parseSectionContent {
164 1200     1200 0 2747 my ($self, $text) = @_;
165             # String => 'EndSection'
166             # attribute => 'Section'
167             # context => '#pop#pop'
168             # endRegion => 'Section'
169             # insensitive => 'true'
170             # type => 'StringDetect'
171 1200 100       4148 if ($self->testStringDetect($text, 'EndSection', 1, 0, 0, undef, 0, '#pop#pop', 'Section')) {
172 26         83 return 1
173             }
174             # String => 'EndSubSection'
175             # attribute => 'Section'
176             # context => '#pop#pop'
177             # endRegion => 'SubSection'
178             # insensitive => 'true'
179             # type => 'StringDetect'
180 1174 100       4024 if ($self->testStringDetect($text, 'EndSubSection', 1, 0, 0, undef, 0, '#pop#pop', 'Section')) {
181 8         29 return 1
182             }
183             # String => 'SubSection'
184             # attribute => 'Section'
185             # beginRegion => 'SubSection'
186             # context => 'Section'
187             # insensitive => 'true'
188             # type => 'StringDetect'
189 1166 100       3245 if ($self->testStringDetect($text, 'SubSection', 1, 0, 0, undef, 0, 'Section', 'Section')) {
190 8         29 return 1
191             }
192             # String => '\b\w+\b'
193             # context => 'Keyword'
194             # type => 'RegExpr'
195 1158 100       3913 if ($self->testRegExpr($text, '\\b\\w+\\b', 0, 0, 0, undef, 0, 'Keyword', undef)) {
196 206         837 return 1
197             }
198             # char => '#'
199             # context => 'Comment'
200             # type => 'DetectChar'
201 952 50       3729 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', undef)) {
202 0         0 return 1
203             }
204 952         2612 return 0;
205             };
206              
207             sub parsexorg {
208 52     52 0 161 my ($self, $text) = @_;
209             # String => 'Section'
210             # attribute => 'Section'
211             # beginRegion => 'Section'
212             # context => 'Section'
213             # insensitive => 'true'
214             # type => 'StringDetect'
215 52 100       316 if ($self->testStringDetect($text, 'Section', 1, 0, 0, undef, 0, 'Section', 'Section')) {
216 26         102 return 1
217             }
218             # char => '#'
219             # context => 'Comment'
220             # type => 'DetectChar'
221 26 50       137 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', undef)) {
222 26         107 return 1
223             }
224 0           return 0;
225             };
226              
227              
228             1;
229              
230             __END__