diff --git a/parser/parser_lex.l b/parser/parser_lex.l index a0517d860..83812fc28 100644 --- a/parser/parser_lex.l +++ b/parser/parser_lex.l @@ -213,6 +213,7 @@ ARROW -> LT_EQUAL <= %x SUB_NAME +%x EXTCOND_MODE %x NETWORK_MODE %x LIST_VAL_MODE %x ASSIGN_MODE @@ -306,6 +307,34 @@ LT_EQUAL <= } } +{ + {WS}+ { DUMP_PREPROCESS; /* Eat whitespace */ } + + {EQUALS} { + DUMP_PREPROCESS; + return TOK_EQUALS; + } + + {OPEN_PAREN} { + DUMP_PREPROCESS; + PDEBUG("extcond listv\n"); + /* Don't push state here as this is a transition + * start condition and we want to return to the start + * condition that invoked when + * SUB_NAME is done + */ + BEGIN(LIST_VAL_MODE); + return TOK_OPENPAREN; + } + + [^\n] { + DUMP_PREPROCESS; + /* Something we didn't expect */ + yyerror(_("Found unexpected character: '%s'"), yytext); + } + +} + { {WS}+ { DUMP_PREPROCESS; /* Eat whitespace */ } @@ -536,6 +565,18 @@ 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 4e683214e..516cf57d4 100644 --- a/parser/parser_yacc.y +++ b/parser/parser_yacc.y @@ -78,6 +78,7 @@ void add_local_entry(struct codomain *cod); %} %token TOK_ID +%token TOK_CONDID %token TOK_CARET %token TOK_OPEN %token TOK_CLOSE