File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/Perl.pm
Criterion Covered Total %
statement 386 711 54.2
branch 290 556 52.1
condition 1 3 33.3
subroutine 40 70 57.1
pod 0 67 0.0
total 717 1407 50.9


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 'perl.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.20
9             #kate version 2.4
10             #kate author Anders Lund (anders@alweb.dk)
11             #generated: Sun Feb 3 22:02:05 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::Perl;
14              
15             our $VERSION = '0.16';
16              
17 6     6   214950 use strict;
  6         15  
  6         239  
18 6     6   27 use warnings;
  6         14  
  6         399  
19 6     6   34 use base('Syntax::Highlight::Engine::Kate::Template');
  6         13  
  6         39719  
20              
21             sub new {
22 15     15 0 492838 my $proto = shift;
23 15   33     172 my $class = ref($proto) || $proto;
24 15         142 my $self = $class->SUPER::new(@_);
25 15         446 $self->attributes({
26             'Comment' => 'Comment',
27             'Data' => 'Normal',
28             'Data Type' => 'DataType',
29             'Decimal' => 'DecVal',
30             'Float' => 'Float',
31             'Function' => 'Function',
32             'Hex' => 'BaseN',
33             'Keyword' => 'Keyword',
34             'Normal Text' => 'Normal',
35             'Nothing' => 'Comment',
36             'Octal' => 'BaseN',
37             'Operator' => 'Operator',
38             'Pattern' => 'Others',
39             'Pattern Character Class' => 'BaseN',
40             'Pattern Internal Operator' => 'Char',
41             'Pod' => 'Comment',
42             'Pragma' => 'Keyword',
43             'Special Variable' => 'Variable',
44             'String' => 'String',
45             'String (interpolated)' => 'String',
46             'String Special Character' => 'Char',
47             });
48 15         227 $self->listAdd('functions',
49             'abs',
50             'accept',
51             'alarm',
52             'atan2',
53             'bind',
54             'binmode',
55             'bless',
56             'caller',
57             'chdir',
58             'chmod',
59             'chomp',
60             'chop',
61             'chown',
62             'chr',
63             'chroot',
64             'close',
65             'closedir',
66             'connect',
67             'cos',
68             'crypt',
69             'dbmclose',
70             'dbmopen',
71             'defined',
72             'delete',
73             'die',
74             'dump',
75             'endgrent',
76             'endhostent',
77             'endnetent',
78             'endprotoent',
79             'endpwent',
80             'endservent',
81             'eof',
82             'eval',
83             'exec',
84             'exists',
85             'exit',
86             'exp',
87             'fcntl',
88             'fileno',
89             'flock',
90             'fork',
91             'format',
92             'formline',
93             'getc',
94             'getgrent',
95             'getgrgid',
96             'getgrnam',
97             'gethostbyaddr',
98             'gethostbyname',
99             'gethostent',
100             'getlogin',
101             'getnetbyaddr',
102             'getnetbyname',
103             'getnetent',
104             'getpeername',
105             'getpgrp',
106             'getppid',
107             'getpriority',
108             'getprotobyname',
109             'getprotobynumber',
110             'getprotoent',
111             'getpwent',
112             'getpwnam',
113             'getpwuid',
114             'getservbyname',
115             'getservbyport',
116             'getservent',
117             'getsockname',
118             'getsockopt',
119             'glob',
120             'gmtime',
121             'goto',
122             'grep',
123             'hex',
124             'import',
125             'index',
126             'int',
127             'ioctl',
128             'join',
129             'keys',
130             'kill',
131             'last',
132             'lc',
133             'lcfirst',
134             'length',
135             'link',
136             'listen',
137             'localtime',
138             'lock',
139             'log',
140             'lstat',
141             'map',
142             'mkdir',
143             'msgctl',
144             'msgget',
145             'msgrcv',
146             'msgsnd',
147             'oct',
148             'open',
149             'opendir',
150             'ord',
151             'pack',
152             'package',
153             'pipe',
154             'pop',
155             'pos',
156             'print',
157             'printf',
158             'prototype',
159             'push',
160             'quotemeta',
161             'rand',
162             'read',
163             'readdir',
164             'readline',
165             'readlink',
166             'recv',
167             'redo',
168             'ref',
169             'rename',
170             'reset',
171             'return',
172             'reverse',
173             'rewinddir',
174             'rindex',
175             'rmdir',
176             'scalar',
177             'seek',
178             'seekdir',
179             'select',
180             'semctl',
181             'semget',
182             'semop',
183             'send',
184             'setgrent',
185             'sethostent',
186             'setnetent',
187             'setpgrp',
188             'setpriority',
189             'setprotoent',
190             'setpwent',
191             'setservent',
192             'setsockopt',
193             'shift',
194             'shmctl',
195             'shmget',
196             'shmread',
197             'shmwrite',
198             'shutdown',
199             'sin',
200             'sleep',
201             'socket',
202             'socketpair',
203             'sort',
204             'splice',
205             'split',
206             'sprintf',
207             'sqrt',
208             'srand',
209             'stat',
210             'study',
211             'sub',
212             'substr',
213             'symlink',
214             'syscall',
215             'sysread',
216             'sysseek',
217             'system',
218             'syswrite',
219             'tell',
220             'telldir',
221             'tie',
222             'time',
223             'times',
224             'truncate',
225             'uc',
226             'ucfirst',
227             'umask',
228             'undef',
229             'unlink',
230             'unpack',
231             'unshift',
232             'untie',
233             'utime',
234             'values',
235             'vec',
236             'wait',
237             'waitpid',
238             'wantarray',
239             'warn',
240             'write',
241             );
242 15         78 $self->listAdd('keywords',
243             'BEGIN',
244             'END',
245             '__DATA__',
246             '__END__',
247             '__FILE__',
248             '__LINE__',
249             '__PACKAGE__',
250             'break',
251             'continue',
252             'do',
253             'each',
254             'else',
255             'elsif',
256             'for',
257             'foreach',
258             'if',
259             'last',
260             'local',
261             'my',
262             'next',
263             'no',
264             'our',
265             'package',
266             'require',
267             'require',
268             'return',
269             'sub',
270             'unless',
271             'until',
272             'use',
273             'while',
274             );
275 15         76 $self->listAdd('operators',
276             '!=',
277             '%',
278             '&',
279             '&&',
280             '&&=',
281             '&=',
282             '*',
283             '**=',
284             '*=',
285             '+',
286             '+=',
287             ',',
288             '-',
289             '-=',
290             '->',
291             '.',
292             '/=',
293             '::',
294             ';',
295             '<',
296             '<<',
297             '=',
298             '=>',
299             '>',
300             '>>',
301             '?=',
302             '\\\\',
303             '^',
304             'and',
305             'eq',
306             'ne',
307             'not',
308             'or',
309             '|',
310             '|=',
311             '||',
312             '||=',
313             '~=',
314             );
315 15         83 $self->listAdd('pragmas',
316             'bytes',
317             'constant',
318             'diagnostics',
319             'english',
320             'filetest',
321             'integer',
322             'less',
323             'locale',
324             'open',
325             'sigtrap',
326             'strict',
327             'subs',
328             'utf8',
329             'vars',
330             'warnings',
331             );
332 15         2879 $self->contextdata({
333             'Backticked' => {
334             callback => \&parseBackticked,
335             attribute => 'String (interpolated)',
336             },
337             'comment' => {
338             callback => \&parsecomment,
339             attribute => 'Comment',
340             lineending => '#pop',
341             },
342             'data_handle' => {
343             callback => \&parsedata_handle,
344             attribute => 'Data',
345             },
346             'end_handle' => {
347             callback => \&parseend_handle,
348             attribute => 'Nothing',
349             },
350             'find_here_document' => {
351             callback => \&parsefind_here_document,
352             attribute => 'Normal Text',
353             lineending => '#pop',
354             },
355             'find_pattern' => {
356             callback => \&parsefind_pattern,
357             attribute => 'Pattern',
358             },
359             'find_qqx' => {
360             callback => \&parsefind_qqx,
361             attribute => 'Normal Text',
362             },
363             'find_quoted' => {
364             callback => \&parsefind_quoted,
365             attribute => 'Normal Text',
366             },
367             'find_qw' => {
368             callback => \&parsefind_qw,
369             attribute => 'Normal Text',
370             },
371             'find_subst' => {
372             callback => \&parsefind_subst,
373             attribute => 'Normal Text',
374             },
375             'find_variable' => {
376             callback => \&parsefind_variable,
377             attribute => 'Data Type',
378             lineending => '#pop',
379             fallthrough => '#pop',
380             },
381             'find_variable_unsafe' => {
382             callback => \&parsefind_variable_unsafe,
383             attribute => 'Data Type',
384             lineending => '#pop',
385             fallthrough => '#pop',
386             },
387             'here_document' => {
388             callback => \&parsehere_document,
389             attribute => 'String (interpolated)',
390             dynamic => 1,
391             },
392             'here_document_dumb' => {
393             callback => \&parsehere_document_dumb,
394             attribute => 'Normal Text',
395             dynamic => 1,
396             },
397             'ip_string' => {
398             callback => \&parseip_string,
399             attribute => 'String (interpolated)',
400             },
401             'ip_string_2' => {
402             callback => \&parseip_string_2,
403             attribute => 'String (interpolated)',
404             },
405             'ip_string_3' => {
406             callback => \&parseip_string_3,
407             attribute => 'String (interpolated)',
408             },
409             'ip_string_4' => {
410             callback => \&parseip_string_4,
411             attribute => 'String (interpolated)',
412             },
413             'ip_string_5' => {
414             callback => \&parseip_string_5,
415             attribute => 'String (interpolated)',
416             },
417             'ip_string_6' => {
418             callback => \&parseip_string_6,
419             attribute => 'String (interpolated)',
420             dynamic => 1,
421             },
422             'ipstring_internal' => {
423             callback => \&parseipstring_internal,
424             attribute => 'String (interpolated)',
425             },
426             'normal' => {
427             callback => \&parsenormal,
428             attribute => 'Normal Text',
429             },
430             'package_qualified_blank' => {
431             callback => \&parsepackage_qualified_blank,
432             attribute => 'Normal Text',
433             },
434             'pat_char_class' => {
435             callback => \&parsepat_char_class,
436             attribute => 'Pattern Character Class',
437             },
438             'pat_ext' => {
439             callback => \&parsepat_ext,
440             attribute => 'Pattern Internal Operator',
441             },
442             'pattern' => {
443             callback => \&parsepattern,
444             attribute => 'Pattern',
445             dynamic => 1,
446             },
447             'pattern_brace' => {
448             callback => \&parsepattern_brace,
449             attribute => 'Pattern',
450             },
451             'pattern_bracket' => {
452             callback => \&parsepattern_bracket,
453             attribute => 'Pattern',
454             },
455             'pattern_paren' => {
456             callback => \&parsepattern_paren,
457             attribute => 'Pattern',
458             },
459             'pattern_slash' => {
460             callback => \&parsepattern_slash,
461             attribute => 'Pattern',
462             },
463             'pattern_sq' => {
464             callback => \&parsepattern_sq,
465             attribute => 'Pattern',
466             },
467             'pod' => {
468             callback => \&parsepod,
469             attribute => 'Pod',
470             },
471             'quote_word' => {
472             callback => \&parsequote_word,
473             attribute => 'Normal Text',
474             dynamic => 1,
475             },
476             'quote_word_brace' => {
477             callback => \&parsequote_word_brace,
478             attribute => 'Normal Text',
479             },
480             'quote_word_bracket' => {
481             callback => \&parsequote_word_bracket,
482             attribute => 'Normal Text',
483             },
484             'quote_word_paren' => {
485             callback => \&parsequote_word_paren,
486             attribute => 'Normal Text',
487             },
488             'regex_pattern_internal' => {
489             callback => \&parseregex_pattern_internal,
490             attribute => 'Pattern',
491             },
492             'regex_pattern_internal_ip' => {
493             callback => \&parseregex_pattern_internal_ip,
494             attribute => 'Pattern',
495             },
496             'regex_pattern_internal_rules_1' => {
497             callback => \&parseregex_pattern_internal_rules_1,
498             },
499             'regex_pattern_internal_rules_2' => {
500             callback => \&parseregex_pattern_internal_rules_2,
501             },
502             'slash_safe_escape' => {
503             callback => \&parseslash_safe_escape,
504             attribute => 'Normal Text',
505             lineending => '#pop',
506             fallthrough => '#pop',
507             },
508             'string' => {
509             callback => \&parsestring,
510             attribute => 'String',
511             },
512             'string_2' => {
513             callback => \&parsestring_2,
514             attribute => 'String',
515             },
516             'string_3' => {
517             callback => \&parsestring_3,
518             attribute => 'String',
519             },
520             'string_4' => {
521             callback => \&parsestring_4,
522             attribute => 'String',
523             },
524             'string_5' => {
525             callback => \&parsestring_5,
526             attribute => 'String',
527             },
528             'string_6' => {
529             callback => \&parsestring_6,
530             attribute => 'String',
531             dynamic => 1,
532             },
533             'sub_arg_definition' => {
534             callback => \&parsesub_arg_definition,
535             attribute => 'Normal Text',
536             fallthrough => '#pop#pop',
537             },
538             'sub_name_def' => {
539             callback => \&parsesub_name_def,
540             attribute => 'Normal Text',
541             lineending => '#pop',
542             fallthrough => '#pop',
543             },
544             'subst_bracket_pattern' => {
545             callback => \&parsesubst_bracket_pattern,
546             attribute => 'Pattern',
547             },
548             'subst_bracket_replace' => {
549             callback => \&parsesubst_bracket_replace,
550             attribute => 'String (interpolated)',
551             },
552             'subst_curlybrace_middle' => {
553             callback => \&parsesubst_curlybrace_middle,
554             attribute => 'Normal Text',
555             },
556             'subst_curlybrace_pattern' => {
557             callback => \&parsesubst_curlybrace_pattern,
558             attribute => 'Pattern',
559             },
560             'subst_curlybrace_replace' => {
561             callback => \&parsesubst_curlybrace_replace,
562             attribute => 'String (interpolated)',
563             },
564             'subst_curlybrace_replace_recursive' => {
565             callback => \&parsesubst_curlybrace_replace_recursive,
566             attribute => 'String (interpolated)',
567             },
568             'subst_paren_pattern' => {
569             callback => \&parsesubst_paren_pattern,
570             attribute => 'Pattern',
571             },
572             'subst_paren_replace' => {
573             callback => \&parsesubst_paren_replace,
574             attribute => 'String (interpolated)',
575             },
576             'subst_slash_pattern' => {
577             callback => \&parsesubst_slash_pattern,
578             attribute => 'Pattern',
579             dynamic => 1,
580             },
581             'subst_slash_replace' => {
582             callback => \&parsesubst_slash_replace,
583             attribute => 'String (interpolated)',
584             dynamic => 1,
585             },
586             'subst_sq_pattern' => {
587             callback => \&parsesubst_sq_pattern,
588             attribute => 'Pattern',
589             },
590             'subst_sq_replace' => {
591             callback => \&parsesubst_sq_replace,
592             attribute => 'String',
593             },
594             'tr' => {
595             callback => \&parsetr,
596             attribute => 'Pattern',
597             lineending => '#pop',
598             fallthrough => '#pop',
599             },
600             'var_detect' => {
601             callback => \&parsevar_detect,
602             attribute => 'Data Type',
603             lineending => '#pop#pop',
604             fallthrough => '#pop#pop',
605             },
606             'var_detect_rules' => {
607             callback => \&parsevar_detect_rules,
608             attribute => 'Data Type',
609             lineending => '#pop#pop',
610             },
611             'var_detect_unsafe' => {
612             callback => \&parsevar_detect_unsafe,
613             attribute => 'Data Type',
614             lineending => '#pop#pop',
615             fallthrough => '#pop#pop',
616             },
617             });
618 15         174 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
619 15         74 $self->basecontext('normal');
620 15         98 $self->keywordscase(0);
621 15         52 $self->initialize;
622 15         42 bless ($self, $class);
623 15         102 return $self;
624             }
625              
626             sub language {
627 0     0 0 0 return 'Perl';
628             }
629              
630             sub parseBackticked {
631 0     0 0 0 my ($self, $text) = @_;
632             # context => 'ipstring_internal'
633             # type => 'IncludeRules'
634 0 0       0 if ($self->includeRules('ipstring_internal', $text)) {
635 0         0 return 1
636             }
637             # attribute => 'Operator'
638             # char => '`'
639             # context => '#pop'
640             # type => 'DetectChar'
641 0 0       0 if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
642 0         0 return 1
643             }
644 0         0 return 0;
645             };
646              
647             sub parsecomment {
648 1752     1752 0 3865 my ($self, $text) = @_;
649             # type => 'DetectSpaces'
650 1752 100       5069 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
651 617         1624 return 1
652             }
653             # context => '##Alerts'
654             # type => 'IncludeRules'
655 1135 100       3312 if ($self->includePlugin('Alerts', $text)) {
656 2         6 return 1
657             }
658             # type => 'DetectIdentifier'
659 1133 100       4041 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
660 515         1425 return 1
661             }
662 618         1671 return 0;
663             };
664              
665             sub parsedata_handle {
666 0     0 0 0 my ($self, $text) = @_;
667             # String => '\=(?:head[1-6]|over|back|item|for|begin|end|pod)\s+.*'
668             # attribute => 'Pod'
669             # beginRegion => 'POD'
670             # column => '0'
671             # context => 'pod'
672             # type => 'RegExpr'
673 0 0       0 if ($self->testRegExpr($text, '\\=(?:head[1-6]|over|back|item|for|begin|end|pod)\\s+.*', 0, 0, 0, 0, 0, 'pod', 'Pod')) {
674 0         0 return 1
675             }
676             # String => '__END__'
677             # attribute => 'Keyword'
678             # context => 'normal'
679             # firstNonSpace => 'true'
680             # type => 'StringDetect'
681 0 0       0 if ($self->testStringDetect($text, '__END__', 0, 0, 0, undef, 1, 'normal', 'Keyword')) {
682 0         0 return 1
683             }
684 0         0 return 0;
685             };
686              
687             sub parseend_handle {
688 0     0 0 0 my ($self, $text) = @_;
689             # String => '^\=(?:head[1-6]|over|back|item|for|begin|end|pod)\s*.*'
690             # attribute => 'Pod'
691             # context => 'pod'
692             # type => 'RegExpr'
693 0 0       0 if ($self->testRegExpr($text, '^\\=(?:head[1-6]|over|back|item|for|begin|end|pod)\\s*.*', 0, 0, 0, undef, 0, 'pod', 'Pod')) {
694 0         0 return 1
695             }
696             # String => '__DATA__'
697             # attribute => 'Keyword'
698             # context => 'data_handle'
699             # firstNonSpace => 'true'
700             # type => 'StringDetect'
701 0 0       0 if ($self->testStringDetect($text, '__DATA__', 0, 0, 0, undef, 1, 'data_handle', 'Keyword')) {
702 0         0 return 1
703             }
704 0         0 return 0;
705             };
706              
707             sub parsefind_here_document {
708 3     3 0 10 my ($self, $text) = @_;
709             # String => '(\w+)\s*;?'
710             # attribute => 'Keyword'
711             # context => 'here_document'
712             # type => 'RegExpr'
713 3 100       13 if ($self->testRegExpr($text, '(\\w+)\\s*;?', 0, 0, 0, undef, 0, 'here_document', 'Keyword')) {
714 2         7 return 1
715             }
716             # String => '\s*"([^"]+)"\s*;?'
717             # attribute => 'Keyword'
718             # context => 'here_document'
719             # type => 'RegExpr'
720 1 50       3 if ($self->testRegExpr($text, '\\s*"([^"]+)"\\s*;?', 0, 0, 0, undef, 0, 'here_document', 'Keyword')) {
721 0         0 return 1
722             }
723             # String => '\s*`([^`]+)`\s*;?'
724             # attribute => 'Keyword'
725             # context => 'here_document'
726             # type => 'RegExpr'
727 1 50       3 if ($self->testRegExpr($text, '\\s*`([^`]+)`\\s*;?', 0, 0, 0, undef, 0, 'here_document', 'Keyword')) {
728 0         0 return 1
729             }
730             # String => '\s*'([^']+)'\s*;?'
731             # attribute => 'Keyword'
732             # context => 'here_document_dumb'
733             # type => 'RegExpr'
734 1 50       5 if ($self->testRegExpr($text, '\\s*\'([^\']+)\'\\s*;?', 0, 0, 0, undef, 0, 'here_document_dumb', 'Keyword')) {
735 1         2 return 1
736             }
737 0         0 return 0;
738             };
739              
740             sub parsefind_pattern {
741 5     5 0 17 my ($self, $text) = @_;
742             # String => '\s+#.*'
743             # attribute => 'Comment'
744             # context => '#stay'
745             # type => 'RegExpr'
746 5 50       28 if ($self->testRegExpr($text, '\\s+#.*', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
747 0         0 return 1
748             }
749             # attribute => 'Operator'
750             # beginRegion => 'Pattern'
751             # char => '{'
752             # context => 'pattern_brace'
753             # type => 'DetectChar'
754 5 50       43 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'pattern_brace', 'Operator')) {
755 0         0 return 1
756             }
757             # attribute => 'Operator'
758             # beginRegion => 'Pattern'
759             # char => '('
760             # context => 'pattern_paren'
761             # type => 'DetectChar'
762 5 50       37 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'pattern_paren', 'Operator')) {
763 0         0 return 1
764             }
765             # attribute => 'Operator'
766             # beginRegion => 'Pattern'
767             # char => '['
768             # context => 'pattern_bracket'
769             # type => 'DetectChar'
770 5 50       29 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'pattern_bracket', 'Operator')) {
771 0         0 return 1
772             }
773             # attribute => 'Operator'
774             # beginRegion => 'Pattern'
775             # char => '''
776             # context => 'pattern_sq'
777             # type => 'DetectChar'
778 5 50       28 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'pattern_sq', 'Operator')) {
779 0         0 return 1
780             }
781             # String => '([^\w\s])'
782             # attribute => 'Operator'
783             # beginRegion => 'Pattern'
784             # context => 'pattern'
785             # type => 'RegExpr'
786 5 50       24 if ($self->testRegExpr($text, '([^\\w\\s])', 0, 0, 0, undef, 0, 'pattern', 'Operator')) {
787 5         20 return 1
788             }
789 0         0 return 0;
790             };
791              
792             sub parsefind_qqx {
793 20     20 0 56 my ($self, $text) = @_;
794             # attribute => 'Operator'
795             # beginRegion => 'String'
796             # char => '('
797             # context => 'ip_string_2'
798             # type => 'DetectChar'
799 20 50       102 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'ip_string_2', 'Operator')) {
800 0         0 return 1
801             }
802             # attribute => 'Operator'
803             # beginRegion => 'String'
804             # char => '{'
805             # context => 'ip_string_3'
806             # type => 'DetectChar'
807 20 100       74 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'ip_string_3', 'Operator')) {
808 16         44 return 1
809             }
810             # attribute => 'Operator'
811             # beginRegion => 'String'
812             # char => '['
813             # context => 'ip_string_4'
814             # type => 'DetectChar'
815 4 50       20 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'ip_string_4', 'Operator')) {
816 0         0 return 1
817             }
818             # attribute => 'Operator'
819             # beginRegion => 'String'
820             # char => '<'
821             # context => 'ip_string_5'
822             # type => 'DetectChar'
823 4 50       20 if ($self->testDetectChar($text, '<', 0, 0, 0, undef, 0, 'ip_string_5', 'Operator')) {
824 0         0 return 1
825             }
826             # String => '([^a-zA-Z0-9_\s[\]{}()])'
827             # attribute => 'Operator'
828             # beginRegion => 'String'
829             # context => 'ip_string_6'
830             # type => 'RegExpr'
831 4 50       19 if ($self->testRegExpr($text, '([^a-zA-Z0-9_\\s[\\]{}()])', 0, 0, 0, undef, 0, 'ip_string_6', 'Operator')) {
832 4         16 return 1
833             }
834             # String => '\s+#.*'
835             # attribute => 'Comment'
836             # context => '#stay'
837             # type => 'RegExpr'
838 0 0       0 if ($self->testRegExpr($text, '\\s+#.*', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
839 0         0 return 1
840             }
841 0         0 return 0;
842             };
843              
844             sub parsefind_quoted {
845 25     25 0 77 my ($self, $text) = @_;
846             # String => 'x\s*(')'
847             # attribute => 'Operator'
848             # beginRegion => 'String'
849             # context => 'string_6'
850             # type => 'RegExpr'
851 25 50       106 if ($self->testRegExpr($text, 'x\\s*(\')', 0, 0, 0, undef, 0, 'string_6', 'Operator')) {
852 0         0 return 1
853             }
854             # String => 'qx'
855             # attribute => 'Operator'
856             # context => 'find_qqx'
857             # type => 'AnyChar'
858 25 100       129 if ($self->testAnyChar($text, 'qx', 0, 0, undef, 0, 'find_qqx', 'Operator')) {
859 20         65 return 1
860             }
861             # attribute => 'Operator'
862             # char => 'w'
863             # context => 'find_qw'
864             # type => 'DetectChar'
865 5 100       27 if ($self->testDetectChar($text, 'w', 0, 0, 0, undef, 0, 'find_qw', 'Operator')) {
866 3         14 return 1
867             }
868             # attribute => 'Operator'
869             # beginRegion => 'String'
870             # char => '('
871             # context => 'string_2'
872             # type => 'DetectChar'
873 2 50       10 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'string_2', 'Operator')) {
874 0         0 return 1
875             }
876             # attribute => 'Operator'
877             # beginRegion => 'String'
878             # char => '{'
879             # context => 'string_3'
880             # type => 'DetectChar'
881 2 50       10 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'string_3', 'Operator')) {
882 0         0 return 1
883             }
884             # attribute => 'Operator'
885             # beginRegion => 'String'
886             # char => '['
887             # context => 'string_4'
888             # type => 'DetectChar'
889 2 50       10 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'string_4', 'Operator')) {
890 0         0 return 1
891             }
892             # attribute => 'Operator'
893             # beginRegion => 'String'
894             # char => '<'
895             # context => 'string_5'
896             # type => 'DetectChar'
897 2 50       10 if ($self->testDetectChar($text, '<', 0, 0, 0, undef, 0, 'string_5', 'Operator')) {
898 0         0 return 1
899             }
900             # String => '([^a-zA-Z0-9_\s[\]{}()])'
901             # attribute => 'Operator'
902             # beginRegion => 'String'
903             # context => 'string_6'
904             # type => 'RegExpr'
905 2 50       10 if ($self->testRegExpr($text, '([^a-zA-Z0-9_\\s[\\]{}()])', 0, 0, 0, undef, 0, 'string_6', 'Operator')) {
906 2         10 return 1
907             }
908             # String => '\s+#.*'
909             # attribute => 'Comment'
910             # context => '#stay'
911             # type => 'RegExpr'
912 0 0       0 if ($self->testRegExpr($text, '\\s+#.*', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
913 0         0 return 1
914             }
915 0         0 return 0;
916             };
917              
918             sub parsefind_qw {
919 3     3 0 12 my ($self, $text) = @_;
920             # attribute => 'Operator'
921             # beginRegion => 'Wordlist'
922             # char => '('
923             # context => 'quote_word_paren'
924             # type => 'DetectChar'
925 3 50       17 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'quote_word_paren', 'Operator')) {
926 3         12 return 1
927             }
928             # attribute => 'Operator'
929             # beginRegion => 'Wordlist'
930             # char => '{'
931             # context => 'quote_word_brace'
932             # type => 'DetectChar'
933 0 0       0 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'quote_word_brace', 'Operator')) {
934 0         0 return 1
935             }
936             # attribute => 'Operator'
937             # beginRegion => 'Wordlist'
938             # char => '['
939             # context => 'quote_word_bracket'
940             # type => 'DetectChar'
941 0 0       0 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'quote_word_bracket', 'Operator')) {
942 0         0 return 1
943             }
944             # String => '([^a-zA-Z0-9_\s[\]{}()])'
945             # attribute => 'Operator'
946             # beginRegion => 'Wordlist'
947             # context => 'quote_word'
948             # type => 'RegExpr'
949 0 0       0 if ($self->testRegExpr($text, '([^a-zA-Z0-9_\\s[\\]{}()])', 0, 0, 0, undef, 0, 'quote_word', 'Operator')) {
950 0         0 return 1
951             }
952             # String => '\s+#.*'
953             # attribute => 'Comment'
954             # context => '#stay'
955             # type => 'RegExpr'
956 0 0       0 if ($self->testRegExpr($text, '\\s+#.*', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
957 0         0 return 1
958             }
959 0         0 return 0;
960             };
961              
962             sub parsefind_subst {
963 26     26 0 85 my ($self, $text) = @_;
964             # String => '\s+#.*'
965             # attribute => 'Comment'
966             # context => '#stay'
967             # type => 'RegExpr'
968 26 50       116 if ($self->testRegExpr($text, '\\s+#.*', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
969 0         0 return 1
970             }
971             # attribute => 'Operator'
972             # beginRegion => 'Pattern'
973             # char => '{'
974             # context => 'subst_curlybrace_pattern'
975             # type => 'DetectChar'
976 26 50       111 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'subst_curlybrace_pattern', 'Operator')) {
977 0         0 return 1
978             }
979             # attribute => 'Operator'
980             # beginRegion => 'Pattern'
981             # char => '('
982             # context => 'subst_paren_pattern'
983             # type => 'DetectChar'
984 26 50       110 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'subst_paren_pattern', 'Operator')) {
985 0         0 return 1
986             }
987             # attribute => 'Operator'
988             # beginRegion => 'Pattern'
989             # char => '['
990             # context => 'subst_bracket_pattern'
991             # type => 'DetectChar'
992 26 50       97 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'subst_bracket_pattern', 'Operator')) {
993 0         0 return 1
994             }
995             # attribute => 'Operator'
996             # beginRegion => 'Pattern'
997             # char => '''
998             # context => 'subst_sq_pattern'
999             # type => 'DetectChar'
1000 26 50       111 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'subst_sq_pattern', 'Operator')) {
1001 0         0 return 1
1002             }
1003             # String => '([^\w\s[\]{}()])'
1004             # attribute => 'Operator'
1005             # beginRegion => 'Pattern'
1006             # context => 'subst_slash_pattern'
1007             # type => 'RegExpr'
1008 26 50       118 if ($self->testRegExpr($text, '([^\\w\\s[\\]{}()])', 0, 0, 0, undef, 0, 'subst_slash_pattern', 'Operator')) {
1009 26         105 return 1
1010             }
1011 0         0 return 0;
1012             };
1013              
1014             sub parsefind_variable {
1015 1114     1114 0 2926 my ($self, $text) = @_;
1016             # String => '\$[0-9]+'
1017             # attribute => 'Special Variable'
1018             # context => 'var_detect'
1019             # type => 'RegExpr'
1020 1114 100       15052 if ($self->testRegExpr($text, '\\$[0-9]+', 0, 0, 0, undef, 0, 'var_detect', 'Special Variable')) {
1021 21         71 return 1
1022             }
1023             # String => '[@\$](?:[\+\-_]\B|ARGV\b|INC\b)'
1024             # attribute => 'Special Variable'
1025             # context => 'var_detect'
1026             # type => 'RegExpr'
1027 1093 100       4285 if ($self->testRegExpr($text, '[@\\$](?:[\\+\\-_]\\B|ARGV\\b|INC\\b)', 0, 0, 0, undef, 0, 'var_detect', 'Special Variable')) {
1028 2         9 return 1
1029             }
1030             # String => '[%\$](?:INC\b|ENV\b|SIG\b)'
1031             # attribute => 'Special Variable'
1032             # context => 'var_detect'
1033             # type => 'RegExpr'
1034 1091 50       4367 if ($self->testRegExpr($text, '[%\\$](?:INC\\b|ENV\\b|SIG\\b)', 0, 0, 0, undef, 0, 'var_detect', 'Special Variable')) {
1035 0         0 return 1
1036             }
1037             # String => '\$\$[\$\w_]'
1038             # attribute => 'Data Type'
1039             # context => 'var_detect'
1040             # type => 'RegExpr'
1041 1091 100       5645 if ($self->testRegExpr($text, '\\$\\$[\\$\\w_]', 0, 0, 0, undef, 0, 'var_detect', 'Data Type')) {
1042 24         85 return 1
1043             }
1044             # String => '\$[#_][\w_]'
1045             # attribute => 'Data Type'
1046             # context => 'var_detect'
1047             # type => 'RegExpr'
1048 1067 50       4586 if ($self->testRegExpr($text, '\\$[#_][\\w_]', 0, 0, 0, undef, 0, 'var_detect', 'Data Type')) {
1049 0         0 return 1
1050             }
1051             # String => '\$+::'
1052             # attribute => 'Data Type'
1053             # context => 'var_detect'
1054             # type => 'RegExpr'
1055 1067 50       4290 if ($self->testRegExpr($text, '\\$+::', 0, 0, 0, undef, 0, 'var_detect', 'Data Type')) {
1056 0         0 return 1
1057             }
1058             # String => '\$[^a-zA-Z0-9\s{][A-Z]?'
1059             # attribute => 'Special Variable'
1060             # context => '#stay'
1061             # type => 'RegExpr'
1062 1067 100       4441 if ($self->testRegExpr($text, '\\$[^a-zA-Z0-9\\s{][A-Z]?', 0, 0, 0, undef, 0, '#stay', 'Special Variable')) {
1063 12         44 return 1
1064             }
1065             # String => '[\$@%]\{[\w_]+\}'
1066             # attribute => 'Data Type'
1067             # context => 'var_detect'
1068             # type => 'RegExpr'
1069 1055 50       4417 if ($self->testRegExpr($text, '[\\$@%]\\{[\\w_]+\\}', 0, 0, 0, undef, 0, 'var_detect', 'Data Type')) {
1070 0         0 return 1
1071             }
1072             # String => '$@%'
1073             # attribute => 'Data Type'
1074             # context => 'var_detect'
1075             # type => 'AnyChar'
1076 1055 100       5096 if ($self->testAnyChar($text, '$@%', 0, 0, undef, 0, 'var_detect', 'Data Type')) {
1077 1039         3710 return 1
1078             }
1079             # String => '\*[a-zA-Z_]+'
1080             # attribute => 'Data Type'
1081             # context => 'var_detect'
1082             # type => 'RegExpr'
1083 16 50       70 if ($self->testRegExpr($text, '\\*[a-zA-Z_]+', 0, 0, 0, undef, 0, 'var_detect', 'Data Type')) {
1084 0         0 return 1
1085             }
1086             # String => '\*[^a-zA-Z0-9\s{][A-Z]?'
1087             # attribute => 'Special Variable'
1088             # context => '#stay'
1089             # type => 'RegExpr'
1090 16 50       68 if ($self->testRegExpr($text, '\\*[^a-zA-Z0-9\\s{][A-Z]?', 0, 0, 0, undef, 0, '#stay', 'Special Variable')) {
1091 0         0 return 1
1092             }
1093             # String => '$@%*'
1094             # attribute => 'Operator'
1095             # context => '#pop'
1096             # type => 'AnyChar'
1097 16 100       74 if ($self->testAnyChar($text, '$@%*', 0, 0, undef, 0, '#pop', 'Operator')) {
1098 2         8 return 1
1099             }
1100 14         39 return 0;
1101             };
1102              
1103             sub parsefind_variable_unsafe {
1104 36     36 0 105 my ($self, $text) = @_;
1105             # String => '\$[0-9]+'
1106             # attribute => 'Special Variable'
1107             # context => 'var_detect_unsafe'
1108             # type => 'RegExpr'
1109 36 100       156 if ($self->testRegExpr($text, '\\$[0-9]+', 0, 0, 0, undef, 0, 'var_detect_unsafe', 'Special Variable')) {
1110 2         23 return 1
1111             }
1112             # String => '[@\$](?:[\+\-_]\B|ARGV\b|INC\b)'
1113             # attribute => 'Special Variable'
1114             # context => 'var_detect_unsafe'
1115             # type => 'RegExpr'
1116 34 50       138 if ($self->testRegExpr($text, '[@\\$](?:[\\+\\-_]\\B|ARGV\\b|INC\\b)', 0, 0, 0, undef, 0, 'var_detect_unsafe', 'Special Variable')) {
1117 0         0 return 1
1118             }
1119             # String => '[%\$](?:INC\b|ENV\b|SIG\b)'
1120             # attribute => 'Special Variable'
1121             # context => 'var_detect_unsafe'
1122             # type => 'RegExpr'
1123 34 50       139 if ($self->testRegExpr($text, '[%\\$](?:INC\\b|ENV\\b|SIG\\b)', 0, 0, 0, undef, 0, 'var_detect_unsafe', 'Special Variable')) {
1124 0         0 return 1
1125             }
1126             # String => '\$\$[\$\w_]'
1127             # attribute => 'Data Type'
1128             # context => 'var_detect_unsafe'
1129             # type => 'RegExpr'
1130 34 50       170 if ($self->testRegExpr($text, '\\$\\$[\\$\\w_]', 0, 0, 0, undef, 0, 'var_detect_unsafe', 'Data Type')) {
1131 0         0 return 1
1132             }
1133             # String => '\$[#_][\w_]'
1134             # attribute => 'Data Type'
1135             # context => 'var_detect_unsafe'
1136             # type => 'RegExpr'
1137 34 50       144 if ($self->testRegExpr($text, '\\$[#_][\\w_]', 0, 0, 0, undef, 0, 'var_detect_unsafe', 'Data Type')) {
1138 0         0 return 1
1139             }
1140             # String => '\$+::'
1141             # attribute => 'Data Type'
1142             # context => 'var_detect_unsafe'
1143             # type => 'RegExpr'
1144 34 50       135 if ($self->testRegExpr($text, '\\$+::', 0, 0, 0, undef, 0, 'var_detect_unsafe', 'Data Type')) {
1145 0         0 return 1
1146             }
1147             # String => '\$[^a-zA-Z0-9\s{][A-Z]?'
1148             # attribute => 'Special Variable'
1149             # context => '#stay'
1150             # type => 'RegExpr'
1151 34 100       144 if ($self->testRegExpr($text, '\\$[^a-zA-Z0-9\\s{][A-Z]?', 0, 0, 0, undef, 0, '#stay', 'Special Variable')) {
1152 1         3 return 1
1153             }
1154             # String => '[\$@%]\{[\w_]+\}'
1155             # attribute => 'Data Type'
1156             # context => 'var_detect_unsafe'
1157             # type => 'RegExpr'
1158 33 100       134 if ($self->testRegExpr($text, '[\\$@%]\\{[\\w_]+\\}', 0, 0, 0, undef, 0, 'var_detect_unsafe', 'Data Type')) {
1159 2         8 return 1
1160             }
1161             # String => '[\$@%]'
1162             # attribute => 'Data Type'
1163             # context => 'var_detect_unsafe'
1164             # type => 'RegExpr'
1165 31 100       160 if ($self->testRegExpr($text, '[\\$@%]', 0, 0, 0, undef, 0, 'var_detect_unsafe', 'Data Type')) {
1166 30         109 return 1
1167             }
1168             # String => '\*\w+'
1169             # attribute => 'Data Type'
1170             # context => 'var_detect_unsafe'
1171             # type => 'RegExpr'
1172 1 50       7 if ($self->testRegExpr($text, '\\*\\w+', 0, 0, 0, undef, 0, 'var_detect_unsafe', 'Data Type')) {
1173 0         0 return 1
1174             }
1175             # String => '$@%*'
1176             # attribute => 'Operator'
1177             # context => '#pop'
1178             # type => 'AnyChar'
1179 1 50       7 if ($self->testAnyChar($text, '$@%*', 0, 0, undef, 0, '#pop', 'Operator')) {
1180 0         0 return 1
1181             }
1182 1         3 return 0;
1183             };
1184              
1185             sub parsehere_document {
1186 34     34 0 79 my ($self, $text) = @_;
1187             # type => 'DetectSpaces'
1188 34 100       111 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
1189 14         47 return 1
1190             }
1191             # String => '%1'
1192             # attribute => 'Keyword'
1193             # column => '0'
1194             # context => '#pop#pop'
1195             # dynamic => 'true'
1196             # endRegion => 'HereDocument'
1197             # type => 'RegExpr'
1198 20 100       81 if ($self->testRegExpr($text, '%1', 0, 1, 0, 0, 0, '#pop#pop', 'Keyword')) {
1199 2         9 return 1
1200             }
1201             # String => '\=\s*<<\s*["']?([A-Z0-9_\-]+)["']?'
1202             # attribute => 'Keyword'
1203             # beginRegion => 'HEREDoc'
1204             # context => 'here_document'
1205             # type => 'RegExpr'
1206 18 50       72 if ($self->testRegExpr($text, '\\=\\s*<<\\s*["\']?([A-Z0-9_\\-]+)["\']?', 0, 0, 0, undef, 0, 'here_document', 'Keyword')) {
1207 0         0 return 1
1208             }
1209             # context => 'ipstring_internal'
1210             # type => 'IncludeRules'
1211 18 100       75 if ($self->includeRules('ipstring_internal', $text)) {
1212 16         48 return 1
1213             }
1214 2         7 return 0;
1215             };
1216              
1217             sub parsehere_document_dumb {
1218 6     6 0 8 my ($self, $text) = @_;
1219             # type => 'DetectSpaces'
1220 6 100       11 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
1221 2         4 return 1
1222             }
1223             # String => '%1'
1224             # attribute => 'Keyword'
1225             # column => '0'
1226             # context => '#pop#pop'
1227             # dynamic => 'true'
1228             # endRegion => 'HereDocument'
1229             # type => 'RegExpr'
1230 4 100       8 if ($self->testRegExpr($text, '%1', 0, 1, 0, 0, 0, '#pop#pop', 'Keyword')) {
1231 1         3 return 1
1232             }
1233             # type => 'DetectIdentifier'
1234 3 50       10 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
1235 3         6 return 1
1236             }
1237 0         0 return 0;
1238             };
1239              
1240             sub parseip_string {
1241 280     280 0 576 my ($self, $text) = @_;
1242             # attribute => 'Operator'
1243             # char => '"'
1244             # context => '#pop'
1245             # endRegion => 'String'
1246             # type => 'DetectChar'
1247 280 100       882 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
1248 38         129 return 1
1249             }
1250             # context => 'ipstring_internal'
1251             # type => 'IncludeRules'
1252 242 100       774 if ($self->includeRules('ipstring_internal', $text)) {
1253 125         355 return 1
1254             }
1255 117         378 return 0;
1256             };
1257              
1258             sub parseip_string_2 {
1259 0     0 0 0 my ($self, $text) = @_;
1260             # attribute => 'String (interpolated)'
1261             # char => '('
1262             # char1 => ')'
1263             # context => '#stay'
1264             # type => 'RangeDetect'
1265 0 0       0 if ($self->testRangeDetect($text, '(', ')', 0, 0, undef, 0, '#stay', 'String (interpolated)')) {
1266 0         0 return 1
1267             }
1268             # attribute => 'Operator'
1269             # char => ')'
1270             # context => '#pop#pop#pop'
1271             # endRegion => 'String'
1272             # type => 'DetectChar'
1273 0 0       0 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
1274 0         0 return 1
1275             }
1276             # context => 'ipstring_internal'
1277             # type => 'IncludeRules'
1278 0 0       0 if ($self->includeRules('ipstring_internal', $text)) {
1279 0         0 return 1
1280             }
1281 0         0 return 0;
1282             };
1283              
1284             sub parseip_string_3 {
1285 94     94 0 248 my ($self, $text) = @_;
1286             # attribute => 'String (interpolated)'
1287             # char => '{'
1288             # char1 => '}'
1289             # context => '#stay'
1290             # type => 'RangeDetect'
1291 94 100       308 if ($self->testRangeDetect($text, '\{', '}', 0, 0, undef, 0, '#stay', 'String (interpolated)')) {
1292 6         19 return 1
1293             }
1294             # attribute => 'Operator'
1295             # char => '}'
1296             # context => '#pop#pop#pop'
1297             # endRegion => 'String'
1298             # type => 'DetectChar'
1299 88 100       380 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
1300 16         49 return 1
1301             }
1302             # context => 'ipstring_internal'
1303             # type => 'IncludeRules'
1304 72 100       269 if ($self->includeRules('ipstring_internal', $text)) {
1305 34         89 return 1
1306             }
1307 38         107 return 0;
1308             };
1309              
1310             sub parseip_string_4 {
1311 0     0 0 0 my ($self, $text) = @_;
1312             # attribute => 'String (interpolated)'
1313             # char => '['
1314             # char1 => ']'
1315             # context => '#stay'
1316             # type => 'RangeDetect'
1317 0 0       0 if ($self->testRangeDetect($text, '[', ']', 0, 0, undef, 0, '#stay', 'String (interpolated)')) {
1318 0         0 return 1
1319             }
1320             # attribute => 'Operator'
1321             # char => ']'
1322             # context => '#pop#pop#pop'
1323             # endRegion => 'String'
1324             # type => 'DetectChar'
1325 0 0       0 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
1326 0         0 return 1
1327             }
1328             # context => 'ipstring_internal'
1329             # type => 'IncludeRules'
1330 0 0       0 if ($self->includeRules('ipstring_internal', $text)) {
1331 0         0 return 1
1332             }
1333 0         0 return 0;
1334             };
1335              
1336             sub parseip_string_5 {
1337 0     0 0 0 my ($self, $text) = @_;
1338             # attribute => 'String (interpolated)'
1339             # char => '<'
1340             # char1 => '>'
1341             # context => '#stay'
1342             # type => 'RangeDetect'
1343 0 0       0 if ($self->testRangeDetect($text, '<', '>', 0, 0, undef, 0, '#stay', 'String (interpolated)')) {
1344 0         0 return 1
1345             }
1346             # attribute => 'Operator'
1347             # char => '>'
1348             # context => '#pop#pop#pop'
1349             # endRegion => 'String'
1350             # type => 'DetectChar'
1351 0 0       0 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
1352 0         0 return 1
1353             }
1354             # context => 'ipstring_internal'
1355             # type => 'IncludeRules'
1356 0 0       0 if ($self->includeRules('ipstring_internal', $text)) {
1357 0         0 return 1
1358             }
1359 0         0 return 0;
1360             };
1361              
1362             sub parseip_string_6 {
1363 34     34 0 78 my ($self, $text) = @_;
1364             # String => '\\%1'
1365             # attribute => 'String (interpolated)'
1366             # context => '#stay'
1367             # dynamic => 'true'
1368             # type => 'RegExpr'
1369 34 50       142 if ($self->testRegExpr($text, '\\\\%1', 0, 1, 0, undef, 0, '#stay', 'String (interpolated)')) {
1370 0         0 return 1
1371             }
1372             # attribute => 'Operator'
1373             # char => '1'
1374             # context => '#pop#pop#pop'
1375             # dynamic => 'true'
1376             # endRegion => 'String'
1377             # type => 'DetectChar'
1378 34 100       136 if ($self->testDetectChar($text, '1', 0, 1, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
1379 4         15 return 1
1380             }
1381             # context => 'ipstring_internal'
1382             # type => 'IncludeRules'
1383 30 100       130 if ($self->includeRules('ipstring_internal', $text)) {
1384 14         58 return 1
1385             }
1386 16         46 return 0;
1387             };
1388              
1389             sub parseipstring_internal {
1390 406     406 0 935 my ($self, $text) = @_;
1391             # type => 'DetectIdentifier'
1392 406 100       1410 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
1393 151         626 return 1
1394             }
1395             # String => '\\[UuLlEtnaefr]'
1396             # attribute => 'String Special Character'
1397             # context => '#stay'
1398             # type => 'RegExpr'
1399 255 100       874 if ($self->testRegExpr($text, '\\\\[UuLlEtnaefr]', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
1400 9         33 return 1
1401             }
1402             # String => '\\.'
1403             # attribute => 'String (interpolated)'
1404             # context => '#stay'
1405             # type => 'RegExpr'
1406 246 100       1042 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'String (interpolated)')) {
1407 11         40 return 1
1408             }
1409             # String => '(?:[\$@]\S|%[\w{])'
1410             # attribute => 'Normal Text'
1411             # context => 'find_variable_unsafe'
1412             # lookAhead => 'true'
1413             # type => 'RegExpr'
1414 235 100       773 if ($self->testRegExpr($text, '(?:[\\$@]\\S|%[\\w{])', 0, 0, 1, undef, 0, 'find_variable_unsafe', 'Normal Text')) {
1415 30         222 return 1
1416             }
1417 205         869 return 0;
1418             };
1419              
1420             sub parsenormal {
1421 13423     13423 0 34501 my ($self, $text) = @_;
1422             # String => '^#!\/.*'
1423             # attribute => 'Keyword'
1424             # context => '#stay'
1425             # type => 'RegExpr'
1426 13423 100       42438 if ($self->testRegExpr($text, '^#!\\/.*', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
1427 2         8 return 1
1428             }
1429             # String => '__DATA__'
1430             # attribute => 'Keyword'
1431             # context => 'data_handle'
1432             # firstNonSpace => 'true'
1433             # type => 'StringDetect'
1434 13421 50       43891 if ($self->testStringDetect($text, '__DATA__', 0, 0, 0, undef, 1, 'data_handle', 'Keyword')) {
1435 0         0 return 1
1436             }
1437             # String => '__END__'
1438             # attribute => 'Keyword'
1439             # context => '#stay'
1440             # firstNonSpace => 'true'
1441             # type => 'StringDetect'
1442 13421 100       38024 if ($self->testStringDetect($text, '__END__', 0, 0, 0, undef, 1, '#stay', 'Keyword')) {
1443 2         11 return 1
1444             }
1445             # String => '\bsub\s+'
1446             # attribute => 'Keyword'
1447             # context => 'sub_name_def'
1448             # type => 'RegExpr'
1449 13419 100       36764 if ($self->testRegExpr($text, '\\bsub\\s+', 0, 0, 0, undef, 0, 'sub_name_def', 'Keyword')) {
1450 83         270 return 1
1451             }
1452             # String => 'keywords'
1453             # attribute => 'Keyword'
1454             # context => '#stay'
1455             # type => 'keyword'
1456 13336 100       83124 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
1457 569         1969 return 1
1458             }
1459             # String => 'operators'
1460             # attribute => 'Operator'
1461             # context => '#stay'
1462             # type => 'keyword'
1463 12767 100       37313 if ($self->testKeyword($text, 'operators', 0, undef, 0, '#stay', 'Operator')) {
1464 51         237 return 1
1465             }
1466             # String => 'functions'
1467             # attribute => 'Function'
1468             # context => '#stay'
1469             # type => 'keyword'
1470 12716 100       39181 if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'Function')) {
1471 237         1023 return 1
1472             }
1473             # String => 'pragmas'
1474             # attribute => 'Pragma'
1475             # context => '#stay'
1476             # type => 'keyword'
1477 12479 100       36105 if ($self->testKeyword($text, 'pragmas', 0, undef, 0, '#stay', 'Pragma')) {
1478 14         51 return 1
1479             }
1480             # String => '\=(?:head[1-6]|over|back|item|for|begin|end|pod)(\s|$)'
1481             # attribute => 'Pod'
1482             # beginRegion => 'POD'
1483             # column => '0'
1484             # context => 'pod'
1485             # type => 'RegExpr'
1486 12465 100       40825 if ($self->testRegExpr($text, '\\=(?:head[1-6]|over|back|item|for|begin|end|pod)(\\s|$)', 0, 0, 0, 0, 0, 'pod', 'Pod')) {
1487 3         15 return 1
1488             }
1489             # type => 'DetectSpaces'
1490 12462 100       49509 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
1491 4620         15297 return 1
1492             }
1493             # attribute => 'Comment'
1494             # char => '#'
1495             # context => 'comment'
1496             # type => 'DetectChar'
1497 7842 100       24793 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
1498 109         364 return 1
1499             }
1500             # attribute => 'Octal'
1501             # context => 'slash_safe_escape'
1502             # type => 'HlCOct'
1503 7733 50       27412 if ($self->testHlCOct($text, 0, undef, 0, 'slash_safe_escape', 'Octal')) {
1504 0         0 return 1
1505             }
1506             # attribute => 'Hex'
1507             # context => 'slash_safe_escape'
1508             # type => 'HlCHex'
1509 7733 50       22898 if ($self->testHlCHex($text, 0, undef, 0, 'slash_safe_escape', 'Hex')) {
1510 0         0 return 1
1511             }
1512             # attribute => 'Float'
1513             # context => 'slash_safe_escape'
1514             # type => 'Float'
1515 7733 100       25374 if ($self->testFloat($text, 0, undef, 0, 'slash_safe_escape', 'Float')) {
1516 90         316 return 1
1517             }
1518             # attribute => 'Decimal'
1519             # context => 'slash_safe_escape'
1520             # type => 'Int'
1521 7643 100       22524 if ($self->testInt($text, 0, undef, 0, 'slash_safe_escape', 'Decimal')) {
1522 2         9 return 1
1523             }
1524             # String => '\\(["'])[^\1]'
1525             # attribute => 'Normal Text'
1526             # context => '#stay'
1527             # type => 'RegExpr'
1528 7641 50       23653 if ($self->testRegExpr($text, '\\\\(["\'])[^\\1]', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1529 0         0 return 1
1530             }
1531             # attribute => 'Normal Text'
1532             # char => '&'
1533             # char1 => '''
1534             # context => '#stay'
1535             # type => 'Detect2Chars'
1536 7641 50       28037 if ($self->testDetect2Chars($text, '&', '\'', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1537 0         0 return 1
1538             }
1539             # attribute => 'Operator'
1540             # beginRegion => 'String'
1541             # char => '"'
1542             # context => 'ip_string'
1543             # type => 'DetectChar'
1544 7641 100       26201 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'ip_string', 'Operator')) {
1545 38         147 return 1
1546             }
1547             # attribute => 'Operator'
1548             # beginRegion => 'String'
1549             # char => '''
1550             # context => 'string'
1551             # type => 'DetectChar'
1552 7603 100       20244 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'string', 'Operator')) {
1553 1103         3668 return 1
1554             }
1555             # attribute => 'Operator'
1556             # char => '`'
1557             # context => 'Backticked'
1558             # type => 'DetectChar'
1559 6500 50       18589 if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, 'Backticked', 'Operator')) {
1560 0         0 return 1
1561             }
1562             # String => '(?:[$@]\S|%[\w{]|\*[^\d\*{\$@%=(])'
1563             # attribute => 'Normal Text'
1564             # context => 'find_variable'
1565             # lookAhead => 'true'
1566             # type => 'RegExpr'
1567 6500 100       19000 if ($self->testRegExpr($text, '(?:[$@]\\S|%[\\w{]|\\*[^\\d\\*{\\$@%=(])', 0, 0, 1, undef, 0, 'find_variable', 'Normal Text')) {
1568 1100         3990 return 1
1569             }
1570             # String => '<[A-Z0-9_]+>'
1571             # attribute => 'Keyword'
1572             # context => '#stay'
1573             # type => 'RegExpr'
1574 5400 50       23278 if ($self->testRegExpr($text, '<[A-Z0-9_]+>', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
1575 0         0 return 1
1576             }
1577             # String => '\s*<<(?=\w+|\s*["'])'
1578             # attribute => 'Operator'
1579             # beginRegion => 'HereDocument'
1580             # context => 'find_here_document'
1581             # type => 'RegExpr'
1582 5400 100       17787 if ($self->testRegExpr($text, '\\s*<<(?=\\w+|\\s*["\'])', 0, 0, 0, undef, 0, 'find_here_document', 'Operator')) {
1583 3         12 return 1
1584             }
1585             # String => '\s*\}\s*/'
1586             # attribute => 'Normal Text'
1587             # context => '#stay'
1588             # endRegion => 'Block'
1589             # type => 'RegExpr'
1590 5397 50       21807 if ($self->testRegExpr($text, '\\s*\\}\\s*/', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1591 0         0 return 1
1592             }
1593             # String => '\s*[)]\s*/'
1594             # attribute => 'Normal Text'
1595             # context => '#stay'
1596             # type => 'RegExpr'
1597 5397 50       17866 if ($self->testRegExpr($text, '\\s*[)]\\s*/', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1598 0         0 return 1
1599             }
1600             # String => '\w+::'
1601             # attribute => 'Function'
1602             # context => 'sub_name_def'
1603             # type => 'RegExpr'
1604 5397 100       18072 if ($self->testRegExpr($text, '\\w+::', 0, 0, 0, undef, 0, 'sub_name_def', 'Function')) {
1605 6         23 return 1
1606             }
1607             # String => '\w+[=]'
1608             # attribute => 'Normal Text'
1609             # context => '#stay'
1610             # type => 'RegExpr'
1611 5391 50       18402 if ($self->testRegExpr($text, '\\w+[=]', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1612 0         0 return 1
1613             }
1614             # String => '\bq(?=[qwx]?\s*[^\w\s])'
1615             # attribute => 'Operator'
1616             # context => 'find_quoted'
1617             # type => 'RegExpr'
1618 5391 100       20601 if ($self->testRegExpr($text, '\\bq(?=[qwx]?\\s*[^\\w\\s])', 0, 0, 0, undef, 0, 'find_quoted', 'Operator')) {
1619 25         94 return 1
1620             }
1621             # String => '\bs(?=\s*[^\w\s])'
1622             # attribute => 'Operator'
1623             # context => 'find_subst'
1624             # type => 'RegExpr'
1625 5366 100       19199 if ($self->testRegExpr($text, '\\bs(?=\\s*[^\\w\\s])', 0, 0, 0, undef, 0, 'find_subst', 'Operator')) {
1626 26         116 return 1
1627             }
1628             # String => '\b(?:tr|y)\s*(?=[^\w\s\]})])'
1629             # attribute => 'Operator'
1630             # context => 'tr'
1631             # type => 'RegExpr'
1632 5340 100       19807 if ($self->testRegExpr($text, '\\b(?:tr|y)\\s*(?=[^\\w\\s\\]})])', 0, 0, 0, undef, 0, 'tr', 'Operator')) {
1633 2         9 return 1
1634             }
1635             # String => '\b(?:m|qr)(?=\s*[^\w\s\]})])'
1636             # attribute => 'Operator'
1637             # context => 'find_pattern'
1638             # type => 'RegExpr'
1639 5338 100       18948 if ($self->testRegExpr($text, '\\b(?:m|qr)(?=\\s*[^\\w\\s\\]})])', 0, 0, 0, undef, 0, 'find_pattern', 'Operator')) {
1640 5         24 return 1
1641             }
1642             # String => '[\w_]+\s*/'
1643             # attribute => 'Normal Text'
1644             # context => '#stay'
1645             # type => 'RegExpr'
1646 5333 100       21018 if ($self->testRegExpr($text, '[\\w_]+\\s*/', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1647 2         9 return 1
1648             }
1649             # String => '[<>"':]/'
1650             # attribute => 'Normal Text'
1651             # context => '#stay'
1652             # type => 'RegExpr'
1653 5331 50       19368 if ($self->testRegExpr($text, '[<>"\':]/', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1654 0         0 return 1
1655             }
1656             # attribute => 'Operator'
1657             # beginRegion => 'Pattern'
1658             # char => '/'
1659             # context => 'pattern_slash'
1660             # type => 'DetectChar'
1661 5331 100       20786 if ($self->testDetectChar($text, '/', 0, 0, 0, undef, 0, 'pattern_slash', 'Operator')) {
1662 29         103 return 1
1663             }
1664             # String => '-[rwxoRWXOeszfdlpSbctugkTBMAC]'
1665             # attribute => 'Operator'
1666             # context => '#stay'
1667             # type => 'RegExpr'
1668 5302 50       15375 if ($self->testRegExpr($text, '-[rwxoRWXOeszfdlpSbctugkTBMAC]', 0, 0, 0, undef, 0, '#stay', 'Operator')) {
1669 0         0 return 1
1670             }
1671             # attribute => 'Normal Text'
1672             # beginRegion => 'Block'
1673             # char => '{'
1674             # context => '#stay'
1675             # type => 'DetectChar'
1676 5302 100       18047 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1677 374         1517 return 1
1678             }
1679             # attribute => 'Normal Text'
1680             # char => '}'
1681             # context => '#stay'
1682             # endRegion => 'Block'
1683             # type => 'DetectChar'
1684 4928 100       14587 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1685 375         1464 return 1
1686             }
1687 4553         12788 return 0;
1688             };
1689              
1690             sub parsepackage_qualified_blank {
1691 0     0 0 0 my ($self, $text) = @_;
1692             # String => '[\w_]+'
1693             # attribute => 'Normal Text'
1694             # context => '#pop'
1695             # type => 'RegExpr'
1696 0 0       0 if ($self->testRegExpr($text, '[\\w_]+', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
1697 0         0 return 1
1698             }
1699 0         0 return 0;
1700             };
1701              
1702             sub parsepat_char_class {
1703 139     139 0 360 my ($self, $text) = @_;
1704             # attribute => 'Pattern Internal Operator'
1705             # char => '^'
1706             # context => '#stay'
1707             # type => 'DetectChar'
1708 139 100       410 if ($self->testDetectChar($text, '^', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
1709 4         12 return 1
1710             }
1711             # attribute => 'Pattern Character Class'
1712             # char => '\'
1713             # char1 => '\'
1714             # context => '#stay'
1715             # type => 'Detect2Chars'
1716 135 100       461 if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'Pattern Character Class')) {
1717 2         7 return 1
1718             }
1719             # attribute => 'Pattern Character Class'
1720             # char => '\'
1721             # char1 => ']'
1722             # context => '#stay'
1723             # type => 'Detect2Chars'
1724 133 50       389 if ($self->testDetect2Chars($text, '\\', ']', 0, 0, 0, undef, 0, '#stay', 'Pattern Character Class')) {
1725 0         0 return 1
1726             }
1727             # String => '\[:^?[a-z]+:\]'
1728             # attribute => 'Pattern Character Class'
1729             # context => '#stay'
1730             # type => 'RegExpr'
1731 133 50       491 if ($self->testRegExpr($text, '\\[:^?[a-z]+:\\]', 0, 0, 0, undef, 0, '#stay', 'Pattern Character Class')) {
1732 0         0 return 1
1733             }
1734             # attribute => 'Pattern Internal Operator'
1735             # char => ']'
1736             # context => '#pop'
1737             # type => 'DetectChar'
1738 133 100       455 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Pattern Internal Operator')) {
1739 18         56 return 1
1740             }
1741 115         282 return 0;
1742             };
1743              
1744             sub parsepat_ext {
1745 3     3 0 22 my ($self, $text) = @_;
1746             # String => '\#[^)]*'
1747             # attribute => 'Comment'
1748             # context => '#pop'
1749             # type => 'RegExpr'
1750 3 50       17 if ($self->testRegExpr($text, '\\#[^)]*', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
1751 0         0 return 1
1752             }
1753             # String => '[:=!><]+'
1754             # attribute => 'Pattern Internal Operator'
1755             # context => '#pop'
1756             # type => 'RegExpr'
1757 3 50       13 if ($self->testRegExpr($text, '[:=!><]+', 0, 0, 0, undef, 0, '#pop', 'Pattern Internal Operator')) {
1758 3         10 return 1
1759             }
1760             # attribute => 'Pattern Internal Operator'
1761             # char => ')'
1762             # context => '#pop'
1763             # type => 'DetectChar'
1764 0 0       0 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Pattern Internal Operator')) {
1765 0         0 return 1
1766             }
1767 0         0 return 0;
1768             };
1769              
1770             sub parsepattern {
1771 28     28 0 91 my ($self, $text) = @_;
1772             # String => '\$(?=%1)'
1773             # attribute => 'Pattern Internal Operator'
1774             # context => '#stay'
1775             # dynamic => 'true'
1776             # type => 'RegExpr'
1777 28 50       108 if ($self->testRegExpr($text, '\\$(?=%1)', 0, 1, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
1778 0         0 return 1
1779             }
1780             # String => '%1[cgimosx]*'
1781             # attribute => 'Operator'
1782             # context => '#pop#pop'
1783             # dynamic => 'true'
1784             # endRegion => 'Pattern'
1785             # type => 'RegExpr'
1786 28 100       117 if ($self->testRegExpr($text, '%1[cgimosx]*', 0, 1, 0, undef, 0, '#pop#pop', 'Operator')) {
1787 5         19 return 1
1788             }
1789             # context => 'regex_pattern_internal_ip'
1790             # type => 'IncludeRules'
1791 23 100       97 if ($self->includeRules('regex_pattern_internal_ip', $text)) {
1792 11         34 return 1
1793             }
1794             # String => '\$(?=\%1)'
1795             # attribute => 'Pattern Internal Operator'
1796             # context => '#stay'
1797             # dynamic => 'true'
1798             # type => 'RegExpr'
1799 12 50       50 if ($self->testRegExpr($text, '\\$(?=\\%1)', 0, 1, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
1800 0         0 return 1
1801             }
1802 12         39 return 0;
1803             };
1804              
1805             sub parsepattern_brace {
1806 0     0 0 0 my ($self, $text) = @_;
1807             # String => '\}[cgimosx]*'
1808             # attribute => 'Operator'
1809             # context => '#pop#pop'
1810             # endRegion => 'Pattern'
1811             # type => 'RegExpr'
1812 0 0       0 if ($self->testRegExpr($text, '\\}[cgimosx]*', 0, 0, 0, undef, 0, '#pop#pop', 'Operator')) {
1813 0         0 return 1
1814             }
1815             # context => 'regex_pattern_internal_ip'
1816             # type => 'IncludeRules'
1817 0 0       0 if ($self->includeRules('regex_pattern_internal_ip', $text)) {
1818 0         0 return 1
1819             }
1820 0         0 return 0;
1821             };
1822              
1823             sub parsepattern_bracket {
1824 0     0 0 0 my ($self, $text) = @_;
1825             # String => '\][cgimosx]*'
1826             # attribute => 'Operator'
1827             # context => '#pop#pop'
1828             # endRegion => 'Pattern'
1829             # type => 'RegExpr'
1830 0 0       0 if ($self->testRegExpr($text, '\\][cgimosx]*', 0, 0, 0, undef, 0, '#pop#pop', 'Operator')) {
1831 0         0 return 1
1832             }
1833             # context => 'regex_pattern_internal_ip'
1834             # type => 'IncludeRules'
1835 0 0       0 if ($self->includeRules('regex_pattern_internal_ip', $text)) {
1836 0         0 return 1
1837             }
1838 0         0 return 0;
1839             };
1840              
1841             sub parsepattern_paren {
1842 0     0 0 0 my ($self, $text) = @_;
1843             # String => '\)[cgimosx]*'
1844             # attribute => 'Operator'
1845             # context => '#pop#pop'
1846             # endRegion => 'Pattern'
1847             # type => 'RegExpr'
1848 0 0       0 if ($self->testRegExpr($text, '\\)[cgimosx]*', 0, 0, 0, undef, 0, '#pop#pop', 'Operator')) {
1849 0         0 return 1
1850             }
1851             # context => 'regex_pattern_internal_ip'
1852             # type => 'IncludeRules'
1853 0 0       0 if ($self->includeRules('regex_pattern_internal_ip', $text)) {
1854 0         0 return 1
1855             }
1856 0         0 return 0;
1857             };
1858              
1859             sub parsepattern_slash {
1860 176     176 0 403 my ($self, $text) = @_;
1861             # String => '\$(?=/)'
1862             # attribute => 'Pattern Internal Operator'
1863             # context => '#stay'
1864             # type => 'RegExpr'
1865 176 100       650 if ($self->testRegExpr($text, '\\$(?=/)', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
1866 3         13 return 1
1867             }
1868             # context => 'regex_pattern_internal_ip'
1869             # type => 'IncludeRules'
1870 173 100       661 if ($self->includeRules('regex_pattern_internal_ip', $text)) {
1871 115         372 return 1
1872             }
1873             # String => '/[cgimosx]*'
1874             # attribute => 'Operator'
1875             # context => '#pop'
1876             # endRegion => 'Pattern'
1877             # type => 'RegExpr'
1878 58 100       245 if ($self->testRegExpr($text, '/[cgimosx]*', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
1879 29         95 return 1
1880             }
1881 29         81 return 0;
1882             };
1883              
1884             sub parsepattern_sq {
1885 0     0 0 0 my ($self, $text) = @_;
1886             # String => ''[cgimosx]*'
1887             # attribute => 'Operator'
1888             # context => '#pop#pop'
1889             # endRegion => 'Pattern'
1890             # type => 'RegExpr'
1891 0 0       0 if ($self->testRegExpr($text, '\'[cgimosx]*', 0, 0, 0, undef, 0, '#pop#pop', 'Operator')) {
1892 0         0 return 1
1893             }
1894             # context => 'regex_pattern_internal'
1895             # type => 'IncludeRules'
1896 0 0       0 if ($self->includeRules('regex_pattern_internal', $text)) {
1897 0         0 return 1
1898             }
1899 0         0 return 0;
1900             };
1901              
1902             sub parsepod {
1903 6394     6394 0 14368 my ($self, $text) = @_;
1904             # type => 'DetectSpaces'
1905 6394 100       24300 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
1906 2168         6324 return 1
1907             }
1908             # type => 'DetectIdentifier'
1909 4226 100       20475 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
1910 2224         7663 return 1
1911             }
1912             # String => '\=(?:head[1-6]|over|back|item|for|begin|end|pod)\s*.*'
1913             # attribute => 'Pod'
1914             # beginRegion => 'POD'
1915             # column => '0'
1916             # context => '#stay'
1917             # endRegion => 'POD'
1918             # type => 'RegExpr'
1919 2002 100       7490 if ($self->testRegExpr($text, '\\=(?:head[1-6]|over|back|item|for|begin|end|pod)\\s*.*', 0, 0, 0, 0, 0, '#stay', 'Pod')) {
1920 90         366 return 1
1921             }
1922             # String => '\=cut\b.*'
1923             # attribute => 'Pod'
1924             # column => '0'
1925             # context => '#pop'
1926             # endRegion => 'POD'
1927             # type => 'RegExpr'
1928 1912 100       7345 if ($self->testRegExpr($text, '\\=cut\\b.*', 0, 0, 0, 0, 0, '#pop', 'Pod')) {
1929 2         545 return 1
1930             }
1931 1910         5717 return 0;
1932             };
1933              
1934             sub parsequote_word {
1935 0     0 0 0 my ($self, $text) = @_;
1936             # type => 'DetectSpaces'
1937 0 0       0 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
1938 0         0 return 1
1939             }
1940             # type => 'DetectIdentifier'
1941 0 0       0 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
1942 0         0 return 1
1943             }
1944             # String => '\\%1'
1945             # attribute => 'Normal Text'
1946             # context => '#stay'
1947             # dynamic => 'true'
1948             # type => 'RegExpr'
1949 0 0       0 if ($self->testRegExpr($text, '\\\\%1', 0, 1, 0, undef, 0, '#stay', 'Normal Text')) {
1950 0         0 return 1
1951             }
1952             # attribute => 'Operator'
1953             # char => '1'
1954             # context => '#pop#pop#pop'
1955             # dynamic => 'true'
1956             # endRegion => 'Wordlist'
1957             # type => 'DetectChar'
1958 0 0       0 if ($self->testDetectChar($text, '1', 0, 1, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
1959 0         0 return 1
1960             }
1961 0         0 return 0;
1962             };
1963              
1964             sub parsequote_word_brace {
1965 0     0 0 0 my ($self, $text) = @_;
1966             # type => 'DetectSpaces'
1967 0 0       0 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
1968 0         0 return 1
1969             }
1970             # type => 'DetectIdentifier'
1971 0 0       0 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
1972 0         0 return 1
1973             }
1974             # attribute => 'Normal Text'
1975             # char => '\'
1976             # char1 => '}'
1977             # context => '#stay'
1978             # type => 'Detect2Chars'
1979 0 0       0 if ($self->testDetect2Chars($text, '\\', '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
1980 0         0 return 1
1981             }
1982             # attribute => 'Operator'
1983             # char => '}'
1984             # context => '#pop#pop#pop'
1985             # endRegion => 'Wordlist'
1986             # type => 'DetectChar'
1987 0 0       0 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
1988 0         0 return 1
1989             }
1990 0         0 return 0;
1991             };
1992              
1993             sub parsequote_word_bracket {
1994 0     0 0 0 my ($self, $text) = @_;
1995             # type => 'DetectSpaces'
1996 0 0       0 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
1997 0         0 return 1
1998             }
1999             # type => 'DetectIdentifier'
2000 0 0       0 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
2001 0         0 return 1
2002             }
2003             # attribute => 'Normal Text'
2004             # char => '\'
2005             # char1 => ']'
2006             # context => '#stay'
2007             # type => 'Detect2Chars'
2008 0 0       0 if ($self->testDetect2Chars($text, '\\', ']', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
2009 0         0 return 1
2010             }
2011             # attribute => 'Operator'
2012             # char => ']'
2013             # context => '#pop#pop#pop'
2014             # endRegion => 'Wordlist'
2015             # type => 'DetectChar'
2016 0 0       0 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
2017 0         0 return 1
2018             }
2019 0         0 return 0;
2020             };
2021              
2022             sub parsequote_word_paren {
2023 14     14 0 36 my ($self, $text) = @_;
2024             # type => 'DetectSpaces'
2025 14 100       56 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
2026 4         14 return 1
2027             }
2028             # type => 'DetectIdentifier'
2029 10 100       45 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
2030 7         47 return 1
2031             }
2032             # attribute => 'Normal Text'
2033             # char => '\'
2034             # char1 => ')'
2035             # context => '#stay'
2036             # type => 'Detect2Chars'
2037 3 50       20 if ($self->testDetect2Chars($text, '\\', ')', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
2038 0         0 return 1
2039             }
2040             # attribute => 'Operator'
2041             # char => ')'
2042             # context => '#pop#pop#pop'
2043             # endRegion => 'Wordlist'
2044             # type => 'DetectChar'
2045 3 50       16 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
2046 3         12 return 1
2047             }
2048 0         0 return 0;
2049             };
2050              
2051             sub parseregex_pattern_internal {
2052 0     0 0 0 my ($self, $text) = @_;
2053             # context => 'regex_pattern_internal_rules_1'
2054             # type => 'IncludeRules'
2055 0 0       0 if ($self->includeRules('regex_pattern_internal_rules_1', $text)) {
2056 0         0 return 1
2057             }
2058             # context => 'regex_pattern_internal_rules_2'
2059             # type => 'IncludeRules'
2060 0 0       0 if ($self->includeRules('regex_pattern_internal_rules_2', $text)) {
2061 0         0 return 1
2062             }
2063 0         0 return 0;
2064             };
2065              
2066             sub parseregex_pattern_internal_ip {
2067 272     272 0 672 my ($self, $text) = @_;
2068             # context => 'regex_pattern_internal_rules_1'
2069             # type => 'IncludeRules'
2070 272 100       1672 if ($self->includeRules('regex_pattern_internal_rules_1', $text)) {
2071 36         128 return 1
2072             }
2073             # String => '[$@][^]\s{}()|>']'
2074             # attribute => 'Data Type'
2075             # context => 'find_variable_unsafe'
2076             # lookAhead => 'true'
2077             # type => 'RegExpr'
2078 236 100       825 if ($self->testRegExpr($text, '[$@][^]\\s{}()|>\']', 0, 0, 1, undef, 0, 'find_variable_unsafe', 'Data Type')) {
2079 5         20 return 1
2080             }
2081             # context => 'regex_pattern_internal_rules_2'
2082             # type => 'IncludeRules'
2083 231 100       981 if ($self->includeRules('regex_pattern_internal_rules_2', $text)) {
2084 132         485 return 1
2085             }
2086 99         363 return 0;
2087             };
2088              
2089             sub parseregex_pattern_internal_rules_1 {
2090 272     272 0 619 my ($self, $text) = @_;
2091             # String => '#.*$'
2092             # attribute => 'Comment'
2093             # context => '#stay'
2094             # firstNonSpace => 'true'
2095             # type => 'RegExpr'
2096 272 50       864 if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 1, '#stay', 'Comment')) {
2097 0         0 return 1
2098             }
2099             # String => '\\[anDdSsWw]'
2100             # attribute => 'Pattern Character Class'
2101             # context => '#stay'
2102             # type => 'RegExpr'
2103 272 100       973 if ($self->testRegExpr($text, '\\\\[anDdSsWw]', 0, 0, 0, undef, 0, '#stay', 'Pattern Character Class')) {
2104 20         87 return 1
2105             }
2106             # String => '\\[ABbEGLlNUuQdQZz]'
2107             # attribute => 'Pattern Internal Operator'
2108             # context => '#stay'
2109             # type => 'RegExpr'
2110 252 50       971 if ($self->testRegExpr($text, '\\\\[ABbEGLlNUuQdQZz]', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
2111 0         0 return 1
2112             }
2113             # String => '\\[\d]+'
2114             # attribute => 'Special Variable'
2115             # context => '#stay'
2116             # type => 'RegExpr'
2117 252 50       870 if ($self->testRegExpr($text, '\\\\[\\d]+', 0, 0, 0, undef, 0, '#stay', 'Special Variable')) {
2118 0         0 return 1
2119             }
2120             # String => '\\.'
2121             # attribute => 'Pattern'
2122             # context => '#stay'
2123             # type => 'RegExpr'
2124 252 100       881 if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Pattern')) {
2125 16         65 return 1
2126             }
2127 236         1035 return 0;
2128             };
2129              
2130             sub parseregex_pattern_internal_rules_2 {
2131 231     231 0 586 my ($self, $text) = @_;
2132             # attribute => 'Pattern Internal Operator'
2133             # char => '('
2134             # char1 => '?'
2135             # context => 'pat_ext'
2136             # type => 'Detect2Chars'
2137 231 100       864 if ($self->testDetect2Chars($text, '(', '?', 0, 0, 0, undef, 0, 'pat_ext', 'Pattern Internal Operator')) {
2138 3         14 return 1
2139             }
2140             # attribute => 'Pattern Internal Operator'
2141             # char => '['
2142             # context => 'pat_char_class'
2143             # type => 'DetectChar'
2144 228 100       847 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'pat_char_class', 'Pattern Internal Operator')) {
2145 18         74 return 1
2146             }
2147             # String => '[()?^*+|]'
2148             # attribute => 'Pattern Internal Operator'
2149             # context => '#stay'
2150             # type => 'RegExpr'
2151 210 100       706 if ($self->testRegExpr($text, '[()?^*+|]', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
2152 109         460 return 1
2153             }
2154             # String => '\{[\d, ]+\}'
2155             # attribute => 'Pattern Internal Operator'
2156             # context => '#stay'
2157             # type => 'RegExpr'
2158 101 100       369 if ($self->testRegExpr($text, '\\{[\\d, ]+\\}', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
2159 2         8 return 1
2160             }
2161             # attribute => 'Pattern Internal Operator'
2162             # char => '$'
2163             # context => '#stay'
2164             # type => 'DetectChar'
2165 99 50       435 if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
2166 0         0 return 1
2167             }
2168             # String => '\s{3,}#.*$'
2169             # attribute => 'Comment'
2170             # context => '#stay'
2171             # type => 'RegExpr'
2172 99 50       419 if ($self->testRegExpr($text, '\\s{3,}#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
2173 0         0 return 1
2174             }
2175 99         449 return 0;
2176             };
2177              
2178             sub parseslash_safe_escape {
2179 1173     1173 0 3038 my ($self, $text) = @_;
2180             # String => '\s*\]?\s*/'
2181             # attribute => 'Normal Text'
2182             # context => '#pop'
2183             # type => 'RegExpr'
2184 1173 100       4503 if ($self->testRegExpr($text, '\\s*\\]?\\s*/', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
2185 4         44 return 1
2186             }
2187             # String => '\s*\}?\s*/'
2188             # attribute => 'Normal Text'
2189             # context => '#pop'
2190             # endRegion => 'Block'
2191             # type => 'RegExpr'
2192 1169 50       4525 if ($self->testRegExpr($text, '\\s*\\}?\\s*/', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
2193 0         0 return 1
2194             }
2195             # String => '\s*\)?\s*/'
2196             # attribute => 'Normal Text'
2197             # context => '#pop'
2198             # type => 'RegExpr'
2199 1169 50       4909 if ($self->testRegExpr($text, '\\s*\\)?\\s*/', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
2200 0         0 return 1
2201             }
2202             # String => 'keywords'
2203             # attribute => 'Keyword'
2204             # context => '#pop'
2205             # type => 'keyword'
2206 1169 50       5389 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#pop', 'Keyword')) {
2207 0         0 return 1
2208             }
2209 1169         5498 return 0;
2210             };
2211              
2212             sub parsestring {
2213 3143     3143 0 6762 my ($self, $text) = @_;
2214             # type => 'DetectIdentifier'
2215 3143 100       9770 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
2216 1133         3257 return 1
2217             }
2218             # attribute => 'String Special Character'
2219             # char => '\'
2220             # char1 => '''
2221             # context => '#stay'
2222             # type => 'Detect2Chars'
2223 2010 100       6494 if ($self->testDetect2Chars($text, '\\', '\'', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2224 2         8 return 1
2225             }
2226             # attribute => 'String Special Character'
2227             # char => '\'
2228             # char1 => '\'
2229             # context => '#stay'
2230             # type => 'Detect2Chars'
2231 2008 100       5595 if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2232 3         23 return 1
2233             }
2234             # attribute => 'Operator'
2235             # char => '''
2236             # context => '#pop'
2237             # endRegion => 'String'
2238             # type => 'DetectChar'
2239 2005 100       5800 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
2240 1103         4362 return 1
2241             }
2242 902         1894 return 0;
2243             };
2244              
2245             sub parsestring_2 {
2246 0     0 0 0 my ($self, $text) = @_;
2247             # type => 'DetectIdentifier'
2248 0 0       0 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
2249 0         0 return 1
2250             }
2251             # attribute => 'String Special Character'
2252             # char => '\'
2253             # char1 => ')'
2254             # context => '#stay'
2255             # type => 'Detect2Chars'
2256 0 0       0 if ($self->testDetect2Chars($text, '\\', ')', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2257 0         0 return 1
2258             }
2259             # attribute => 'String Special Character'
2260             # char => '\'
2261             # char1 => '\'
2262             # context => '#stay'
2263             # type => 'Detect2Chars'
2264 0 0       0 if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2265 0         0 return 1
2266             }
2267             # attribute => 'String'
2268             # char => '('
2269             # char1 => ')'
2270             # context => '#stay'
2271             # type => 'RangeDetect'
2272 0 0       0 if ($self->testRangeDetect($text, '(', ')', 0, 0, undef, 0, '#stay', 'String')) {
2273 0         0 return 1
2274             }
2275             # attribute => 'Operator'
2276             # char => ')'
2277             # context => '#pop#pop'
2278             # endRegion => 'String'
2279             # type => 'DetectChar'
2280 0 0       0 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop#pop', 'Operator')) {
2281 0         0 return 1
2282             }
2283 0         0 return 0;
2284             };
2285              
2286             sub parsestring_3 {
2287 0     0 0 0 my ($self, $text) = @_;
2288             # type => 'DetectIdentifier'
2289 0 0       0 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
2290 0         0 return 1
2291             }
2292             # attribute => 'String Special Character'
2293             # char => '\'
2294             # char1 => '}'
2295             # context => '#stay'
2296             # type => 'Detect2Chars'
2297 0 0       0 if ($self->testDetect2Chars($text, '\\', '}', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2298 0         0 return 1
2299             }
2300             # attribute => 'String Special Character'
2301             # char => '\'
2302             # char1 => '\'
2303             # context => '#stay'
2304             # type => 'Detect2Chars'
2305 0 0       0 if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2306 0         0 return 1
2307             }
2308             # attribute => 'String'
2309             # char => '{'
2310             # char1 => '}'
2311             # context => '#stay'
2312             # type => 'RangeDetect'
2313 0 0       0 if ($self->testRangeDetect($text, '{', '}', 0, 0, undef, 0, '#stay', 'String')) {
2314 0         0 return 1
2315             }
2316             # attribute => 'Operator'
2317             # char => '}'
2318             # context => '#pop#pop'
2319             # endRegion => 'String'
2320             # type => 'DetectChar'
2321 0 0       0 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop', 'Operator')) {
2322 0         0 return 1
2323             }
2324 0         0 return 0;
2325             };
2326              
2327             sub parsestring_4 {
2328 0     0 0 0 my ($self, $text) = @_;
2329             # type => 'DetectIdentifier'
2330 0 0       0 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
2331 0         0 return 1
2332             }
2333             # attribute => 'String Special Character'
2334             # char => '\'
2335             # char1 => ']'
2336             # context => '#stay'
2337             # type => 'Detect2Chars'
2338 0 0       0 if ($self->testDetect2Chars($text, '\\', ']', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2339 0         0 return 1
2340             }
2341             # attribute => 'String Special Character'
2342             # char => '\'
2343             # char1 => '\'
2344             # context => '#stay'
2345             # type => 'Detect2Chars'
2346 0 0       0 if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2347 0         0 return 1
2348             }
2349             # attribute => 'String'
2350             # char => '['
2351             # char1 => ']'
2352             # context => '#stay'
2353             # type => 'RangeDetect'
2354 0 0       0 if ($self->testRangeDetect($text, '[', ']', 0, 0, undef, 0, '#stay', 'String')) {
2355 0         0 return 1
2356             }
2357             # attribute => 'Operator'
2358             # char => ']'
2359             # context => '#pop#pop'
2360             # endRegion => 'String'
2361             # type => 'DetectChar'
2362 0 0       0 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop#pop', 'Operator')) {
2363 0         0 return 1
2364             }
2365 0         0 return 0;
2366             };
2367              
2368             sub parsestring_5 {
2369 0     0 0 0 my ($self, $text) = @_;
2370             # type => 'DetectIdentifier'
2371 0 0       0 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
2372 0         0 return 1
2373             }
2374             # attribute => 'String Special Character'
2375             # char => '\'
2376             # char1 => '<'
2377             # context => '#stay'
2378             # type => 'Detect2Chars'
2379 0 0       0 if ($self->testDetect2Chars($text, '\\', '<', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2380 0         0 return 1
2381             }
2382             # attribute => 'String Special Character'
2383             # char => '\'
2384             # char1 => '\'
2385             # context => '#stay'
2386             # type => 'Detect2Chars'
2387 0 0       0 if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2388 0         0 return 1
2389             }
2390             # attribute => 'String'
2391             # char => '\'
2392             # char1 => '>'
2393             # context => '#stay'
2394             # type => 'Detect2Chars'
2395 0 0       0 if ($self->testDetect2Chars($text, '\\', '>', 0, 0, 0, undef, 0, '#stay', 'String')) {
2396 0         0 return 1
2397             }
2398             # attribute => 'String'
2399             # char => '<'
2400             # char1 => '>'
2401             # context => '#stay'
2402             # type => 'RangeDetect'
2403 0 0       0 if ($self->testRangeDetect($text, '<', '>', 0, 0, undef, 0, '#stay', 'String')) {
2404 0         0 return 1
2405             }
2406             # attribute => 'Operator'
2407             # char => '>'
2408             # context => '#pop#pop'
2409             # endRegion => 'String'
2410             # type => 'DetectChar'
2411 0 0       0 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop', 'Operator')) {
2412 0         0 return 1
2413             }
2414 0         0 return 0;
2415             };
2416              
2417             sub parsestring_6 {
2418 16     16 0 1413 my ($self, $text) = @_;
2419             # type => 'DetectIdentifier'
2420 16 100       64 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
2421 2         8 return 1
2422             }
2423             # attribute => 'String Special Character'
2424             # char => '\'
2425             # char1 => '\'
2426             # context => '#stay'
2427             # type => 'Detect2Chars'
2428 14 50       55 if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'String Special Character')) {
2429 0         0 return 1
2430             }
2431             # String => '\\%1'
2432             # attribute => 'String Special Character'
2433             # context => '#stay'
2434             # dynamic => 'true'
2435             # type => 'RegExpr'
2436 14 50       54 if ($self->testRegExpr($text, '\\\\%1', 0, 1, 0, undef, 0, '#stay', 'String Special Character')) {
2437 0         0 return 1
2438             }
2439             # attribute => 'Operator'
2440             # char => '1'
2441             # context => '#pop#pop'
2442             # dynamic => 'true'
2443             # endRegion => 'String'
2444             # type => 'DetectChar'
2445 14 100       56 if ($self->testDetectChar($text, '1', 0, 1, 0, undef, 0, '#pop#pop', 'Operator')) {
2446 2         10 return 1
2447             }
2448 12         36 return 0;
2449             };
2450              
2451             sub parsesub_arg_definition {
2452 6     6 0 15 my ($self, $text) = @_;
2453             # String => '*$@%'
2454             # attribute => 'Data Type'
2455             # context => '#stay'
2456             # type => 'AnyChar'
2457 6 100       27 if ($self->testAnyChar($text, '*$@%', 0, 0, undef, 0, '#stay', 'Data Type')) {
2458 2         7 return 1
2459             }
2460             # String => '&\[];'
2461             # attribute => 'Normal Text'
2462             # context => '#stay'
2463             # type => 'AnyChar'
2464 4 50       16 if ($self->testAnyChar($text, '&\\[];', 0, 0, undef, 0, '#stay', 'Normal Text')) {
2465 0         0 return 1
2466             }
2467             # attribute => 'Normal Text'
2468             # char => ')'
2469             # context => 'slash_safe_escape'
2470             # type => 'DetectChar'
2471 4 100       20 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, 'slash_safe_escape', 'Normal Text')) {
2472 2         9 return 1
2473             }
2474 2         7 return 0;
2475             };
2476              
2477             sub parsesub_name_def {
2478 187     187 0 467 my ($self, $text) = @_;
2479             # String => '\w+'
2480             # attribute => 'Function'
2481             # context => '#stay'
2482             # type => 'RegExpr'
2483 187 100       639 if ($self->testRegExpr($text, '\\w+', 0, 0, 0, undef, 0, '#stay', 'Function')) {
2484 93         316 return 1
2485             }
2486             # String => '\$\S'
2487             # attribute => 'Normal Text'
2488             # context => 'find_variable'
2489             # lookAhead => 'true'
2490             # type => 'RegExpr'
2491 94 50       391 if ($self->testRegExpr($text, '\\$\\S', 0, 0, 1, undef, 0, 'find_variable', 'Normal Text')) {
2492 0         0 return 1
2493             }
2494             # String => '\s*\('
2495             # attribute => 'Normal Text'
2496             # context => 'sub_arg_definition'
2497             # type => 'RegExpr'
2498 94 100       382 if ($self->testRegExpr($text, '\\s*\\(', 0, 0, 0, undef, 0, 'sub_arg_definition', 'Normal Text')) {
2499 2         8 return 1
2500             }
2501             # attribute => 'Normal Text'
2502             # char => ':'
2503             # char1 => ':'
2504             # context => '#stay'
2505             # type => 'Detect2Chars'
2506 92 100       465 if ($self->testDetect2Chars($text, ':', ':', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
2507 5         14 return 1
2508             }
2509 87         249 return 0;
2510             };
2511              
2512             sub parsesubst_bracket_pattern {
2513 0     0 0 0 my ($self, $text) = @_;
2514             # String => '\s+#.*$'
2515             # attribute => 'Comment'
2516             # context => '#stay'
2517             # type => 'RegExpr'
2518 0 0       0 if ($self->testRegExpr($text, '\\s+#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
2519 0         0 return 1
2520             }
2521             # context => 'regex_pattern_internal_ip'
2522             # type => 'IncludeRules'
2523 0 0       0 if ($self->includeRules('regex_pattern_internal_ip', $text)) {
2524 0         0 return 1
2525             }
2526             # attribute => 'Operator'
2527             # char => ']'
2528             # context => 'subst_bracket_replace'
2529             # endRegion => 'Pattern'
2530             # type => 'DetectChar'
2531 0 0       0 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, 'subst_bracket_replace', 'Operator')) {
2532 0         0 return 1
2533             }
2534 0         0 return 0;
2535             };
2536              
2537             sub parsesubst_bracket_replace {
2538 0     0 0 0 my ($self, $text) = @_;
2539             # context => 'ipstring_internal'
2540             # type => 'IncludeRules'
2541 0 0       0 if ($self->includeRules('ipstring_internal', $text)) {
2542 0         0 return 1
2543             }
2544             # attribute => 'Operator'
2545             # beginRegion => 'Replacement'
2546             # char => '['
2547             # context => '#stay'
2548             # type => 'DetectChar'
2549 0 0       0 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, '#stay', 'Operator')) {
2550 0         0 return 1
2551             }
2552             # String => '\][cegimosx]*'
2553             # attribute => 'Operator'
2554             # context => '#pop#pop#pop'
2555             # endRegion => 'Replacement'
2556             # type => 'RegExpr'
2557 0 0       0 if ($self->testRegExpr($text, '\\][cegimosx]*', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
2558 0         0 return 1
2559             }
2560 0         0 return 0;
2561             };
2562              
2563             sub parsesubst_curlybrace_middle {
2564 0     0 0 0 my ($self, $text) = @_;
2565             # String => '#.*$'
2566             # attribute => 'Comment'
2567             # context => '#stay'
2568             # type => 'RegExpr'
2569 0 0       0 if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
2570 0         0 return 1
2571             }
2572             # attribute => 'Operator'
2573             # beginRegion => 'Replacement'
2574             # char => '{'
2575             # context => 'subst_curlybrace_replace'
2576             # type => 'DetectChar'
2577 0 0       0 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'subst_curlybrace_replace', 'Operator')) {
2578 0         0 return 1
2579             }
2580 0         0 return 0;
2581             };
2582              
2583             sub parsesubst_curlybrace_pattern {
2584 0     0 0 0 my ($self, $text) = @_;
2585             # String => '\s+#.*$'
2586             # attribute => 'Comment'
2587             # context => '#stay'
2588             # type => 'RegExpr'
2589 0 0       0 if ($self->testRegExpr($text, '\\s+#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
2590 0         0 return 1
2591             }
2592             # context => 'regex_pattern_internal_ip'
2593             # type => 'IncludeRules'
2594 0 0       0 if ($self->includeRules('regex_pattern_internal_ip', $text)) {
2595 0         0 return 1
2596             }
2597             # attribute => 'Operator'
2598             # char => '}'
2599             # context => 'subst_curlybrace_middle'
2600             # endRegion => 'Pattern'
2601             # type => 'DetectChar'
2602 0 0       0 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, 'subst_curlybrace_middle', 'Operator')) {
2603 0         0 return 1
2604             }
2605 0         0 return 0;
2606             };
2607              
2608             sub parsesubst_curlybrace_replace {
2609 0     0 0 0 my ($self, $text) = @_;
2610             # context => 'ipstring_internal'
2611             # type => 'IncludeRules'
2612 0 0       0 if ($self->includeRules('ipstring_internal', $text)) {
2613 0         0 return 1
2614             }
2615             # attribute => 'Normal Text'
2616             # beginRegion => 'Block'
2617             # char => '{'
2618             # context => 'subst_curlybrace_replace_recursive'
2619             # type => 'DetectChar'
2620 0 0       0 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'subst_curlybrace_replace_recursive', 'Normal Text')) {
2621 0         0 return 1
2622             }
2623             # String => '\}[cegimosx]*'
2624             # attribute => 'Operator'
2625             # context => '#pop#pop#pop#pop'
2626             # endRegion => 'Replacement'
2627             # type => 'RegExpr'
2628 0 0       0 if ($self->testRegExpr($text, '\\}[cegimosx]*', 0, 0, 0, undef, 0, '#pop#pop#pop#pop', 'Operator')) {
2629 0         0 return 1
2630             }
2631 0         0 return 0;
2632             };
2633              
2634             sub parsesubst_curlybrace_replace_recursive {
2635 0     0 0 0 my ($self, $text) = @_;
2636             # attribute => 'String (interpolated)'
2637             # beginRegion => 'Block'
2638             # char => '{'
2639             # context => 'subst_curlybrace_replace_recursive'
2640             # type => 'DetectChar'
2641 0 0       0 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'subst_curlybrace_replace_recursive', 'String (interpolated)')) {
2642 0         0 return 1
2643             }
2644             # attribute => 'Normal Text'
2645             # char => '}'
2646             # context => '#pop'
2647             # endRegion => 'Block'
2648             # type => 'DetectChar'
2649 0 0       0 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
2650 0         0 return 1
2651             }
2652             # context => 'ipstring_internal'
2653             # type => 'IncludeRules'
2654 0 0       0 if ($self->includeRules('ipstring_internal', $text)) {
2655 0         0 return 1
2656             }
2657 0         0 return 0;
2658             };
2659              
2660             sub parsesubst_paren_pattern {
2661 0     0 0 0 my ($self, $text) = @_;
2662             # String => '\s+#.*$'
2663             # attribute => 'Comment'
2664             # context => '#stay'
2665             # type => 'RegExpr'
2666 0 0       0 if ($self->testRegExpr($text, '\\s+#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
2667 0         0 return 1
2668             }
2669             # context => 'regex_pattern_internal_ip'
2670             # type => 'IncludeRules'
2671 0 0       0 if ($self->includeRules('regex_pattern_internal_ip', $text)) {
2672 0         0 return 1
2673             }
2674             # attribute => 'Operator'
2675             # char => '}'
2676             # context => 'subst_paren_replace'
2677             # endRegion => 'Pattern'
2678             # type => 'DetectChar'
2679 0 0       0 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, 'subst_paren_replace', 'Operator')) {
2680 0         0 return 1
2681             }
2682 0         0 return 0;
2683             };
2684              
2685             sub parsesubst_paren_replace {
2686 0     0 0 0 my ($self, $text) = @_;
2687             # context => 'ipstring_internal'
2688             # type => 'IncludeRules'
2689 0 0       0 if ($self->includeRules('ipstring_internal', $text)) {
2690 0         0 return 1
2691             }
2692             # attribute => 'Operator'
2693             # beginRegion => 'Replacement'
2694             # char => '('
2695             # context => '#stay'
2696             # type => 'DetectChar'
2697 0 0       0 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, '#stay', 'Operator')) {
2698 0         0 return 1
2699             }
2700             # String => '\)[cegimosx]*'
2701             # attribute => 'Operator'
2702             # context => '#pop#pop#pop'
2703             # endRegion => 'Replacement'
2704             # type => 'RegExpr'
2705 0 0       0 if ($self->testRegExpr($text, '\\)[cegimosx]*', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
2706 0         0 return 1
2707             }
2708 0         0 return 0;
2709             };
2710              
2711             sub parsesubst_slash_pattern {
2712 103     103 0 235 my ($self, $text) = @_;
2713             # String => '\$(?=%1)'
2714             # attribute => 'Pattern Internal Operator'
2715             # context => '#stay'
2716             # dynamic => 'true'
2717             # type => 'RegExpr'
2718 103 100       341 if ($self->testRegExpr($text, '\\$(?=%1)', 0, 1, 0, undef, 0, '#stay', 'Pattern Internal Operator')) {
2719 1         3 return 1
2720             }
2721             # String => '(%1)'
2722             # attribute => 'Operator'
2723             # beginRegion => 'Replacement'
2724             # context => 'subst_slash_replace'
2725             # dynamic => 'true'
2726             # endRegion => 'Pattern'
2727             # type => 'RegExpr'
2728 102 100       405 if ($self->testRegExpr($text, '(%1)', 0, 1, 0, undef, 0, 'subst_slash_replace', 'Operator')) {
2729 26         78 return 1
2730             }
2731             # context => 'regex_pattern_internal_ip'
2732             # type => 'IncludeRules'
2733 76 100       312 if ($self->includeRules('regex_pattern_internal_ip', $text)) {
2734 47         132 return 1
2735             }
2736 29         100 return 0;
2737             };
2738              
2739             sub parsesubst_slash_replace {
2740 44     44 0 104 my ($self, $text) = @_;
2741             # context => 'ipstring_internal'
2742             # type => 'IncludeRules'
2743 44 100       136 if ($self->includeRules('ipstring_internal', $text)) {
2744 12         33 return 1
2745             }
2746             # String => '%1[cegimosx]*'
2747             # attribute => 'Operator'
2748             # context => '#pop#pop#pop'
2749             # dynamic => 'true'
2750             # endRegion => 'Replacement'
2751             # type => 'RegExpr'
2752 32 100       140 if ($self->testRegExpr($text, '%1[cegimosx]*', 0, 1, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
2753 26         76 return 1
2754             }
2755 6         16 return 0;
2756             };
2757              
2758             sub parsesubst_sq_pattern {
2759 0     0 0 0 my ($self, $text) = @_;
2760             # String => '\s+#.*$'
2761             # attribute => 'Comment'
2762             # context => '#stay'
2763             # type => 'RegExpr'
2764 0 0       0 if ($self->testRegExpr($text, '\\s+#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
2765 0         0 return 1
2766             }
2767             # context => 'regex_pattern_internal'
2768             # type => 'IncludeRules'
2769 0 0       0 if ($self->includeRules('regex_pattern_internal', $text)) {
2770 0         0 return 1
2771             }
2772             # attribute => 'Operator'
2773             # beginRegion => 'Pattern'
2774             # char => '''
2775             # context => 'subst_sq_replace'
2776             # endRegion => 'Pattern'
2777             # type => 'DetectChar'
2778 0 0       0 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'subst_sq_replace', 'Operator')) {
2779 0         0 return 1
2780             }
2781 0         0 return 0;
2782             };
2783              
2784             sub parsesubst_sq_replace {
2785 0     0 0 0 my ($self, $text) = @_;
2786             # String => ''[cegimosx]*'
2787             # attribute => 'Operator'
2788             # context => '#pop#pop#pop'
2789             # endRegion => 'Replacement'
2790             # type => 'RegExpr'
2791 0 0       0 if ($self->testRegExpr($text, '\'[cegimosx]*', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Operator')) {
2792 0         0 return 1
2793             }
2794 0         0 return 0;
2795             };
2796              
2797             sub parsetr {
2798 2     2 0 7 my ($self, $text) = @_;
2799             # String => '\([^)]*\)\s*\(?:[^)]*\)'
2800             # attribute => 'Pattern'
2801             # context => '#pop'
2802             # type => 'RegExpr'
2803 2 50       10 if ($self->testRegExpr($text, '\\([^)]*\\)\\s*\\(?:[^)]*\\)', 0, 0, 0, undef, 0, '#pop', 'Pattern')) {
2804 0         0 return 1
2805             }
2806             # String => '\{[^}]*\}\s*\{[^}]*\}'
2807             # attribute => 'Pattern'
2808             # context => '#pop'
2809             # type => 'RegExpr'
2810 2 50       12 if ($self->testRegExpr($text, '\\{[^}]*\\}\\s*\\{[^}]*\\}', 0, 0, 0, undef, 0, '#pop', 'Pattern')) {
2811 0         0 return 1
2812             }
2813             # String => '\[[^}]*\]\s*\[[^\]]*\]'
2814             # attribute => 'Pattern'
2815             # context => '#pop'
2816             # type => 'RegExpr'
2817 2 50       10 if ($self->testRegExpr($text, '\\[[^}]*\\]\\s*\\[[^\\]]*\\]', 0, 0, 0, undef, 0, '#pop', 'Pattern')) {
2818 0         0 return 1
2819             }
2820             # String => '([^a-zA-Z0-9_\s[\]{}()]).*\1.*\1'
2821             # attribute => 'Pattern'
2822             # context => '#pop'
2823             # minimal => 'true'
2824             # type => 'RegExpr'
2825 2 50       12 if ($self->testRegExpr($text, '([^a-zA-Z0-9_\\s[\\]{}()]).*?\\1.*?\\1', 0, 0, 0, undef, 0, '#pop', 'Pattern')) {
2826 0         0 return 1
2827             }
2828 2         7 return 0;
2829             };
2830              
2831             sub parsevar_detect {
2832 2541     2541 0 8325 my ($self, $text) = @_;
2833             # context => 'var_detect_rules'
2834             # type => 'IncludeRules'
2835 2541 100       8742 if ($self->includeRules('var_detect_rules', $text)) {
2836 1457         4115 return 1
2837             }
2838             # context => 'slash_safe_escape'
2839             # type => 'IncludeRules'
2840 1084 100       3137 if ($self->includeRules('slash_safe_escape', $text)) {
2841 2         7 return 1
2842             }
2843 1082         3325 return 0;
2844             };
2845              
2846             sub parsevar_detect_rules {
2847 2612     2612 0 5546 my ($self, $text) = @_;
2848             # String => '[\w_]+'
2849             # attribute => 'Data Type'
2850             # context => '#stay'
2851             # type => 'RegExpr'
2852 2612 100       8864 if ($self->testRegExpr($text, '[\\w_]+', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
2853 1230         5773 return 1
2854             }
2855             # attribute => 'Normal Text'
2856             # char => ':'
2857             # char1 => ':'
2858             # context => '#stay'
2859             # type => 'Detect2Chars'
2860 1382 100       6186 if ($self->testDetect2Chars($text, ':', ':', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
2861 1         5 return 1
2862             }
2863             # attribute => 'Operator'
2864             # char => '''
2865             # context => '#stay'
2866             # type => 'DetectChar'
2867 1381 100       5085 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#stay', 'Operator')) {
2868 7         31 return 1
2869             }
2870             # attribute => 'Normal Text'
2871             # char => '-'
2872             # char1 => '>'
2873             # context => '#stay'
2874             # type => 'Detect2Chars'
2875 1374 100       4760 if ($self->testDetect2Chars($text, '-', '>', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
2876 256         1150 return 1
2877             }
2878             # attribute => 'Normal Text'
2879             # char => '+'
2880             # char1 => '+'
2881             # context => '#stay'
2882             # type => 'Detect2Chars'
2883 1118 50       4029 if ($self->testDetect2Chars($text, '+', '+', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
2884 0         0 return 1
2885             }
2886             # attribute => 'Normal Text'
2887             # char => '-'
2888             # char1 => '-'
2889             # context => '#stay'
2890             # type => 'Detect2Chars'
2891 1118 50       3822 if ($self->testDetect2Chars($text, '-', '-', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
2892 0         0 return 1
2893             }
2894 1118         4604 return 0;
2895             };
2896              
2897             sub parsevar_detect_unsafe {
2898 71     71 0 152 my ($self, $text) = @_;
2899             # context => 'var_detect_rules'
2900             # type => 'IncludeRules'
2901 71 100       203 if ($self->includeRules('var_detect_rules', $text)) {
2902 37         96 return 1
2903             }
2904 34         78 return 0;
2905             };
2906              
2907              
2908             1;
2909              
2910             __END__