summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/scan/grammar.y10
-rw-r--r--src/analysis/scan/tokens.l36
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);
$<rule>$ = *built_rule;
}
- BRACE_IN meta strings condition BRACE_OUT
+ BRACE_IN meta bytes condition BRACE_OUT
{
$$ = $<rule>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;
}
- <raw_block,meta>"strings" {
+
+ <raw_block,meta>"bytes" {
POP_STATE;
- PUSH_STATE(strings);
+ PUSH_STATE(bytes);
PUSH_STATE(wait_for_colon);
- return STRINGS;
+ return BYTES;
}
-<raw_block,meta,strings>"condition" {
+
+ <raw_block,meta,bytes>"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;
}
-<raw_block,meta,strings,condition>"}" {
+<raw_block,meta,bytes,condition>"}" {
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:" */ %}
-<strings>"fullword" { return FULLWORD; }
-<strings>"nocase" { return NOCASE; }
-<strings>"private" { return PRIVATE; }
+ <bytes>"fullword" { return FULLWORD; }
+ <bytes>"nocase" { return NOCASE; }
+ <bytes>"private" { return PRIVATE; }
-<strings>"=" { PUSH_STATE(bytes_value); return ASSIGN; }
+ <bytes>"=" { 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_]*
%{ /* <bytes_regex>\[({regular_chars}|({regular_chars})-z|{reg_classes})+\] { */ %}
- <bytes_regex>"[" {
+ <bytes_regex>"[" {
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_]*
<condition>"/" { return DIV; }
<condition>"%" { return MOD; }
-<strings,condition>"(" { return PAREN_O; }
-<strings,condition>")" { return PAREN_C; }
-<strings,condition>"," { return COMMA; }
+<bytes,condition>"(" { return PAREN_O; }
+<bytes,condition>")" { return PAREN_C; }
+<bytes,condition>"," { return COMMA; }
<condition>"[" { return HOOK_O; }
@@ -888,7 +890,7 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]*
<condition>"." { return DOT; }
-<strings>"|" { return PIPE; }
+<bytes>"|" { return PIPE; }
<condition>"none" { return NONE; }
<condition>"any" { return ANY; }
@@ -898,7 +900,7 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]*
<condition>"in" { return IN; }
- <strings,condition>${bytes_id} {
+ <bytes,condition>${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_]*
-<strings,condition>[A-Za-z_][A-Za-z0-9_]* {
+<bytes,condition>[A-Za-z_][A-Za-z0-9_]* {
yylval->sized_cstring.data = yytext;
yylval->sized_cstring.len = yyleng;
return NAME;