diff options
author | Florian Westphal <fw@strlen.de> | 2021-03-08 18:18:33 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2021-03-11 13:43:30 +0100 |
commit | 5896772fe3c5f01696188ea04957a825ee601b12 (patch) | |
tree | 42c1971b34a17ea7107bbeb0b60c11d863dd05d1 /include | |
parent | f8d5fa7c0523d8058e11c823c4664c9ba9ccf121 (diff) |
scanner: introduce start condition stack
Add a small initial chunk of flex start conditionals.
This starts with two low-hanging fruits, numgen and j/symhash.
NUMGEN and HASH start conditions are entered from flex when
the corresponding expression token is encountered.
Flex returns to the INIT condition when the bison parser
has seen a complete numgen/hash statement.
This intentionally uses a stack rather than BEGIN()
to eventually support nested states.
The scanner_pop_start_cond() function argument is not used yet, but
will need to be used later to deal with nesting.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/parser.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/parser.h b/include/parser.h index 9baa3a4d..b2ebd7aa 100644 --- a/include/parser.h +++ b/include/parser.h @@ -26,6 +26,12 @@ struct parser_state { struct list_head *cmds; }; +enum startcond_type { + PARSER_SC_BEGIN, + PARSER_SC_EXPR_HASH, + PARSER_SC_EXPR_NUMGEN, +}; + struct mnl_socket; extern void parser_init(struct nft_ctx *nft, struct parser_state *state, @@ -45,4 +51,6 @@ extern void scanner_push_buffer(void *scanner, const struct input_descriptor *indesc, const char *buffer); +extern void scanner_pop_start_cond(void *scanner, enum startcond_type sc); + #endif /* NFTABLES_PARSER_H */ |