Kate/Perl6.pm untested

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