diff options
Diffstat (limited to 'src/analysis/scan/grammar.y')
-rw-r--r-- | src/analysis/scan/grammar.y | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/analysis/scan/grammar.y b/src/analysis/scan/grammar.y index 25bb536..e1f0e9e 100644 --- a/src/analysis/scan/grammar.y +++ b/src/analysis/scan/grammar.y @@ -73,11 +73,9 @@ typedef void *yyscan_t; sized_string_t *tmp_masks; /* Masques associés */ } masked; - + ScanRuleFlags rule_flags; /* Fanions pour règle */ GScanRule *rule; /* Nouvelle règle à intégrer */ - - GScanTokenNode *node; /* Bribe de motif à intégrer */ GSearchPattern *pattern; /* Nouveau motif à considérer */ @@ -140,6 +138,7 @@ YY_DECL; %token NOCASE "nocase" %token FULLWORD "fullword" %token PRIVATE "private" +%token GLOBAL "global" %token HEX_BYTES @@ -234,6 +233,8 @@ YY_DECL; %type <unsigned_integer> UNSIGNED_INTEGER %type <sized_cstring> STRING +%type <rule_flags> rule_flags +%type <rule_flags> rule_flag %type <rule> rule %type <sized_cstring> PLAIN_TEXT @@ -345,14 +346,35 @@ YY_DECL; * Définition de règle. */ - rule : RAW_RULE RULE_NAME + rule : rule_flags RAW_RULE RULE_NAME { - *built_rule = g_scan_rule_new($2.data); + *built_rule = g_scan_rule_new($1, $3.data); $<rule>$ = *built_rule; } BRACE_IN meta bytes condition BRACE_OUT { - $$ = $<rule>3; + $$ = $<rule>4; + } + ; + + + rule_flags : /* empty */ + { + $$ = SRF_NONE; + } + | rule_flags rule_flag + { + $$ = $1 | $2; + } + ; + + rule_flag : "private" + { + $$ = SRF_PRIVATE; + } + | "global" + { + $$ = SRF_GLOBAL; } ; |