summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2016-08-29 17:15:47 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2016-08-29 20:30:29 +0200
commit7a3d6802ddcb40d2339a461762afdb0328a3beb7 (patch)
tree05ee1e73ed1dc805bbd852c693683b7ce74bb9fc /src
parent06c8f6fccc689cae71cc84d4d6d27098c9e15089 (diff)
parser_bison: add variable_expr rule
This patch adds a rule for variable expression so we can reuse it in a follow up patch to allow set element initialization from variable. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/parser_bison.y23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y
index dc794656..a87468e2 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -496,8 +496,8 @@ static void location_update(struct location *loc, struct location *rhs, int n)
%type <stmt> flow_stmt flow_stmt_alloc
%destructor { stmt_free($$); } flow_stmt flow_stmt_alloc
-%type <expr> symbol_expr verdict_expr integer_expr
-%destructor { expr_free($$); } symbol_expr verdict_expr integer_expr
+%type <expr> symbol_expr verdict_expr integer_expr variable_expr
+%destructor { expr_free($$); } symbol_expr verdict_expr integer_expr variable_expr
%type <expr> primary_expr shift_expr and_expr
%destructor { expr_free($$); } primary_expr shift_expr and_expr
%type <expr> exclusive_or_expr inclusive_or_expr
@@ -1927,14 +1927,7 @@ match_stmt : relational_expr
}
;
-symbol_expr : string
- {
- $$ = symbol_expr_alloc(&@$, SYMBOL_VALUE,
- current_scope(state),
- $1);
- xfree($1);
- }
- | '$' identifier
+variable_expr : '$' identifier
{
struct scope *scope = current_scope(state);
@@ -1948,6 +1941,16 @@ symbol_expr : string
scope, $2);
xfree($2);
}
+ ;
+
+symbol_expr : variable_expr
+ | string
+ {
+ $$ = symbol_expr_alloc(&@$, SYMBOL_VALUE,
+ current_scope(state),
+ $1);
+ xfree($1);
+ }
| AT identifier
{
$$ = symbol_expr_alloc(&@$, SYMBOL_SET,