diff --git a/parser/parser_lex.l b/parser/parser_lex.l index 83812fc28..3f4af79a5 100644 --- a/parser/parser_lex.l +++ b/parser/parser_lex.l @@ -192,7 +192,6 @@ QUOTED_ID \"{ALLOWED_QUOTED_ID}*\" IP {NUMBER}\.{NUMBER}\.{NUMBER}\.{NUMBER} -FLAGS flags{WS}*=?{WS}* HAT hat{WS}* PROFILE profile{WS}* KEYWORD [[:alpha:]_]+ @@ -254,6 +253,19 @@ LT_EQUAL <= if ( !YY_CURRENT_BUFFER ) yyterminate(); } +{VARIABLE_NAME}/{WS}*={WS}* { + /* we match to the = in the lexer so that + * can switch scanner state. By the time + * the parser see the = it may be to late + * as bison may have requested the next + * token from the scanner + */ + PDEBUG("conditional %s=\n", yytext); + yylval.id = processid(yytext, yyleng); + yy_push_state(EXTCOND_MODE); + return TOK_CONDID; + } + { ({IDS}|{QUOTED_ID}) { /* Ugh, this is a gross hack. I used to use @@ -535,11 +547,6 @@ LT_EQUAL <= return TOK_MODE; } -{FLAGS} { - DUMP_PREPROCESS; - return TOK_FLAGS; - } - {HAT} { DUMP_PREPROCESS; yy_push_state(SUB_NAME); @@ -565,18 +572,6 @@ LT_EQUAL <= return TOK_OPENPAREN; } -{VARIABLE_NAME}/{WS}*={WS}* { - /* we match to the = in the lexer so that - * can switch scanner state. By the time - * the parser see the = it may be to late - * as bison may have requested the next - * token from the scanner - */ - yylval.id = processid(yytext, yyleng); - yy_push_state(EXTCOND_MODE); - return TOK_CONDID; - } - {VARIABLE_NAME} { DUMP_PREPROCESS; int token = get_keyword_token(yytext); diff --git a/parser/parser_yacc.y b/parser/parser_yacc.y index 516cf57d4..af56a2013 100644 --- a/parser/parser_yacc.y +++ b/parser/parser_yacc.y @@ -162,6 +162,7 @@ void add_local_entry(struct codomain *cod); } %type TOK_ID +%type TOK_CONDID %type TOK_MODE %type file_mode %type profile_base @@ -398,7 +399,12 @@ flags: { /* nothing */ }; opt_flags: { /* nothing */ $$ = 0; } - | TOK_FLAGS { $$ = 1; } + | TOK_CONDID TOK_EQUALS + { + if (strcmp($1, "flags") != 0) + yyerror("expected flags= got %s=", $1); + $$ = 1; + } flags: opt_flags TOK_OPENPAREN flagvals TOK_CLOSEPAREN {