File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/Makefile.pm
Criterion Covered Total %
statement 21 78 26.9
branch 0 44 0.0
condition 1 3 33.3
subroutine 4 11 36.3
pod 0 8 0.0
total 26 144 18.0


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 'makefile.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.06
9             #kate version 2.4
10             #kate author Per Wigren (wigren@home.se)
11             #generated: Sun Feb 3 22:02:05 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::Makefile;
14              
15             our $VERSION = '0.07';
16              
17 1     1   1208 use strict;
  1         3  
  1         52  
18 1     1   8 use warnings;
  1         3  
  1         38  
19 1     1   8 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         1074  
20              
21             sub new {
22 1     1 0 772 my $proto = shift;
23 1   33     12 my $class = ref($proto) || $proto;
24 1         11 my $self = $class->SUPER::new(@_);
25 1         19 $self->attributes({
26             'Commands' => 'BaseN',
27             'Comment' => 'Comment',
28             'Keyword' => 'Keyword',
29             'Normal Text' => 'Normal',
30             'Operator' => 'Char',
31             'Section' => 'Others',
32             'Special' => 'Float',
33             'String' => 'String',
34             'Target' => 'DecVal',
35             'Variable' => 'DataType',
36             });
37 1         12 $self->listAdd('keywords',
38             'define',
39             'else',
40             'endef',
41             'endif',
42             'ifdef',
43             'ifeq',
44             'ifndef',
45             'ifneq',
46             'include',
47             );
48 1         30 $self->contextdata({
49             'Commands' => {
50             callback => \&parseCommands,
51             attribute => 'Normal Text',
52             lineending => '#pop',
53             },
54             'Normal' => {
55             callback => \&parseNormal,
56             attribute => 'Normal Text',
57             },
58             'String' => {
59             callback => \&parseString,
60             attribute => 'String',
61             lineending => '#pop',
62             },
63             'Value' => {
64             callback => \&parseValue,
65             attribute => 'String',
66             },
67             'VarFromNormal' => {
68             callback => \&parseVarFromNormal,
69             attribute => 'Variable',
70             },
71             'VarFromValue' => {
72             callback => \&parseVarFromValue,
73             attribute => 'Variable',
74             },
75             });
76 1         9 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
77 1         4 $self->basecontext('Normal');
78 1         7 $self->keywordscase(0);
79 1         4 $self->initialize;
80 1         3 bless ($self, $class);
81 1         3 return $self;
82             }
83              
84             sub language {
85 0     0 0   return 'Makefile';
86             }
87              
88             sub parseCommands {
89 0     0 0   my ($self, $text) = @_;
90             # String => '[$][\({]'
91             # attribute => 'Operator'
92             # context => 'VarFromNormal'
93             # type => 'RegExpr'
94 0 0         if ($self->testRegExpr($text, '[$][\\({]', 0, 0, 0, undef, 0, 'VarFromNormal', 'Operator')) {
95 0           return 1
96             }
97             # String => '[_\w-]*\b'
98             # attribute => 'Commands'
99             # context => '#pop'
100             # type => 'RegExpr'
101 0 0         if ($self->testRegExpr($text, '[_\\w-]*\\b', 0, 0, 0, undef, 0, '#pop', 'Commands')) {
102 0           return 1
103             }
104 0           return 0;
105             };
106              
107             sub parseNormal {
108 0     0 0   my ($self, $text) = @_;
109             # String => 'keywords'
110             # attribute => 'Keyword'
111             # context => '#stay'
112             # type => 'keyword'
113 0 0         if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
114 0           return 1
115             }
116             # String => '[_\w\d]*\s*(?=:=|=)'
117             # attribute => 'Variable'
118             # context => 'Value'
119             # type => 'RegExpr'
120 0 0         if ($self->testRegExpr($text, '[_\\w\\d]*\\s*(?=:=|=)', 0, 0, 0, undef, 0, 'Value', 'Variable')) {
121 0           return 1
122             }
123             # String => '[_\w\d-]*\s*:'
124             # attribute => 'Target'
125             # context => '#stay'
126             # firstNonSpace => 'true'
127             # type => 'RegExpr'
128 0 0         if ($self->testRegExpr($text, '[_\\w\\d-]*\\s*:', 0, 0, 0, undef, 1, '#stay', 'Target')) {
129 0           return 1
130             }
131             # String => '^[.].*:'
132             # attribute => 'Section'
133             # context => '#stay'
134             # type => 'RegExpr'
135 0 0         if ($self->testRegExpr($text, '^[.].*:', 0, 0, 0, undef, 0, '#stay', 'Section')) {
136 0           return 1
137             }
138             # attribute => 'String'
139             # char => '"'
140             # context => 'String'
141             # type => 'DetectChar'
142 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
143 0           return 1
144             }
145             # String => '[$][\({]'
146             # attribute => 'Operator'
147             # context => 'VarFromNormal'
148             # type => 'RegExpr'
149 0 0         if ($self->testRegExpr($text, '[$][\\({]', 0, 0, 0, undef, 0, 'VarFromNormal', 'Operator')) {
150 0           return 1
151             }
152             # String => '+*=%$():\\;'
153             # attribute => 'Operator'
154             # context => '#stay'
155             # type => 'AnyChar'
156 0 0         if ($self->testAnyChar($text, '+*=%$():\\\\;', 0, 0, undef, 0, '#stay', 'Operator')) {
157 0           return 1
158             }
159             # String => '[@-]'
160             # attribute => 'Operator'
161             # context => 'Commands'
162             # firstNonSpace => 'true'
163             # type => 'RegExpr'
164 0 0         if ($self->testRegExpr($text, '[@-]', 0, 0, 0, undef, 1, 'Commands', 'Operator')) {
165 0           return 1
166             }
167             # String => '(:^|[^\\])#.*$'
168             # attribute => 'Comment'
169             # context => '#stay'
170             # type => 'RegExpr'
171 0 0         if ($self->testRegExpr($text, '(:^|[^\\\\])#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
172 0           return 1
173             }
174 0           return 0;
175             };
176              
177             sub parseString {
178 0     0 0   my ($self, $text) = @_;
179             # attribute => 'String'
180             # context => '#stay'
181             # type => 'LineContinue'
182 0 0         if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) {
183 0           return 1
184             }
185             # attribute => 'String'
186             # char => '"'
187             # context => '#pop'
188             # type => 'DetectChar'
189 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
190 0           return 1
191             }
192 0           return 0;
193             };
194              
195             sub parseValue {
196 0     0 0   my ($self, $text) = @_;
197             # String => '\\$'
198             # attribute => 'Operator'
199             # context => '#stay'
200             # type => 'RegExpr'
201 0 0         if ($self->testRegExpr($text, '\\\\$', 0, 0, 0, undef, 0, '#stay', 'Operator')) {
202 0           return 1
203             }
204             # String => '[^\\]?$'
205             # attribute => 'String'
206             # context => '#pop'
207             # type => 'RegExpr'
208 0 0         if ($self->testRegExpr($text, '[^\\\\]?$', 0, 0, 0, undef, 0, '#pop', 'String')) {
209 0           return 1
210             }
211             # String => '[$][\({]'
212             # attribute => 'Operator'
213             # context => 'VarFromValue'
214             # type => 'RegExpr'
215 0 0         if ($self->testRegExpr($text, '[$][\\({]', 0, 0, 0, undef, 0, 'VarFromValue', 'Operator')) {
216 0           return 1
217             }
218             # String => '@[-_\d\w]*@'
219             # attribute => 'Special'
220             # context => '#pop'
221             # type => 'RegExpr'
222 0 0         if ($self->testRegExpr($text, '@[-_\\d\\w]*@', 0, 0, 0, undef, 0, '#pop', 'Special')) {
223 0           return 1
224             }
225             # attribute => 'Operator'
226             # char => ';'
227             # context => '#pop'
228             # type => 'DetectChar'
229 0 0         if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
230 0           return 1
231             }
232 0           return 0;
233             };
234              
235             sub parseVarFromNormal {
236 0     0 0   my ($self, $text) = @_;
237             # String => '[\)}]'
238             # attribute => 'Operator'
239             # context => '#pop'
240             # type => 'RegExpr'
241 0 0         if ($self->testRegExpr($text, '[\\)}]', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
242 0           return 1
243             }
244 0           return 0;
245             };
246              
247             sub parseVarFromValue {
248 0     0 0   my ($self, $text) = @_;
249             # String => '[\)}](?=/)'
250             # attribute => 'Operator'
251             # context => '#pop'
252             # type => 'RegExpr'
253 0 0         if ($self->testRegExpr($text, '[\\)}](?=/)', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
254 0           return 1
255             }
256             # String => '[\)}][^$]'
257             # attribute => 'Operator'
258             # context => '#pop'
259             # type => 'RegExpr'
260 0 0         if ($self->testRegExpr($text, '[\\)}][^$]', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
261 0           return 1
262             }
263             # String => '[\)}]$'
264             # attribute => 'Operator'
265             # context => '#pop#pop'
266             # type => 'RegExpr'
267 0 0         if ($self->testRegExpr($text, '[\\)}]$', 0, 0, 0, undef, 0, '#pop#pop', 'Operator')) {
268 0           return 1
269             }
270 0           return 0;
271             };
272              
273              
274             1;
275              
276             __END__