File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/VRML.pm
Criterion Covered Total %
statement 53 56 94.6
branch 24 26 92.3
condition 1 3 33.3
subroutine 7 8 87.5
pod 0 5 0.0
total 85 98 86.7


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 'vrml.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.02
9             #kate author Volker Krause (volker.krause@rwth-aachen.de)
10             #generated: Sun Feb 3 22:02:06 2008, localtime
11              
12             package Syntax::Highlight::Engine::Kate::VRML;
13              
14             our $VERSION = '0.16';
15              
16 1     1   542 use strict;
  1         2  
  1         47  
17 1     1   4 use warnings;
  1         2  
  1         40  
18 1     1   3 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         489  
19              
20             sub new {
21 2     2 0 650 my $proto = shift;
22 2   33     10 my $class = ref($proto) || $proto;
23 2         12 my $self = $class->SUPER::new(@_);
24 2         19 $self->attributes({
25             'Comment' => 'Comment',
26             'Data Type' => 'DataType',
27             'Decimal' => 'DecVal',
28             'Float' => 'Float',
29             'Hex' => 'BaseN',
30             'Keyword' => 'Keyword',
31             'Node' => 'Others',
32             'Normal Text' => 'Normal',
33             'String' => 'String',
34             'String Char' => 'Char',
35             });
36 2         8 $self->listAdd('keywords',
37             'DEF',
38             'EXTERNPROTO',
39             'FALSE',
40             'IS',
41             'NULL',
42             'PROTO',
43             'ROUTE',
44             'TO',
45             'TRUE',
46             'USE',
47             'eventIn',
48             'eventOut',
49             'exposedField',
50             'field',
51             );
52 2         7 $self->listAdd('nodes',
53             'Anchor',
54             'Appearance',
55             'AudioClip',
56             'Background',
57             'Billboard',
58             'Box',
59             'Collision',
60             'Color',
61             'ColorInterpolator',
62             'Cone',
63             'Coordinate',
64             'CoordinateInterpolator',
65             'Cylinder',
66             'CylinderSensor',
67             'DirectionalLight',
68             'ElevationGrid',
69             'Extrusion',
70             'Fog',
71             'FontStyle',
72             'Group',
73             'ImageTexture',
74             'IndexedFaceSet',
75             'IndexedLineSet',
76             'Inline',
77             'LOD',
78             'Material',
79             'MovieTexture',
80             'NavigationInfo',
81             'Normal',
82             'NormalInterpolator',
83             'OrientationInterpolator',
84             'PixelTexture',
85             'Plane',
86             'PlaneSensor',
87             'PointLight',
88             'PointSet',
89             'PositionInterpolator',
90             'ProximitySensor',
91             'ScalarInterpolator',
92             'Script',
93             'Sensor',
94             'Shape',
95             'Sound',
96             'Sphere',
97             'SphereSensor',
98             'SpotLight',
99             'Switch',
100             'Text',
101             'TextureCoordinate',
102             'TextureTransform',
103             'TimeSensor',
104             'TouchSensor',
105             'Transform',
106             'Viewpoint',
107             'VisibilitySensor',
108             'WorldInfo',
109             );
110 2         8 $self->listAdd('types',
111             'MFColor',
112             'MFFloat',
113             'MFInt32',
114             'MFNode',
115             'MFRotation',
116             'MFString',
117             'MFTime',
118             'MFVec2f',
119             'MFVec3f',
120             'SFBool',
121             'SFColor',
122             'SFFloat',
123             'SFImage',
124             'SFInt32',
125             'SFNode',
126             'SFRotation',
127             'SFString',
128             'SFTime',
129             'SFVec2f',
130             'SFVec3f',
131             );
132 2         16 $self->contextdata({
133             'Comment' => {
134             callback => \&parseComment,
135             attribute => 'Comment',
136             lineending => '#pop',
137             },
138             'Normal' => {
139             callback => \&parseNormal,
140             attribute => 'Normal Text',
141             },
142             'String' => {
143             callback => \&parseString,
144             attribute => 'String',
145             },
146             });
147 2         7 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
148 2         6 $self->basecontext('Normal');
149 2         8 $self->keywordscase(1);
150 2         5 $self->initialize;
151 2         4 bless ($self, $class);
152 2         9 return $self;
153             }
154              
155             sub language {
156 0     0 0 0 return 'VRML';
157             }
158              
159             sub parseComment {
160 500     500 0 1006 my ($self, $text) = @_;
161 500         1141 return 0;
162             };
163              
164             sub parseNormal {
165 762     762 0 2213 my ($self, $text) = @_;
166             # String => 'keywords'
167             # attribute => 'Keyword'
168             # context => '#stay'
169             # type => 'keyword'
170 762 100       3090 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
171 30         123 return 1
172             }
173             # String => 'nodes'
174             # attribute => 'Node'
175             # context => '#stay'
176             # type => 'keyword'
177 732 100       2905 if ($self->testKeyword($text, 'nodes', 0, undef, 0, '#stay', 'Node')) {
178 112         421 return 1
179             }
180             # String => 'types'
181             # attribute => 'Data Type'
182             # context => '#stay'
183             # type => 'keyword'
184 620 100       2238 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
185 40         149 return 1
186             }
187             # attribute => 'Float'
188             # context => '#stay'
189             # type => 'Float'
190 580 100       2016 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
191 10         44 return 1
192             }
193             # attribute => 'Hex'
194             # context => '#stay'
195             # type => 'HlCHex'
196 570 50       3557 if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
197 0         0 return 1
198             }
199             # attribute => 'Decimal'
200             # context => '#stay'
201             # type => 'Int'
202 570 50       2210 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
203 0         0 return 1
204             }
205             # attribute => 'Normal Text'
206             # beginRegion => 'Brace'
207             # char => '{'
208             # context => '#stay'
209             # type => 'DetectChar'
210 570 100       2078 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
211 4         17 return 1
212             }
213             # attribute => 'Normal Text'
214             # char => '}'
215             # context => '#stay'
216             # endRegion => 'Brace'
217             # type => 'DetectChar'
218 566 100       1893 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
219 4         14 return 1
220             }
221             # attribute => 'String'
222             # char => '"'
223             # context => 'String'
224             # type => 'DetectChar'
225 562 100       1657 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
226 6         41 return 1
227             }
228             # attribute => 'Comment'
229             # char => '#'
230             # context => 'Comment'
231             # type => 'DetectChar'
232 556 100       1883 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
233 18         51 return 1
234             }
235 538         1495 return 0;
236             };
237              
238             sub parseString {
239 236     236 0 421 my ($self, $text) = @_;
240             # attribute => 'String'
241             # context => '#stay'
242             # type => 'LineContinue'
243 236 100       664 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) {
244 2         7 return 1
245             }
246             # attribute => 'String Char'
247             # context => '#stay'
248             # type => 'HlCStringChar'
249 234 100       799 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
250 2         7 return 1
251             }
252             # attribute => 'String'
253             # char => '"'
254             # context => '#pop'
255             # type => 'DetectChar'
256 232 100       702 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
257 6         20 return 1
258             }
259 226         543 return 0;
260             };
261              
262              
263             1;
264              
265             __END__