diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-03-30 13:25:10 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-03-30 13:29:08 +0200 |
commit | 5db9dc9292d30a3672b691e4a8a6cd49daa47b71 (patch) | |
tree | 7de2873260087f51c76943e6febb0efa34d388ed /src/parser_bison.y | |
parent | 89e3001be44aa2f25e51b139f044328230cbb098 (diff) |
src: store parser location for handle and position specifiers
Store the parser location structure for handle and position IDs so we
can use this information from the evaluation step, to provide better
error reporting.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Acked-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r-- | src/parser_bison.y | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 9e86f265..4b7c1f5a 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -133,6 +133,8 @@ static void location_update(struct location *loc, struct location *rhs, int n) struct expr *expr; struct set *set; const struct datatype *datatype; + struct handle_spec handle_spec; + struct position_spec position_spec; } %token TOKEN_EOF 0 "end of file" @@ -423,7 +425,10 @@ static void location_update(struct location *loc, struct location *rhs, int n) %destructor { handle_free(&$$); } table_spec chain_spec chain_identifier ruleid_spec ruleset_spec %type <handle> set_spec set_identifier %destructor { handle_free(&$$); } set_spec set_identifier -%type <val> handle_spec family_spec family_spec_explicit position_spec chain_policy prio_spec +%type <val> family_spec family_spec_explicit chain_policy prio_spec + +%type <handle_spec> handle_spec +%type <position_spec> position_spec %type <string> dev_spec %destructor { xfree($$); } dev_spec @@ -1218,21 +1223,25 @@ set_identifier : identifier handle_spec : /* empty */ { - $$ = 0; + memset(&$$, 0, sizeof($$)); } | HANDLE NUM { - $$ = $2; + memset(&$$, 0, sizeof($$)); + $$.location = @$; + $$.id = $2; } ; position_spec : /* empty */ { - $$ = 0; + memset(&$$, 0, sizeof($$)); } | POSITION NUM { - $$ = $2; + memset(&$$, 0, sizeof($$)); + $$.location = @$; + $$.id = $2; } ; |