File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/JavaScript.pm
Criterion Covered Total %
statement 136 151 90.0
branch 90 102 88.2
condition 1 3 33.3
subroutine 14 16 87.5
pod 0 13 0.0
total 241 285 84.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 'javascript.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.10
9             #kate version 2.3
10             #kate author Anders Lund (anders@alweb.dk), Joseph Wenninger (jowenn@kde.org), Whitehawk Stormchaser (zerokode@gmx.net)
11             #generated: Sun Feb 3 22:02:05 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::JavaScript;
14              
15             our $VERSION = '0.07';
16              
17 1     1   2856 use strict;
  1         2  
  1         53  
18 1     1   6 use warnings;
  1         3  
  1         37  
19 1     1   7 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         2720  
20              
21             sub new {
22 2     2 0 956 my $proto = shift;
23 2   33     15 my $class = ref($proto) || $proto;
24 2         20 my $self = $class->SUPER::new(@_);
25 2         45 $self->attributes({
26             'Char' => 'Char',
27             'Comment' => 'Comment',
28             'Data Type' => 'DataType',
29             'Decimal' => 'DecVal',
30             'Events' => 'Operator',
31             'Float' => 'Float',
32             'Function' => 'Function',
33             'Keyword' => 'Keyword',
34             'Math' => 'BString',
35             'Normal Text' => 'Normal',
36             'Objects' => 'Reserved',
37             'Pattern Character Class' => 'BaseN',
38             'Pattern Internal Operator' => 'Float',
39             'Region Marker' => 'RegionMarker',
40             'Regular Expression' => 'Others',
41             'String' => 'String',
42             'String Char' => 'Char',
43             'Symbol' => 'Normal',
44             });
45 2         17 $self->listAdd('events',
46             'onAbort',
47             'onBlur',
48             'onChange',
49             'onClick',
50             'onError',
51             'onFocus',
52             'onLoad',
53             'onMouseOut',
54             'onMouseOver',
55             'onReset',
56             'onSelect',
57             'onSubmit',
58             'onUnload',
59             );
60 2         7 $self->listAdd('functions',
61             'Number',
62             'escape',
63             'isFinite',
64             'isNaN',
65             'parseFloat',
66             'parseInt',
67             'reload',
68             'taint',
69             'unescape',
70             'untaint',
71             'write',
72             );
73 2         12 $self->listAdd('keywords',
74             'break',
75             'case',
76             'catch',
77             'const',
78             'continue',
79             'default',
80             'delete',
81             'do',
82             'else',
83             'false',
84             'finally',
85             'for',
86             'function',
87             'if',
88             'in',
89             'new',
90             'return',
91             'switch',
92             'throw',
93             'true',
94             'try',
95             'typeof',
96             'var',
97             'void',
98             'while',
99             'with',
100             );
101 2         8 $self->listAdd('math',
102             'E',
103             'LN10',
104             'LN2',
105             'LOG10E',
106             'LOG2E',
107             'PI',
108             'SQRT1_2',
109             'SQRT2',
110             'abs',
111             'acos',
112             'asin',
113             'atan',
114             'atan2',
115             'ceil',
116             'cos',
117             'ctg',
118             'exp',
119             'floor',
120             'log',
121             'pow',
122             'round',
123             'sin',
124             'sqrt',
125             'tan',
126             );
127 2         22 $self->listAdd('methods',
128             'MAX_VALUE',
129             'MIN_VALUE',
130             'NEGATIVE_INFINITY',
131             'NaN',
132             'POSITIVE_INFINITY',
133             'URL',
134             'UTC',
135             'above',
136             'action',
137             'alert',
138             'alinkColor',
139             'anchor',
140             'anchors',
141             'appCodeName',
142             'appName',
143             'appVersion',
144             'applets',
145             'apply',
146             'argument',
147             'arguments',
148             'arity',
149             'availHeight',
150             'availWidth',
151             'back',
152             'background',
153             'below',
154             'bgColor',
155             'big',
156             'blink',
157             'blur',
158             'bold',
159             'border',
160             'border',
161             'call',
162             'caller',
163             'charAt',
164             'charCodeAt',
165             'checked',
166             'clearInterval',
167             'clearTimeout',
168             'click',
169             'clip',
170             'close',
171             'closed',
172             'colorDepth',
173             'compile',
174             'complete',
175             'confirm',
176             'constructor',
177             'cookie',
178             'current',
179             'cursor',
180             'data',
181             'defaultChecked',
182             'defaultSelected',
183             'defaultStatus',
184             'defaultValue',
185             'description',
186             'disableExternalCapture',
187             'domain',
188             'elements',
189             'embeds',
190             'enableExternalCapture',
191             'enabledPlugin',
192             'encoding',
193             'eval',
194             'exec',
195             'fgColor',
196             'filename',
197             'find',
198             'fixed',
199             'focus',
200             'fontcolor',
201             'fontsize',
202             'form',
203             'formName',
204             'forms',
205             'forward',
206             'frames',
207             'fromCharCode',
208             'getDate',
209             'getDay',
210             'getHours',
211             'getMiliseconds',
212             'getMinutes',
213             'getMonth',
214             'getSeconds',
215             'getSelection',
216             'getTime',
217             'getTimezoneOffset',
218             'getUTCDate',
219             'getUTCDay',
220             'getUTCFullYear',
221             'getUTCHours',
222             'getUTCMilliseconds',
223             'getUTCMinutes',
224             'getUTCMonth',
225             'getUTCSeconds',
226             'getYear',
227             'global',
228             'go',
229             'hash',
230             'height',
231             'history',
232             'home',
233             'host',
234             'hostname',
235             'href',
236             'hspace',
237             'ignoreCase',
238             'images',
239             'index',
240             'indexOf',
241             'innerHeight',
242             'innerWidth',
243             'input',
244             'italics',
245             'javaEnabled',
246             'join',
247             'language',
248             'lastIndex',
249             'lastIndexOf',
250             'lastModified',
251             'lastParen',
252             'layerX',
253             'layerY',
254             'layers',
255             'left',
256             'leftContext',
257             'length',
258             'link',
259             'linkColor',
260             'links',
261             'load',
262             'location',
263             'locationbar',
264             'lowsrc',
265             'match',
266             'menubar',
267             'method',
268             'mimeTypes',
269             'modifiers',
270             'moveAbove',
271             'moveBelow',
272             'moveBy',
273             'moveTo',
274             'moveToAbsolute',
275             'multiline',
276             'name',
277             'negative_infinity',
278             'next',
279             'open',
280             'opener',
281             'options',
282             'outerHeight',
283             'outerWidth',
284             'pageX',
285             'pageXoffset',
286             'pageY',
287             'pageYoffset',
288             'parent',
289             'parse',
290             'pathname',
291             'personalbar',
292             'pixelDepth',
293             'platform',
294             'plugins',
295             'pop',
296             'port',
297             'positive_infinity',
298             'preference',
299             'previous',
300             'print',
301             'prompt',
302             'protocol',
303             'prototype',
304             'push',
305             'referrer',
306             'refresh',
307             'releaseEvents',
308             'reload',
309             'replace',
310             'reset',
311             'resizeBy',
312             'resizeTo',
313             'reverse',
314             'rightContext',
315             'screenX',
316             'screenY',
317             'scroll',
318             'scrollBy',
319             'scrollTo',
320             'scrollbar',
321             'search',
322             'select',
323             'selected',
324             'selectedIndex',
325             'self',
326             'setDate',
327             'setHours',
328             'setMinutes',
329             'setMonth',
330             'setSeconds',
331             'setTime',
332             'setTimeout',
333             'setUTCDate',
334             'setUTCDay',
335             'setUTCFullYear',
336             'setUTCHours',
337             'setUTCMilliseconds',
338             'setUTCMinutes',
339             'setUTCMonth',
340             'setUTCSeconds',
341             'setYear',
342             'shift',
343             'siblingAbove',
344             'siblingBelow',
345             'small',
346             'sort',
347             'source',
348             'splice',
349             'split',
350             'src',
351             'status',
352             'statusbar',
353             'strike',
354             'sub',
355             'submit',
356             'substr',
357             'substring',
358             'suffixes',
359             'sup',
360             'taintEnabled',
361             'target',
362             'test',
363             'text',
364             'title',
365             'toGMTString',
366             'toLocaleString',
367             'toLowerCase',
368             'toSource',
369             'toString',
370             'toUTCString',
371             'toUpperCase',
372             'toolbar',
373             'top',
374             'type',
375             'unshift',
376             'unwatch',
377             'userAgent',
378             'value',
379             'valueOf',
380             'visibility',
381             'vlinkColor',
382             'vspace',
383             'watch',
384             'which',
385             'width',
386             'width',
387             'write',
388             'writeln',
389             'x',
390             'y',
391             'zIndex',
392             );
393 2         9 $self->listAdd('objects',
394             'Anchor',
395             'Applet',
396             'Area',
397             'Array',
398             'Boolean',
399             'Button',
400             'Checkbox',
401             'Date',
402             'FileUpload',
403             'Form',
404             'Frame',
405             'Function',
406             'Hidden',
407             'Image',
408             'Layer',
409             'Link',
410             'Math',
411             'Max',
412             'MimeType',
413             'Min',
414             'Object',
415             'Password',
416             'Plugin',
417             'Radio',
418             'RegExp',
419             'Reset',
420             'Screen',
421             'Select',
422             'String',
423             'Text',
424             'Textarea',
425             'Window',
426             'document',
427             'navigator',
428             'this',
429             'window',
430             );
431 2         67 $self->contextdata({
432             '(Internal regex catch)' => {
433             callback => \&parseBoInternalregexcatchBc,
434             attribute => 'Normal Text',
435             fallthrough => '#pop',
436             },
437             '(charclass caret first check)' => {
438             callback => \&parseBocharclasscaretfirstcheckBc,
439             attribute => 'Pattern Internal Operator',
440             lineending => '#pop',
441             fallthrough => 'Regular Expression Character Class',
442             },
443             '(regex caret first check)' => {
444             callback => \&parseBoregexcaretfirstcheckBc,
445             attribute => 'Pattern Internal Operator',
446             lineending => '#pop',
447             fallthrough => 'Regular Expression',
448             },
449             'Comment' => {
450             callback => \&parseComment,
451             attribute => 'Comment',
452             lineending => '#pop',
453             },
454             'Multi/inline Comment' => {
455             callback => \&parseMultiinlineComment,
456             attribute => 'Comment',
457             },
458             'Normal' => {
459             callback => \&parseNormal,
460             attribute => 'Normal Text',
461             },
462             'Regular Expression' => {
463             callback => \&parseRegularExpression,
464             attribute => 'Regular Expression',
465             },
466             'Regular Expression Character Class' => {
467             callback => \&parseRegularExpressionCharacterClass,
468             attribute => 'Pattern Character Class',
469             },
470             'String' => {
471             callback => \&parseString,
472             attribute => 'String',
473             lineending => '#pop',
474             },
475             'String 1' => {
476             callback => \&parseString1,
477             attribute => 'String Char',
478             lineending => '#pop',
479             },
480             'region_marker' => {
481             callback => \&parseregion_marker,
482             attribute => 'Region Marker',
483             lineending => '#pop',
484             },
485             });
486 2         15 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
487 2         9 $self->basecontext('Normal');
488 2         15 $self->keywordscase(0);
489 2         7 $self->initialize;
490 2         7 bless ($self, $class);
491 2         13 return $self;
492             }
493              
494             sub language {
495 0     0 0 0 return 'JavaScript';
496             }
497              
498             sub parseBoInternalregexcatchBc {
499 192     192 0 342 my ($self, $text) = @_;
500             # String => '\s*'
501             # attribute => 'Normal Text'
502             # context => '#stay'
503             # type => 'RegExpr'
504 192 100       711 if ($self->testRegExpr($text, '\\s*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
505 76         259 return 1
506             }
507             # String => '//(?=;)'
508             # attribute => 'Regular Expression'
509             # context => '#pop'
510             # type => 'RegExpr'
511 116 100       595 if ($self->testRegExpr($text, '//(?=;)', 0, 0, 0, undef, 0, '#pop', 'Regular Expression')) {
512 2         9 return 1
513             }
514             # attribute => 'Comment'
515             # char => '/'
516             # char1 => '/'
517             # context => 'Comment'
518             # type => 'Detect2Chars'
519 114 50       566 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
520 0         0 return 1
521             }
522             # attribute => 'Comment'
523             # char => '/'
524             # char1 => '*'
525             # context => 'Multi/inline Comment'
526             # type => 'Detect2Chars'
527 114 100       448 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Multi/inline Comment', 'Comment')) {
528 2         7 return 1
529             }
530             # attribute => 'Regular Expression'
531             # char => '/'
532             # context => '(regex caret first check)'
533             # type => 'DetectChar'
534 112 100       561 if ($self->testDetectChar($text, '/', 0, 0, 0, undef, 0, '(regex caret first check)', 'Regular Expression')) {
535 34         104 return 1
536             }
537 78         257 return 0;
538             };
539              
540             sub parseBocharclasscaretfirstcheckBc {
541 4     4 0 8 my ($self, $text) = @_;
542             # attribute => 'Pattern Internal Operator'
543             # char => '^'
544             # context => 'Regular Expression Character Class'
545             # type => 'DetectChar'
546 4 100       15 if ($self->testDetectChar($text, '^', 0, 0, 0, undef, 0, 'Regular Expression Character Class', 'Pattern Internal Operator')) {
547 2         25 return 1
548             }
549 2         8 return 0;
550             };
551              
552             sub parseBoregexcaretfirstcheckBc {
553 34     34 0 65 my ($self, $text) = @_;
554             # attribute => 'Pattern Internal Operator'
555             # char => '^'
556             # context => 'Regular Expression'
557             # type => 'DetectChar'
558 34 100       223 if ($self->testDetectChar($text, '^', 0, 0, 0, undef, 0, 'Regular Expression', 'Pattern Internal Operator')) {
559 4         17 return 1
560             }
561 30         95 return 0;
562             };
563              
564             sub parseComment {
565 722     722 0 1047 my ($self, $text) = @_;
566             # type => 'DetectSpaces'
567 722 100       2591 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
568 14         46 return 1
569             }
570             # context => '##Alerts'
571             # type => 'IncludeRules'
572 708 100       2206 if ($self->includePlugin('Alerts', $text)) {
573 4         13 return 1
574             }
575             # type => 'DetectIdentifier'
576 704 100       2345 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
577 198         526 return 1
578             }
579 506         1221 return 0;
580             };
581              
582             sub parseMultiinlineComment {
583 2792     2792 0 6150 my ($self, $text) = @_;
584             # context => '##Alerts'
585             # type => 'IncludeRules'
586 2792 100       9228 if ($self->includePlugin('Alerts', $text)) {
587 4         16 return 1
588             }
589             # attribute => 'Comment'
590             # char => '*'
591             # char1 => '/'
592             # context => '#pop'
593             # endRegion => 'Comment'
594             # type => 'Detect2Chars'
595 2788 100       11742 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
596 18         81 return 1
597             }
598 2770         7677 return 0;
599             };
600              
601             sub parseNormal {
602 900     900 0 1433 my ($self, $text) = @_;
603             # type => 'DetectSpaces'
604 900 100       3529 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
605 10         38 return 1
606             }
607             # String => '//BEGIN'
608             # attribute => 'Region Marker'
609             # beginRegion => 'Region1'
610             # context => 'region_marker'
611             # type => 'StringDetect'
612 890 50       3285 if ($self->testStringDetect($text, '//BEGIN', 0, 0, 0, undef, 0, 'region_marker', 'Region Marker')) {
613 0         0 return 1
614             }
615             # String => '//END'
616             # attribute => 'Region Marker'
617             # context => 'region_marker'
618             # endRegion => 'Region1'
619             # type => 'RegExpr'
620 890 50       3757 if ($self->testRegExpr($text, '//END', 0, 0, 0, undef, 0, 'region_marker', 'Region Marker')) {
621 0         0 return 1
622             }
623             # String => 'keywords'
624             # attribute => 'Keyword'
625             # context => '#stay'
626             # type => 'keyword'
627 890 100       3240 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
628 56         226 return 1
629             }
630             # String => 'functions'
631             # attribute => 'Function'
632             # context => '#stay'
633             # type => 'keyword'
634 834 100       3188 if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'Function')) {
635 2         8 return 1
636             }
637             # String => 'objects'
638             # attribute => 'Objects'
639             # context => '#stay'
640             # type => 'keyword'
641 832 100       3042 if ($self->testKeyword($text, 'objects', 0, undef, 0, '#stay', 'Objects')) {
642 8         103 return 1
643             }
644             # String => 'math'
645             # attribute => 'Math'
646             # context => '#stay'
647             # type => 'keyword'
648 824 100       2722 if ($self->testKeyword($text, 'math', 0, undef, 0, '#stay', 'Math')) {
649 6         24 return 1
650             }
651             # String => 'events'
652             # attribute => 'Events'
653             # context => '#stay'
654             # type => 'keyword'
655 818 50       2860 if ($self->testKeyword($text, 'events', 0, undef, 0, '#stay', 'Events')) {
656 0         0 return 1
657             }
658             # String => 'methods'
659             # attribute => 'Data Type'
660             # context => '#stay'
661             # type => 'keyword'
662 818 100       3137 if ($self->testKeyword($text, 'methods', 0, undef, 0, '#stay', 'Data Type')) {
663 10         43 return 1
664             }
665             # type => 'DetectIdentifier'
666 808 100       3056 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
667 72         269 return 1
668             }
669             # attribute => 'Float'
670             # context => '#stay'
671             # type => 'Float'
672 736 100       3633 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
673 6         25 return 1
674             }
675             # attribute => 'Decimal'
676             # context => '#stay'
677             # type => 'Int'
678 730 50       2651 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
679 0         0 return 1
680             }
681             # attribute => 'String'
682             # char => '"'
683             # context => 'String'
684             # type => 'DetectChar'
685 730 100       2593 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
686 16         63 return 1
687             }
688             # attribute => 'String'
689             # char => '''
690             # context => 'String 1'
691             # type => 'DetectChar'
692 714 100       2445 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'String 1', 'String')) {
693 2         9 return 1
694             }
695             # attribute => 'Comment'
696             # char => '/'
697             # char1 => '/'
698             # context => 'Comment'
699             # type => 'Detect2Chars'
700 712 100       2845 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
701 34         121 return 1
702             }
703             # attribute => 'Comment'
704             # beginRegion => 'Comment'
705             # char => '/'
706             # char1 => '*'
707             # context => 'Multi/inline Comment'
708             # type => 'Detect2Chars'
709 678 100       2156 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Multi/inline Comment', 'Comment')) {
710 16         55 return 1
711             }
712             # String => '[=?:]'
713             # attribute => 'Normal Text'
714             # context => '(Internal regex catch)'
715             # type => 'RegExpr'
716 662 100       2517 if ($self->testRegExpr($text, '[=?:]', 0, 0, 0, undef, 0, '(Internal regex catch)', 'Normal Text')) {
717 68         268 return 1
718             }
719             # String => '\('
720             # attribute => 'Normal Text'
721             # context => '(Internal regex catch)'
722             # type => 'RegExpr'
723 594 100       2304 if ($self->testRegExpr($text, '\\(', 0, 0, 0, undef, 0, '(Internal regex catch)', 'Normal Text')) {
724 46         160 return 1
725             }
726             # attribute => 'Symbol'
727             # beginRegion => 'Brace1'
728             # char => '{'
729             # context => '#stay'
730             # type => 'DetectChar'
731 548 100       2071 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
732 16         51 return 1
733             }
734             # attribute => 'Symbol'
735             # char => '}'
736             # context => '#stay'
737             # endRegion => 'Brace1'
738             # type => 'DetectChar'
739 532 100       1885 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
740 16         53 return 1
741             }
742             # String => ':!%&+,-/.*<=>?[]|~^;'
743             # attribute => 'Symbol'
744             # context => '#stay'
745             # type => 'AnyChar'
746 516 100       1832 if ($self->testAnyChar($text, ':!%&+,-/.*<=>?[]|~^;', 0, 0, undef, 0, '#stay', 'Symbol')) {
747 110         441 return 1
748             }
749 406         1045 return 0;
750             };
751              
752             sub parseRegularExpression {
753 264     264 0 393 my ($self, $text) = @_;
754             # String => '/[ig]{0,2}'
755             # attribute => 'Regular Expression'
756             # context => '#pop#pop#pop'
757             # type => 'RegExpr'
758 264 100       894 if ($self->testRegExpr($text, '/[ig]{0,2}', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Regular Expression')) {
759 34         1079 return 1
760             }
761             # String => '\{[\d, ]+\}'
762             # attribute => 'Pattern Internal Operator'
763             # context => '#stay'
764             # type => 'RegExpr'
765 230 100       817 if ($self->testRegExpr($text, '\\{[\\d, ]+\\}', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
766 4         13 return 1
767             }
768             # String => '\\[bB]'
769             # attribute => 'Pattern Internal Operator'
770             # context => '#stay'
771             # type => 'RegExpr'
772 226 100       768 if ($self->testRegExpr($text, '\\\\[bB]', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
773 4         17 return 1
774             }
775             # String => '\\[nrtvfDdSsWw]'
776             # attribute => 'Pattern Character Class'
777             # context => '#stay'
778             # type => 'RegExpr'
779 222 100       729 if ($self->testRegExpr($text, '\\\\[nrtvfDdSsWw]', 0, 0, 0, undef, 0, '#stay', 'Pattern Character Class')) {
780 20         53 return 1
781             }
782             # attribute => 'Pattern Character Class'
783             # char => '['
784             # context => '(charclass caret first check)'
785             # type => 'DetectChar'
786 202 100       785 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, '(charclass caret first check)', 'Pattern Character Class')) {
787 4         14 return 1
788             }
789             # String => '\\.'
790             # attribute => 'Pattern Internal Operator'
791             # context => '#stay'
792             # type => 'RegExpr'
793 198 100       627 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
794 10         31 return 1
795             }
796             # String => '\$(?=/)'
797             # attribute => 'Pattern Internal Operator'
798             # context => '#stay'
799             # type => 'RegExpr'
800 188 100       748 if ($self->testRegExpr($text, '\\$(?=/)', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
801 6         20 return 1
802             }
803             # String => '?+*()|'
804             # attribute => 'Pattern Internal Operator'
805             # context => '#stay'
806             # type => 'AnyChar'
807 182 100       902 if ($self->testAnyChar($text, '?+*()|', 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
808 36         94 return 1
809             }
810 146         524 return 0;
811             };
812              
813             sub parseRegularExpressionCharacterClass {
814 24     24 0 33 my ($self, $text) = @_;
815             # String => '\\[\[\]]'
816             # attribute => 'Pattern Character Class'
817             # context => '#stay'
818             # type => 'RegExpr'
819 24 50       85 if ($self->testRegExpr($text, '\\\\[\\[\\]]', 0, 0, 0, undef, 0, '#stay', 'Pattern Character Class')) {
820 0         0 return 1
821             }
822             # attribute => 'Pattern Character Class'
823             # char => ']'
824             # context => '#pop#pop'
825             # type => 'DetectChar'
826 24 100       83 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop#pop', 'Pattern Character Class')) {
827 4         14 return 1
828             }
829 20         52 return 0;
830             };
831              
832             sub parseString {
833 76     76 0 114 my ($self, $text) = @_;
834             # type => 'DetectIdentifier'
835 76 100       241 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
836 16         40 return 1
837             }
838             # attribute => 'String Char'
839             # context => '#stay'
840             # type => 'HlCStringChar'
841 60 100       250 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
842 4         11 return 1
843             }
844             # attribute => 'String'
845             # char => '"'
846             # context => '#pop'
847             # type => 'DetectChar'
848 56 100       202 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
849 16         46 return 1
850             }
851 40         98 return 0;
852             };
853              
854             sub parseString1 {
855 4     4 0 9 my ($self, $text) = @_;
856             # type => 'DetectIdentifier'
857 4 100       16 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
858 2         8 return 1
859             }
860             # attribute => 'String'
861             # char => '"'
862             # context => 'String'
863             # type => 'DetectChar'
864 2 50       11 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
865 0         0 return 1
866             }
867             # attribute => 'String Char'
868             # char => '''
869             # context => '#pop'
870             # type => 'DetectChar'
871 2 50       11 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String Char')) {
872 2         7 return 1
873             }
874 0           return 0;
875             };
876              
877             sub parseregion_marker {
878 0     0 0   my ($self, $text) = @_;
879             # type => 'DetectIdentifier'
880 0 0         if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
881 0           return 1
882             }
883             # type => 'DetectSpaces'
884 0 0         if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
885 0           return 1
886             }
887 0           return 0;
888             };
889              
890              
891             1;
892              
893             __END__