diff --git a/parser/parser.h b/parser/parser.h index 346620abf..7d71fd89a 100644 --- a/parser/parser.h +++ b/parser/parser.h @@ -25,6 +25,11 @@ #include "libapparmor_re/apparmor_re.h" #include "libapparmor_re/aare_rules.h" +/* Global variable to pass token to lexer. Will be replaced by parameter + * when lexer and parser are made reentrant + */ +extern int parser_token; + typedef enum pattern_t pattern_t; struct flagval { diff --git a/parser/parser_lex.l b/parser/parser_lex.l index a2c27da16..0c9323bd7 100644 --- a/parser/parser_lex.l +++ b/parser/parser_lex.l @@ -222,6 +222,15 @@ LT_EQUAL <= %% +%{ +/* Copied directly into yylex function */ + if (parser_token) { + int t = parser_token; + parser_token = 0; + return t; + } +%} + { {WS}+ { /* Eat whitespace */ } \<([^\> \t\n]+)\> { /* */ diff --git a/parser/parser_yacc.y b/parser/parser_yacc.y index af56a2013..aaf5f4d36 100644 --- a/parser/parser_yacc.y +++ b/parser/parser_yacc.y @@ -69,6 +69,8 @@ struct value_list { struct value_list *next; }; +int parser_token = 0; + void free_value_list(struct value_list *list); struct cod_entry *do_file_rule(char *namespace, char *id, int mode, char *link_id, char *nt);