summaryrefslogtreecommitdiffstats
path: root/src/parser_bison.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r--src/parser_bison.y22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y
index ec8b0dd8..df672b1e 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -185,6 +185,8 @@ int nft_lex(void *, void *, void *);
%token INCLUDE "include"
%token DEFINE "define"
+%token REDEFINE "redefine"
+%token UNDEFINE "undefine"
%token FIB "fib"
@@ -763,6 +765,26 @@ common_block : INCLUDE QUOTED_STRING stmt_separator
symbol_bind(scope, $2, $4);
xfree($2);
}
+ | REDEFINE identifier '=' initializer_expr stmt_separator
+ {
+ struct scope *scope = current_scope(state);
+
+ /* ignore missing identifier */
+ symbol_unbind(scope, $2);
+ symbol_bind(scope, $2, $4);
+ xfree($2);
+ }
+ | UNDEFINE identifier stmt_separator
+ {
+ struct scope *scope = current_scope(state);
+
+ if (symbol_unbind(scope, $2) < 0) {
+ erec_queue(error(&@2, "undefined symbol '%s'", $2),
+ state->msgs);
+ YYERROR;
+ }
+ xfree($2);
+ }
| error stmt_separator
{
if (++state->nerrs == nft->parser_max_errors)