From ee049595816cc0c5742d9523802345ad4121619f Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 13 Sep 2023 08:10:47 +0200 Subject: Rename the "strings" section to "bytes". --- src/analysis/scan/grammar.y | 10 +++++----- src/analysis/scan/tokens.l | 36 +++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/analysis/scan/grammar.y b/src/analysis/scan/grammar.y index 9ee0f28..25bb536 100644 --- a/src/analysis/scan/grammar.y +++ b/src/analysis/scan/grammar.y @@ -121,7 +121,7 @@ YY_DECL; %token RULE_NAME %token META "meta" -%token STRINGS "strings" +%token BYTES "bytes" %token CONDITION "condition" %token INFO_KEY @@ -350,7 +350,7 @@ YY_DECL; *built_rule = g_scan_rule_new($2.data); $$ = *built_rule; } - BRACE_IN meta strings condition BRACE_OUT + BRACE_IN meta bytes condition BRACE_OUT { $$ = $3; } @@ -383,9 +383,9 @@ YY_DECL; * Section "bytes:" d'une définition de règle. */ - strings : /* empty */ - | STRINGS COLON - | STRINGS COLON bytes_decls + bytes : /* empty */ + | "bytes" ":" + | "bytes" ":" bytes_decls ; bytes_decls : str_pattern diff --git a/src/analysis/scan/tokens.l b/src/analysis/scan/tokens.l index 92cc858..241c973 100644 --- a/src/analysis/scan/tokens.l +++ b/src/analysis/scan/tokens.l @@ -330,7 +330,7 @@ static void rost_unescape_bytes(const char *src, size_t len, sized_string_t *out %x meta %x meta_value -%x strings +%x bytes %x bytes_value %x bytes_value_raw @@ -428,13 +428,15 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]* PUSH_STATE(wait_for_colon); return META; } - "strings" { + + "bytes" { POP_STATE; - PUSH_STATE(strings); + PUSH_STATE(bytes); PUSH_STATE(wait_for_colon); - return STRINGS; + return BYTES; } -"condition" { + + "condition" { POP_STATE; PUSH_STATE(condition); PUSH_STATE(wait_for_colon); @@ -446,7 +448,7 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]* return COLON; } -"}" { +"}" { POP_STATE; return BRACE_OUT; } @@ -566,11 +568,11 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]* %{ /* Définitions communes pour la section "bytes:" */ %} -"fullword" { return FULLWORD; } -"nocase" { return NOCASE; } -"private" { return PRIVATE; } + "fullword" { return FULLWORD; } + "nocase" { return NOCASE; } + "private" { return PRIVATE; } -"=" { PUSH_STATE(bytes_value); return ASSIGN; } + "=" { PUSH_STATE(bytes_value); return ASSIGN; } %{ /* Définition de motif en texte brut */ %} @@ -805,7 +807,7 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]* %{ /* \[({regular_chars}|({regular_chars})-z|{reg_classes})+\] { */ %} - "[" { + "[" { PUSH_STATE(bytes_regex_range); printf(" !! entering range\n"); return HOOK_O; @@ -878,9 +880,9 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]* "/" { return DIV; } "%" { return MOD; } -"(" { return PAREN_O; } -")" { return PAREN_C; } -"," { return COMMA; } +"(" { return PAREN_O; } +")" { return PAREN_C; } +"," { return COMMA; } "[" { return HOOK_O; } @@ -888,7 +890,7 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]* "." { return DOT; } -"|" { return PIPE; } +"|" { return PIPE; } "none" { return NONE; } "any" { return ANY; } @@ -898,7 +900,7 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]* "in" { return IN; } - ${bytes_id} { + ${bytes_id} { yylval->sized_cstring.data = yytext + 1; yylval->sized_cstring.len = yyleng - 1; return BYTES_ID; @@ -939,7 +941,7 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]* -[A-Za-z_][A-Za-z0-9_]* { +[A-Za-z_][A-Za-z0-9_]* { yylval->sized_cstring.data = yytext; yylval->sized_cstring.len = yyleng; return NAME; -- cgit v0.11.2-87-g4458