mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 21:48:21 +00:00
Add /s modifier to parser for patterns
This commit is contained in:
parent
14e48733ac
commit
36e31e28ac
2 changed files with 30 additions and 5 deletions
21
src/scan.l
21
src/scan.l
|
@ -562,13 +562,28 @@ F RET_CONST(zeek::val_mgr->False()->Ref())
|
|||
|
||||
<RE>"/" {
|
||||
BEGIN(INITIAL);
|
||||
yylval.b = false;
|
||||
yylval.re_modes.ignore_case = false;
|
||||
yylval.re_modes.single_line = false;
|
||||
return TOK_PATTERN_END;
|
||||
}
|
||||
|
||||
<RE>"/i" {
|
||||
<RE>(\/[is]{0,2}) {
|
||||
BEGIN(INITIAL);
|
||||
yylval.b = true;
|
||||
|
||||
if (strlen(yytext) == 2)
|
||||
{
|
||||
yylval.re_modes.ignore_case = (yytext[1] == 'i');
|
||||
yylval.re_modes.single_line = (yytext[1] == 's');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( yytext[1] == yytext[2] )
|
||||
zeek::reporter->Error("pattern has duplicate mode %c", yytext[1]);
|
||||
|
||||
yylval.re_modes.ignore_case = (yytext[1] == 'i' || yytext[2] == 'i');
|
||||
yylval.re_modes.single_line = (yytext[1] == 's' || yytext[2] == 's');
|
||||
}
|
||||
|
||||
return TOK_PATTERN_END;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue