From bea7aab38f305bb8c2e400d575e6bd0a3c6bbc1f Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Thu, 16 Jan 2014 20:01:56 +0000 Subject: set: make set initializer parsable If a set contains elements, the output is not parsable since the elements = { ... } is not understood by the parser. Fix this and also add support for creating constant sets (which only makes sense when using an initializer). Signed-off-by: Patrick McHardy --- src/parser.y | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/parser.y') diff --git a/src/parser.y b/src/parser.y index 1b09e616..345d8d06 100644 --- a/src/parser.y +++ b/src/parser.y @@ -182,7 +182,9 @@ static void location_update(struct location *loc, struct location *rhs, int n) %token RETURN "return" %token QUEUE "queue" +%token CONSTANT "constant" %token INTERVAL "interval" +%token ELEMENTS "elements" %token NUM "number" %token STRING "string" @@ -746,6 +748,11 @@ set_block : /* empty */ { $$ = $-1; } $1->flags = $3; $$ = $1; } + | set_block ELEMENTS '=' set_expr + { + $1->init = $4; + $$ = $1; + } ; set_flag_list : set_flag_list COMMA set_flag @@ -755,7 +762,8 @@ set_flag_list : set_flag_list COMMA set_flag | set_flag ; -set_flag : INTERVAL { $$ = SET_F_INTERVAL; } +set_flag : CONSTANT { $$ = SET_F_CONSTANT; } + | INTERVAL { $$ = SET_F_INTERVAL; } ; map_block_alloc : /* empty */ @@ -793,6 +801,11 @@ map_block : /* empty */ { $$ = $-1; } $1->flags = $3; $$ = $1; } + | map_block ELEMENTS '=' set_expr + { + $1->init = $4; + $$ = $1; + } ; hook_spec : TYPE STRING HOOK STRING PRIORITY NUM -- cgit v1.2.3