summaryrefslogtreecommitdiff
path: root/src/analysis/scan/tokens.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/scan/tokens.l')
-rw-r--r--src/analysis/scan/tokens.l40
1 files changed, 33 insertions, 7 deletions
diff --git a/src/analysis/scan/tokens.l b/src/analysis/scan/tokens.l
index b541786..f3dbc79 100644
--- a/src/analysis/scan/tokens.l
+++ b/src/analysis/scan/tokens.l
@@ -82,6 +82,7 @@
%option yylineno
%option never-interactive
+%x include_path
%x rule_intro
%x raw_block
@@ -105,6 +106,14 @@
+"include" { PUSH_STATE(include_path); return INCLUDE; }
+
+<include_path>"\"" {
+ POP_STATE;
+ *used = 0;
+ PUSH_STATE(strlit);
+ }
+
"rule" { PUSH_STATE(rule_intro); return RAW_RULE; }
<rule_intro>[A-Za-z0-9_]+ {
@@ -116,8 +125,8 @@
<rule_intro>[ \t]* { }
<rule_intro>"{" { POP_STATE; PUSH_STATE(raw_block); return BRACE_IN; }
-<raw_block>"strings" { PUSH_STATE(strings); PUSH_STATE(wait_for_colon); return STRINGS; }
-<raw_block,strings>"condition" { PUSH_STATE(condition); PUSH_STATE(wait_for_colon); return CONDITION; }
+<raw_block>"strings" { POP_STATE; PUSH_STATE(strings); PUSH_STATE(wait_for_colon); return STRINGS; }
+<raw_block,strings>"condition" { POP_STATE; PUSH_STATE(condition); PUSH_STATE(wait_for_colon); return CONDITION; }
@@ -127,8 +136,11 @@
<condition>"true" { return TRUE_; }
<condition>"false" { return FALSE_; }
-<condition>(0|[1-9][0-9]*) { yylval->integer = strtoull(yytext, NULL, 10); return INTEGER; }
-<condition>0x[0-9a-f]+ { yylval->integer = strtoull(yytext, NULL, 16); return INTEGER; }
+<condition>-(0|[1-9][0-9]*) { yylval->signed_integer = strtoll(yytext, NULL, 10); return SIGNED_INTEGER; }
+<condition>-0x[0-9a-f]+ { yylval->signed_integer = strtoll(yytext, NULL, 16); return SIGNED_INTEGER; }
+
+<condition>(0|[1-9][0-9]*) { yylval->unsigned_integer = strtoull(yytext, NULL, 10); return UNSIGNED_INTEGER; }
+<condition>0x[0-9a-f]+ { yylval->unsigned_integer = strtoull(yytext, NULL, 16); return UNSIGNED_INTEGER; }
<condition>[kK][bB] { return KB; }
<condition>[mM][bB] { return MB; }
@@ -141,8 +153,6 @@
<strlit>"\"" {
POP_STATE;
- EXTEND_BUFFER_IF_NEEDED(1);
- (*buf)[(*used)++] = '\0';
yylval->sized_cstring.data = *buf;
yylval->sized_cstring.len = *used;
return STRING;
@@ -195,7 +205,7 @@
<condition>"+" { return PLUS; }
<condition>"-" { return MINUS; }
<condition>"*" { return MUL; }
-<condition>"\\" { return DIV; }
+<condition>"/" { return DIV; }
<condition>"%" { return MOD; }
<condition>"(" { return PAREN_O; }
@@ -208,6 +218,7 @@
<condition>"all" { return ALL; }
<condition>"of" { return OF; }
<condition>"them" { return THEM; }
+<condition>"in" { return IN; }
<strings,condition>$[A-Za-z0-9_]* {
@@ -215,6 +226,21 @@
yylval->sized_cstring.len = yyleng - 1;
return IDENTIFIER;
}
+
+<condition>$[A-Za-z_][A-Za-z0-9_]* {
+ yylval->sized_cstring.data = yytext + 1;
+ yylval->sized_cstring.len = yyleng - 1;
+ return BYTES_ID;
+ }
+
+<condition>#[A-Za-z_][A-Za-z0-9_]* {
+ yylval->sized_cstring.data = yytext + 1;
+ yylval->sized_cstring.len = yyleng - 1;
+ return BYTES_ID_COUNTER;
+ }
+
+
+
<condition>[A-Za-z_][A-Za-z0-9_]* {
yylval->sized_cstring.data = yytext;
yylval->sized_cstring.len = yyleng;