diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2021-10-18 14:30:01 +0200 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2021-10-18 19:48:11 +0200 |
commit | 8005767b2e5c177d0185a1541c7393d9ed8d1712 (patch) | |
tree | 0462205169c10478ddfb11bf6bb2fbd93183df6c /lib/command_parse.y | |
parent | Merge pull request #9730 from AnuradhaKaruppiah/evpn-recv-lttng (diff) | |
download | frr-8005767b2e5c177d0185a1541c7393d9ed8d1712.tar.xz frr-8005767b2e5c177d0185a1541c7393d9ed8d1712.zip |
lib: assign CLI varnames while parsing
... rather than running a costly extra pass across the finished tree.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command_parse.y')
-rw-r--r-- | lib/command_parse.y | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/command_parse.y b/lib/command_parse.y index dccd738f3..35c119691 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -217,10 +217,12 @@ cmd_token: { if ((ctx->currnode = graph_add_edge (ctx->currnode, $1)) != $1) graph_delete_node (ctx->graph, $1); + cmd_token_varname_seqappend($1); } | selector { graph_add_edge (ctx->currnode, $1.start); + cmd_token_varname_seqappend($1.start); ctx->currnode = $1.end; } ; @@ -295,9 +297,8 @@ placeholder_token_real: placeholder_token: placeholder_token_real varname_token { - struct cmd_token *token = $$->data; $$ = $1; - cmd_token_varname_set (token, $2); + cmd_token_varname_set ($$->data, $2); XFREE (MTYPE_LEX, $2); }; @@ -306,7 +307,7 @@ placeholder_token: selector: '<' selector_seq_seq '>' varname_token { $$ = $2; - cmd_token_varname_set ($2.end->data, $4); + cmd_token_varname_join ($2.end, $4); XFREE (MTYPE_LEX, $4); }; @@ -342,7 +343,7 @@ selector: '{' selector_seq_seq '}' varname_token * #1 is good enough to keep it this way. */ loopcheck(ctx, &$$); - cmd_token_varname_set ($2.end->data, $4); + cmd_token_varname_join ($2.end, $4); XFREE (MTYPE_LEX, $4); }; @@ -359,6 +360,7 @@ selector_token_seq: selector_token_seq selector_token { graph_add_edge ($1.end, $2.start); + cmd_token_varname_seqappend($2.start); $$.start = $1.start; $$.end = $2.end; } @@ -370,7 +372,7 @@ selector: '[' selector_seq_seq ']' varname_token { $$ = $2; graph_add_edge ($$.start, $$.end); - cmd_token_varname_set ($2.end->data, $4); + cmd_token_varname_join ($2.end, $4); XFREE (MTYPE_LEX, $4); } ; @@ -383,7 +385,7 @@ selector: EXCL_BRACKET selector_seq_seq ']' varname_token $$ = $2; graph_add_edge ($$.start, neg_only); graph_add_edge (neg_only, $$.end); - cmd_token_varname_set ($2.end->data, $4); + cmd_token_varname_join ($2.end, $4); XFREE (MTYPE_LEX, $4); } ; |