File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/PostScript.pm
Criterion Covered Total %
statement 45 46 97.8
branch 16 16 100.0
condition 1 3 33.3
subroutine 8 9 88.8
pod 0 6 0.0
total 70 80 87.5


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 'postscript.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 version 2.1
10             #generated: Sun Feb 3 22:02:06 2008, localtime
11              
12             package Syntax::Highlight::Engine::Kate::PostScript;
13              
14             our $VERSION = '0.16';
15              
16 1     1   1008 use strict;
  1         35  
  1         42  
17 1     1   6 use warnings;
  1         3  
  1         72  
18 1     1   5 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         1126  
19              
20             sub new {
21 2     2 0 989 my $proto = shift;
22 2   33     14 my $class = ref($proto) || $proto;
23 2         16 my $self = $class->SUPER::new(@_);
24 2         29 $self->attributes({
25             'Comment' => 'Comment',
26             'Data Type' => 'DataType',
27             'Decimal' => 'DecVal',
28             'Float' => 'Float',
29             'Header' => 'Others',
30             'Keyword' => 'Keyword',
31             'Normal Text' => 'Normal',
32             'String' => 'String',
33             });
34 2         26 $self->listAdd('keywords',
35             'ASCII85Decode',
36             'ASCII85Encode',
37             'ASCIIHexDecode',
38             'ASCIIHexEncode',
39             'CCITTFaxDecode',
40             'CCITTFaxEncode',
41             'CIEBasedA',
42             'CIEBasedABC',
43             'CIEBasedDEF',
44             'CIEBasedDEFG',
45             'Courier',
46             'Courier-Bold',
47             'Courier-BoldOblique',
48             'Courier-Oblique',
49             'DCTDecode',
50             'DCTEncode',
51             'DeviceCMYK',
52             'DeviceGray',
53             'DeviceN',
54             'DeviceRGB',
55             'FontDirectory',
56             'GlobalFontDirectory',
57             'Helvetica',
58             'Helvetica-Bold',
59             'Helvetica-BoldOblique',
60             'Helvetica-Oblique',
61             'ISOLatin1Encoding',
62             'Indexed',
63             'LZWDecode',
64             'LZWEncode',
65             'NullEncode',
66             'Pattern',
67             'RunLengthDecode',
68             'RunLengthEncode',
69             'Separation',
70             'SharedFontDirectory',
71             'StandardEncoding',
72             'SubFileDecode',
73             'Symbol',
74             'Times-Bold',
75             'Times-BoldItalic',
76             'Times-Italic',
77             'Times-Roman',
78             'UserObjects',
79             'abs',
80             'add',
81             'aload',
82             'anchorsearch',
83             'and',
84             'arc',
85             'arcn',
86             'arct',
87             'arcto',
88             'array',
89             'ashow',
90             'astore',
91             'atan',
92             'awidthshow',
93             'banddevice',
94             'begin',
95             'bind',
96             'bitshift',
97             'bytesavailable',
98             'cachestatus',
99             'ceiling',
100             'charpath',
101             'clear',
102             'cleardictstack',
103             'cleartomark',
104             'clip',
105             'clippath',
106             'closefile',
107             'closepath',
108             'colorimage',
109             'concat',
110             'concatmatrix',
111             'condition',
112             'copy',
113             'copypage',
114             'cos',
115             'count',
116             'countdictstack',
117             'countexecstack',
118             'counttomark',
119             'cshow',
120             'currentblackgeneration',
121             'currentcacheparams',
122             'currentcmykcolor',
123             'currentcolor',
124             'currentcolorrendering',
125             'currentcolorscreen',
126             'currentcolorspace',
127             'currentcolortransfer',
128             'currentcontext',
129             'currentdash',
130             'currentdevparams',
131             'currentdict',
132             'currentfile',
133             'currentflat',
134             'currentfont',
135             'currentglobal',
136             'currentgray',
137             'currentgstate',
138             'currenthalftone',
139             'currenthalftonephase',
140             'currenthsbcolor',
141             'currentlinecap',
142             'currentlinejoin',
143             'currentlinewidth',
144             'currentmatrix',
145             'currentmiterlimit',
146             'currentobjectformat',
147             'currentoverprint',
148             'currentpacking',
149             'currentpagedevice',
150             'currentpoint',
151             'currentrgbcolor',
152             'currentscreen',
153             'currentshared',
154             'currentstrokeadjust',
155             'currentsystemparams',
156             'currenttransfer',
157             'currentundercolorremoval',
158             'currentuserparams',
159             'curveto',
160             'cvi',
161             'cvlit',
162             'cvn',
163             'cvr',
164             'cvrs',
165             'cvs',
166             'cvx',
167             'def',
168             'defaultmatrix',
169             'definefont',
170             'defineresource',
171             'defineusername',
172             'defineuserobject',
173             'deletefile',
174             'detach',
175             'deviceinfo',
176             'dict',
177             'dictstack',
178             'div',
179             'dtransform',
180             'dup',
181             'echo',
182             'end',
183             'eoclip',
184             'eofill',
185             'eoviewclip',
186             'eq',
187             'erasepage',
188             'errordict',
189             'exch',
190             'exec',
191             'execform',
192             'execstack',
193             'execuserobject',
194             'executeonly',
195             'exit',
196             'exp',
197             'false',
198             'file',
199             'filenameforall',
200             'fileposition',
201             'fill',
202             'filter',
203             'findencoding',
204             'findfont',
205             'findresource',
206             'flattenpath',
207             'floor',
208             'flush',
209             'flushfile',
210             'for',
211             'forall',
212             'fork',
213             'framedevice',
214             'gcheck',
215             'ge',
216             'get',
217             'getinterval',
218             'globaldict',
219             'glyphshow',
220             'grestore',
221             'grestoreall',
222             'gsave',
223             'gstate',
224             'gt',
225             'handleerror',
226             'identmatrix',
227             'idiv',
228             'idtransform',
229             'if',
230             'ifelse',
231             'image',
232             'imagemask',
233             'index',
234             'ineofill',
235             'infill',
236             'initclip',
237             'initgraphics',
238             'initmatrix',
239             'initviewclip',
240             'instroke',
241             'inueofill',
242             'inufill',
243             'inustroke',
244             'invertmatrix',
245             'itransform',
246             'join',
247             'known',
248             'kshow',
249             'languagelevel',
250             'le',
251             'length',
252             'lineto',
253             'ln',
254             'load',
255             'lock',
256             'log',
257             'loop',
258             'lt',
259             'makefont',
260             'makepattern',
261             'mark',
262             'matrix',
263             'maxlength',
264             'mod',
265             'monitor',
266             'moveto',
267             'mul',
268             'ne',
269             'neg',
270             'newpath',
271             'noaccess',
272             'not',
273             'notify',
274             'null',
275             'nulldevice',
276             'or',
277             'packedarray',
278             'pathbbox',
279             'pathforall',
280             'pop',
281             'print',
282             'printobject',
283             'product',
284             'pstack',
285             'put',
286             'putinterval',
287             'quit',
288             'rand',
289             'rcheck',
290             'rcurveto',
291             'read',
292             'readhexstring',
293             'readline',
294             'readonly',
295             'readstring',
296             'realtime',
297             'rectclip',
298             'rectfill',
299             'rectstroke',
300             'rectviewclip',
301             'renamefile',
302             'renderbands',
303             'repeat',
304             'resetfile',
305             'resourceforall',
306             'resourcestatus',
307             'restore',
308             'reversepath',
309             'revision',
310             'rlineto',
311             'rmoveto',
312             'roll',
313             'rootfont',
314             'rotate',
315             'round',
316             'rrand',
317             'run',
318             'save',
319             'scale',
320             'scalefont',
321             'scheck',
322             'search',
323             'selectfont',
324             'serialnumber',
325             'setbbox',
326             'setblackgeneration',
327             'setcachedevice',
328             'setcachedevice2',
329             'setcachelimit',
330             'setcacheparams',
331             'setcharwidth',
332             'setcmykcolor',
333             'setcolor',
334             'setcolorrendering',
335             'setcolorscreen',
336             'setcolorspace',
337             'setcolortransfer',
338             'setdash',
339             'setdevparams',
340             'setfileposition',
341             'setflat',
342             'setfont',
343             'setglobal',
344             'setgray',
345             'setgstate',
346             'sethalftone',
347             'sethalftonephase',
348             'sethsbcolor',
349             'setlinecap',
350             'setlinejoin',
351             'setlinewidth',
352             'setmatrix',
353             'setmiterlimit',
354             'setobjectformat',
355             'setoverprint',
356             'setpacking',
357             'setpagedevice',
358             'setpattern',
359             'setrgbcolor',
360             'setscreen',
361             'setshared',
362             'setstrokeadjust',
363             'setsystemparams',
364             'settransfer',
365             'setucacheparams',
366             'setundercolorremoval',
367             'setuserparams',
368             'setvmthreshold',
369             'shareddict',
370             'show',
371             'showpage',
372             'sin',
373             'sqrt',
374             'srand',
375             'stack',
376             'startjob',
377             'status',
378             'statusdict',
379             'stop',
380             'stopped',
381             'store',
382             'string',
383             'stringwidth',
384             'stroke',
385             'strokepath',
386             'sub',
387             'systemdict',
388             'token',
389             'transform',
390             'translate',
391             'true',
392             'truncate',
393             'type',
394             'uappend',
395             'ucache',
396             'ucachestatus',
397             'ueofill',
398             'ufill',
399             'undef',
400             'undefinefont',
401             'undefineresource',
402             'undefineuserobject',
403             'upath',
404             'userdict',
405             'usertime',
406             'ustroke',
407             'ustrokepath',
408             'version',
409             'viewclip',
410             'viewclippath',
411             'vmreclaim',
412             'vmstatus',
413             'wait',
414             'wcheck',
415             'where',
416             'widthshow',
417             'write',
418             'writehexstring',
419             'writeobject',
420             'writestring',
421             'wtranslation',
422             'xcheck',
423             'xor',
424             'xshow',
425             'xyshow',
426             'yield',
427             'yshow',
428             );
429 2         29 $self->contextdata({
430             'Comment' => {
431             callback => \&parseComment,
432             attribute => 'Comment',
433             lineending => '#pop',
434             },
435             'Header' => {
436             callback => \&parseHeader,
437             attribute => 'Header',
438             lineending => '#pop',
439             },
440             'Normal' => {
441             callback => \&parseNormal,
442             attribute => 'Normal Text',
443             },
444             'String' => {
445             callback => \&parseString,
446             attribute => 'String',
447             },
448             });
449 2         14 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
450 2         12 $self->basecontext('Normal');
451 2         13 $self->keywordscase(0);
452 2         6 $self->initialize;
453 2         4 bless ($self, $class);
454 2         12 return $self;
455             }
456              
457             sub language {
458 0     0 0 0 return 'PostScript';
459             }
460              
461             sub parseComment {
462 672     672 0 1317 my ($self, $text) = @_;
463 672         1624 return 0;
464             };
465              
466             sub parseHeader {
467 24     24 0 43 my ($self, $text) = @_;
468 24         48 return 0;
469             };
470              
471             sub parseNormal {
472 3418     3418 0 8647 my ($self, $text) = @_;
473             # String => 'keywords'
474             # attribute => 'Keyword'
475             # context => '#stay'
476             # type => 'keyword'
477 3418 100       12279 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
478 430         1710 return 1
479             }
480             # attribute => 'Header'
481             # char => '%'
482             # char1 => '!'
483             # context => 'Header'
484             # type => 'Detect2Chars'
485 2988 100       12284 if ($self->testDetect2Chars($text, '%', '!', 0, 0, 0, undef, 0, 'Header', 'Header')) {
486 2         6 return 1
487             }
488             # attribute => 'Comment'
489             # char => '%'
490             # context => 'Comment'
491             # type => 'DetectChar'
492 2986 100       10874 if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
493 34         129 return 1
494             }
495             # attribute => 'Float'
496             # context => '#stay'
497             # type => 'Float'
498 2952 100       9707 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
499 392         1354 return 1
500             }
501             # attribute => 'Decimal'
502             # context => '#stay'
503             # type => 'Int'
504 2560 100       8733 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
505 36         166 return 1
506             }
507             # attribute => 'String'
508             # char => '('
509             # context => 'String'
510             # type => 'DetectChar'
511 2524 100       8255 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'String', 'String')) {
512 16         87 return 1
513             }
514             # String => '\/{1,2}[^\s\(\)\{\}\[\]%/]*'
515             # attribute => 'Data Type'
516             # context => '#stay'
517             # type => 'RegExpr'
518 2508 100       9146 if ($self->testRegExpr($text, '\\/{1,2}[^\\s\\(\\)\\{\\}\\[\\]%/]*', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
519 144         509 return 1
520             }
521 2364         7244 return 0;
522             };
523              
524             sub parseString {
525 266     266 0 634 my ($self, $text) = @_;
526             # attribute => 'String'
527             # char => ')'
528             # context => '#pop'
529             # type => 'DetectChar'
530 266 100       913 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'String')) {
531 16         75 return 1
532             }
533 250         637 return 0;
534             };
535              
536              
537             1;
538              
539             __END__