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.12';
15              
16 1     1   466 use strict;
  1         3  
  1         31  
17 1     1   5 use warnings;
  1         2  
  1         26  
18 1     1   5 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         534  
19              
20             sub new {
21 2     2 0 699 my $proto = shift;
22 2   33     11 my $class = ref($proto) || $proto;
23 2         14 my $self = $class->SUPER::new(@_);
24 2         18 $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         10 $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         9 $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         17 $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         9 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
148 2         6 $self->basecontext('Normal');
149 2         8 $self->keywordscase(1);
150 2         6 $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 880 my ($self, $text) = @_;
161 500         961 return 0;
162             };
163              
164             sub parseNormal {
165 762     762 0 1441 my ($self, $text) = @_;
166             # String => 'keywords'
167             # attribute => 'Keyword'
168             # context => '#stay'
169             # type => 'keyword'
170 762 100       2361 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
171 30         112 return 1
172             }
173             # String => 'nodes'
174             # attribute => 'Node'
175             # context => '#stay'
176             # type => 'keyword'
177 732 100       2067 if ($self->testKeyword($text, 'nodes', 0, undef, 0, '#stay', 'Node')) {
178 112         345 return 1
179             }
180             # String => 'types'
181             # attribute => 'Data Type'
182             # context => '#stay'
183             # type => 'keyword'
184 620 100       1724 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
185 40         120 return 1
186             }
187             # attribute => 'Float'
188             # context => '#stay'
189             # type => 'Float'
190 580 100       1688 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
191 10         37 return 1
192             }
193             # attribute => 'Hex'
194             # context => '#stay'
195             # type => 'HlCHex'
196 570 50       1784 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       1751 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       1661 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
211 4         14 return 1
212             }
213             # attribute => 'Normal Text'
214             # char => '}'
215             # context => '#stay'
216             # endRegion => 'Brace'
217             # type => 'DetectChar'
218 566 100       1524 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
219 4         11 return 1
220             }
221             # attribute => 'String'
222             # char => '"'
223             # context => 'String'
224             # type => 'DetectChar'
225 562 100       1454 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
226 6         20 return 1
227             }
228             # attribute => 'Comment'
229             # char => '#'
230             # context => 'Comment'
231             # type => 'DetectChar'
232 556 100       1427 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
233 18         50 return 1
234             }
235 538         1214 return 0;
236             };
237              
238             sub parseString {
239 236     236 0 454 my ($self, $text) = @_;
240             # attribute => 'String'
241             # context => '#stay'
242             # type => 'LineContinue'
243 236 100       654 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       686 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
250 2         12 return 1
251             }
252             # attribute => 'String'
253             # char => '"'
254             # context => '#pop'
255             # type => 'DetectChar'
256 232 100       614 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
257 6         18 return 1
258             }
259 226         502 return 0;
260             };
261              
262              
263             1;
264              
265             __END__