File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/Sather.pm
Criterion Covered Total %
statement 23 48 47.9
branch 0 18 0.0
condition 1 3 33.3
subroutine 4 8 50.0
pod 0 5 0.0
total 28 82 34.1


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 'sather.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.03
9             #kate version 2.1
10             #generated: Sun Feb 3 22:02:06 2008, localtime
11              
12             package Syntax::Highlight::Engine::Kate::Sather;
13              
14             our $VERSION = '0.12';
15              
16 1     1   396 use strict;
  1         2  
  1         25  
17 1     1   5 use warnings;
  1         2  
  1         26  
18 1     1   4 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         495  
19              
20             sub new {
21 1     1 0 599 my $proto = shift;
22 1   33     8 my $class = ref($proto) || $proto;
23 1         8 my $self = $class->SUPER::new(@_);
24 1         9 $self->attributes({
25             'Char' => 'Char',
26             'Comment' => 'Comment',
27             'Data Type' => 'DataType',
28             'Decimal' => 'DecVal',
29             'Features' => 'Others',
30             'Float' => 'Float',
31             'Keyword' => 'Keyword',
32             'Normal Text' => 'Normal',
33             'String' => 'String',
34             });
35 1         8 $self->listAdd('features',
36             'aget',
37             'aset',
38             'create',
39             'div',
40             'invariant',
41             'is_eq',
42             'is_geq',
43             'is_gt',
44             'is_leq',
45             'is_lt',
46             'is_neq',
47             'main',
48             'minus',
49             'mod',
50             'negate',
51             'not',
52             'plus',
53             'pow',
54             'times',
55             );
56 1         5 $self->listAdd('keywords',
57             'ITER',
58             'ROUT',
59             'SAME',
60             'abstract',
61             'and',
62             'any',
63             'assert',
64             'attr',
65             'bind',
66             'break!',
67             'case',
68             'class',
69             'const',
70             'else',
71             'elsif',
72             'end',
73             'exception',
74             'external',
75             'false',
76             'fork',
77             'guard',
78             'if',
79             'immutable',
80             'in',
81             'include',
82             'initial',
83             'inout',
84             'is',
85             'lock',
86             'loop',
87             'new',
88             'once',
89             'or',
90             'out',
91             'par',
92             'parloop',
93             'partial',
94             'post',
95             'pre',
96             'private',
97             'protect',
98             'quit',
99             'raise',
100             'readonly',
101             'result',
102             'return',
103             'self',
104             'shared',
105             'spread',
106             'stub',
107             'then',
108             'true',
109             'type',
110             'typecase',
111             'until!',
112             'value',
113             'void',
114             'when',
115             'while!',
116             'yield',
117             );
118 1         4 $self->listAdd('types',
119             '$OB',
120             '$REHASH',
121             'AREF',
122             'ARRAY',
123             'AVAL',
124             'BOOL',
125             'CHAR',
126             'EXT_OB',
127             'FLT',
128             'FLTD',
129             'FLTDX',
130             'FLTI',
131             'FLTX',
132             'INT',
133             'INTI',
134             'STR',
135             'SYS',
136             );
137 1         9 $self->contextdata({
138             'Comment' => {
139             callback => \&parseComment,
140             attribute => 'Comment',
141             lineending => '#pop',
142             },
143             'Normal' => {
144             callback => \&parseNormal,
145             attribute => 'Normal Text',
146             },
147             'String' => {
148             callback => \&parseString,
149             attribute => 'String',
150             },
151             });
152 1         5 $self->deliminators('\\s||\\.|\\(|\\)|:|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|\\$|\\!');
153 1         3 $self->basecontext('Normal');
154 1         4 $self->keywordscase(0);
155 1         3 $self->initialize;
156 1         3 bless ($self, $class);
157 1         2 return $self;
158             }
159              
160             sub language {
161 0     0 0   return 'Sather';
162             }
163              
164             sub parseComment {
165 0     0 0   my ($self, $text) = @_;
166 0           return 0;
167             };
168              
169             sub parseNormal {
170 0     0 0   my ($self, $text) = @_;
171             # String => 'keywords'
172             # attribute => 'Keyword'
173             # context => '#stay'
174             # type => 'keyword'
175 0 0         if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
176 0           return 1
177             }
178             # String => 'types'
179             # attribute => 'Data Type'
180             # context => '#stay'
181             # type => 'keyword'
182 0 0         if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
183 0           return 1
184             }
185             # String => 'features'
186             # attribute => 'Features'
187             # context => '#stay'
188             # type => 'keyword'
189 0 0         if ($self->testKeyword($text, 'features', 0, undef, 0, '#stay', 'Features')) {
190 0           return 1
191             }
192             # attribute => 'Float'
193             # context => '#stay'
194             # type => 'Float'
195 0 0         if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
196 0           return 1
197             }
198             # attribute => 'Decimal'
199             # context => '#stay'
200             # type => 'Int'
201 0 0         if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
202 0           return 1
203             }
204             # String => ''.''
205             # attribute => 'Char'
206             # context => '#stay'
207             # type => 'RegExpr'
208 0 0         if ($self->testRegExpr($text, '\'.\'', 0, 0, 0, undef, 0, '#stay', 'Char')) {
209 0           return 1
210             }
211             # attribute => 'String'
212             # char => '"'
213             # context => 'String'
214             # type => 'DetectChar'
215 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
216 0           return 1
217             }
218             # attribute => 'Comment'
219             # char => '-'
220             # char1 => '-'
221             # context => 'Comment'
222             # type => 'Detect2Chars'
223 0 0         if ($self->testDetect2Chars($text, '-', '-', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
224 0           return 1
225             }
226 0           return 0;
227             };
228              
229             sub parseString {
230 0     0 0   my ($self, $text) = @_;
231             # attribute => 'String'
232             # char => '"'
233             # context => '#pop'
234             # type => 'DetectChar'
235 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
236 0           return 1
237             }
238 0           return 0;
239             };
240              
241              
242             1;
243              
244             __END__