summaryrefslogtreecommitdiff
path: root/src/analysis/scan/grammar.y
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-09-25 23:50:02 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-09-25 23:50:02 (GMT)
commit2f740fc8aa705df046a6d32fc98e2787df0e47e1 (patch)
tree5c348351ca39312cb5a54a5c88e95859fe0b7579 /src/analysis/scan/grammar.y
parent4c13ca820e4fa01ca62ad66c0665ebbee150f87c (diff)
Handle tags linked to ROST rules.
Diffstat (limited to 'src/analysis/scan/grammar.y')
-rw-r--r--src/analysis/scan/grammar.y23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/analysis/scan/grammar.y b/src/analysis/scan/grammar.y
index e1f0e9e..741b394 100644
--- a/src/analysis/scan/grammar.y
+++ b/src/analysis/scan/grammar.y
@@ -116,7 +116,7 @@ YY_DECL;
%token INCLUDE "include"
%token RAW_RULE
-%token RULE_NAME
+%token RULE_IDENTIFIER
%token META "meta"
%token BYTES "bytes"
@@ -216,7 +216,7 @@ YY_DECL;
%token IN "in"
-%type <sized_cstring> RULE_NAME
+%type <sized_cstring> RULE_IDENTIFIER
%type <sized_cstring> INFO_KEY
@@ -346,12 +346,12 @@ YY_DECL;
* Définition de règle.
*/
- rule : rule_flags RAW_RULE RULE_NAME
+ rule : rule_flags RAW_RULE RULE_IDENTIFIER
{
*built_rule = g_scan_rule_new($1, $3.data);
$<rule>$ = *built_rule;
}
- BRACE_IN meta bytes condition BRACE_OUT
+ tags BRACE_IN meta bytes condition BRACE_OUT
{
$$ = $<rule>4;
}
@@ -379,6 +379,21 @@ YY_DECL;
;
+ tags : /* empty */
+ | ":" tag_list
+ ;
+
+ tag_list : RULE_IDENTIFIER
+ {
+ g_scan_rule_add_tag(*built_rule, $1.data);
+ }
+ | tag_list RULE_IDENTIFIER
+ {
+ g_scan_rule_add_tag(*built_rule, $2.data);
+ }
+ ;
+
+
/**
* Section "meta:" d'une définition de règle.
*/