summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analysis/scan/Makefile.am2
-rw-r--r--src/analysis/scan/tokens.l157
2 files changed, 158 insertions, 1 deletions
diff --git a/src/analysis/scan/Makefile.am b/src/analysis/scan/Makefile.am
index ed4f8c7..f7e85ad 100644
--- a/src/analysis/scan/Makefile.am
+++ b/src/analysis/scan/Makefile.am
@@ -8,7 +8,7 @@ BUILT_SOURCES = grammar.h
AM_YFLAGS = -v -d -p rost_ -Wno-yacc -Wcounterexamples
-AM_LFLAGS = -P rost_ -o lex.yy.c --header-file=tokens.h \
+AM_LFLAGS = -b -Cf -P rost_ -o lex.yy.c --header-file=tokens.h \
-Dyyget_lineno=rost_get_lineno \
-Dyy_scan_bytes=rost__scan_bytes \
-Dyy_delete_buffer=rost__delete_buffer
diff --git a/src/analysis/scan/tokens.l b/src/analysis/scan/tokens.l
index 0dff9f4..86e3e92 100644
--- a/src/analysis/scan/tokens.l
+++ b/src/analysis/scan/tokens.l
@@ -297,6 +297,26 @@ static void rost_unescape_bytes(const char *src, size_t len, sized_string_t *out
#define POP_STATE yy_pop_state(yyscanner)
+#define STOP_LEXER(msg, fbmsg) \
+ do \
+ { \
+ char *__text; \
+ int __ret; \
+ __ret = asprintf(&__text, "%s: '%s'", msg, yytext); \
+ if (__ret == -1) \
+ YY_FATAL_ERROR(fbmsg); \
+ else \
+ { \
+ YY_FATAL_ERROR(__text); \
+ free(__text); \
+ } \
+ } \
+ while (0)
+
+#define HANDLE_UNCOMPLETED_TOKEN \
+ STOP_LEXER("Uncompleted token in rule definition", "Undisclosed uncompleted token in rule definition")
+
+
%}
@@ -994,6 +1014,143 @@ bytes_fuzzy_id [\*A-Za-z_][\*A-Za-z0-9_]*
<*>"//"[^\n]* { }
+%{ /* Suppression du besoin de sauvegardes pour retours en arrière */ %}
+
+"i" { HANDLE_UNCOMPLETED_TOKEN; }
+"in" { HANDLE_UNCOMPLETED_TOKEN; }
+"inc" { HANDLE_UNCOMPLETED_TOKEN; }
+"incl" { HANDLE_UNCOMPLETED_TOKEN; }
+"inclu" { HANDLE_UNCOMPLETED_TOKEN; }
+"includ" { HANDLE_UNCOMPLETED_TOKEN; }
+
+<inc_path>\" { HANDLE_UNCOMPLETED_TOKEN; }
+<inc_path>\"{str_not_escaped}+ { HANDLE_UNCOMPLETED_TOKEN; }
+
+<inc_path>\"\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<inc_path>\"\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<inc_path>\"\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+<inc_path>\"{str_mixed}+ { HANDLE_UNCOMPLETED_TOKEN; }
+<inc_path>\"{str_mixed}+\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<inc_path>\"{str_mixed}+\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<inc_path>\"{str_mixed}+\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+
+"g" { HANDLE_UNCOMPLETED_TOKEN; }
+"gl" { HANDLE_UNCOMPLETED_TOKEN; }
+"glo" { HANDLE_UNCOMPLETED_TOKEN; }
+"glob" { HANDLE_UNCOMPLETED_TOKEN; }
+"globa" { HANDLE_UNCOMPLETED_TOKEN; }
+
+"p" { HANDLE_UNCOMPLETED_TOKEN; }
+"pr" { HANDLE_UNCOMPLETED_TOKEN; }
+"pri" { HANDLE_UNCOMPLETED_TOKEN; }
+"priv" { HANDLE_UNCOMPLETED_TOKEN; }
+"priva" { HANDLE_UNCOMPLETED_TOKEN; }
+"privat" { HANDLE_UNCOMPLETED_TOKEN; }
+
+"r" { HANDLE_UNCOMPLETED_TOKEN; }
+"ru" { HANDLE_UNCOMPLETED_TOKEN; }
+"rul" { HANDLE_UNCOMPLETED_TOKEN; }
+
+<raw_block>"m" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block>"me" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block>"met" { HANDLE_UNCOMPLETED_TOKEN; }
+
+<raw_block,meta>"b" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta>"by" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta>"byt" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta>"byte" { HANDLE_UNCOMPLETED_TOKEN; }
+
+<raw_block,meta,bytes>"c" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta,bytes>"co" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta,bytes>"con" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta,bytes>"cond" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta,bytes>"condi" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta,bytes>"condit" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta,bytes>"conditi" { HANDLE_UNCOMPLETED_TOKEN; }
+<raw_block,meta,bytes>"conditio" { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<meta_value>"t" { HANDLE_UNCOMPLETED_TOKEN; }
+<meta_value>"tr" { HANDLE_UNCOMPLETED_TOKEN; }
+<meta_value>"tru" { HANDLE_UNCOMPLETED_TOKEN; }
+
+<meta_value>"f" { HANDLE_UNCOMPLETED_TOKEN; }
+<meta_value>"fa" { HANDLE_UNCOMPLETED_TOKEN; }
+<meta_value>"fal" { HANDLE_UNCOMPLETED_TOKEN; }
+<meta_value>"fals" { HANDLE_UNCOMPLETED_TOKEN; }
+
+<meta_value>-0x { HANDLE_UNCOMPLETED_TOKEN; }
+
+<meta_value>0x { HANDLE_UNCOMPLETED_TOKEN; }
+
+<meta_value>\"{str_mixed}* { HANDLE_UNCOMPLETED_TOKEN; }
+<meta_value>\"{str_mixed}*\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<meta_value>\"{str_mixed}*\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<meta_value>\"{str_mixed}*\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<condition>-0x { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<bytes_hex_range,bytes_regex_quantifier,condition>0x { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<condition>\"{str_not_escaped}* { HANDLE_UNCOMPLETED_TOKEN; }
+
+<condition>\" { HANDLE_UNCOMPLETED_TOKEN; }
+<condition>\"\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<condition>\"\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<condition>\"\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+<condition>\"{str_mixed}+ { HANDLE_UNCOMPLETED_TOKEN; }
+<condition>\"{str_mixed}+\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<condition>\"{str_mixed}+\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<condition>\"{str_mixed}+\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<bytes_value>\" { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_value>\"\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_value>\"\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_value>\"\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_value>\"{str_mixed}+ { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_value>\"{str_mixed}+\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_value>\"{str_mixed}+\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_value>\"{str_mixed}+\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<bytes>\"{str_not_escaped}+ { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<bytes_hex>{hbyte}([ ]*{hbyte})*[ ]* { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_hex>{hbyte}([ ]*{hbyte})*[ ]*[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<bytes_hex>[\?]{2}([ ]*[\?]{2})*[ ]* { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_hex>[\?]{2}([ ]*[\?]{2})*[ ]*[\?] { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<bytes_hex>{mbyte}([ ]*{mbyte})*[ ]* { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_hex>{mbyte}([ ]*{mbyte})*[ ]*\? { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_hex>{mbyte}([ ]*{mbyte})*[ ]*[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<bytes_regex>\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_regex>\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_regex>\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_regex>({regular_chars})+\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_regex>({regular_chars})+\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_regex>({regular_chars})+\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+
+
+<bytes_regex>({reg_classes})+\\
+
+
+<bytes_regex_range>({regular_chars}|({regular_chars}-{regular_chars})|{reg_classes})+\\ { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_regex_range>({regular_chars}|({regular_chars}-{regular_chars})|{reg_classes})+\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_regex_range>({regular_chars}|({regular_chars}-{regular_chars})|{reg_classes})+\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_regex_range>\\x { HANDLE_UNCOMPLETED_TOKEN; }
+<bytes_regex_range>\\x[0-9a-fA-F] { HANDLE_UNCOMPLETED_TOKEN; }
+
+
%{ /* Actions par défaut */ %}
<*>[ \t]+ { }