allows to remove 3 queue specific keywords from INITIAL scope. Signed-off-by: Florian Westphal <fw@xxxxxxxxx> --- include/parser.h | 1 + src/parser_bison.y | 5 +++-- src/scanner.l | 12 +++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/parser.h b/include/parser.h index b2ebd7aa226c..c3a85a4cf4c2 100644 --- a/include/parser.h +++ b/include/parser.h @@ -30,6 +30,7 @@ enum startcond_type { PARSER_SC_BEGIN, PARSER_SC_EXPR_HASH, PARSER_SC_EXPR_NUMGEN, + PARSER_SC_EXPR_QUEUE, }; struct mnl_socket; diff --git a/src/parser_bison.y b/src/parser_bison.y index 1ac4dbe43c84..423dddfc2c6d 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -863,6 +863,7 @@ opt_newline : NEWLINE close_scope_hash : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_HASH); }; close_scope_numgen : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_NUMGEN); }; +close_scope_queue : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_QUEUE); }; common_block : INCLUDE QUOTED_STRING stmt_separator { @@ -3635,8 +3636,8 @@ nf_nat_flag : RANDOM { $$ = NF_NAT_RANGE_PROTO_RANDOM; } | PERSISTENT { $$ = NF_NAT_RANGE_PERSISTENT; } ; -queue_stmt : queue_stmt_alloc - | queue_stmt_alloc queue_stmt_args +queue_stmt : queue_stmt_alloc close_scope_queue + | queue_stmt_alloc queue_stmt_args close_scope_queue ; queue_stmt_alloc : QUEUE diff --git a/src/scanner.l b/src/scanner.l index 94225c296a3b..893364b7b9e7 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -198,6 +198,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) %option stack %s SCANSTATE_EXPR_HASH %s SCANSTATE_EXPR_NUMGEN +%s SCANSTATE_EXPR_QUEUE %% @@ -346,11 +347,12 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "queue-threshold" { return QUEUE_THRESHOLD; } "level" { return LEVEL; } -"queue" { return QUEUE;} -"num" { return QUEUENUM;} -"bypass" { return BYPASS;} -"fanout" { return FANOUT;} - +"queue" { scanner_push_start_cond(yyscanner, SCANSTATE_EXPR_QUEUE); return QUEUE;} +<SCANSTATE_EXPR_QUEUE>{ + "num" { return QUEUENUM;} + "bypass" { return BYPASS;} + "fanout" { return FANOUT;} +} "limit" { return LIMIT; } "rate" { return RATE; } "burst" { return BURST; } -- 2.26.2