diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2016-12-16 22:34:35 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-01-23 21:52:44 +0100 |
| commit | ab037159286a3241244a6b3e7d1033e3940aa944 (patch) | |
| tree | a11b3b207c8afa559ffdbe337971f860b8ee1c56 /lib/command_parse.y | |
| parent | 0bf5b1cbe3812e748d459fa4c4fb6596e072e7bd (diff) | |
lib: parser: track matching FORK_TKN & JOIN_TKN
This associates pairs of FORK and JOIN tokens, so the merge function can
identify where a subgraph begins and ends.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command_parse.y')
| -rw-r--r-- | lib/command_parse.y | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/command_parse.y b/lib/command_parse.y index 478ba0537c..af6497d128 100644 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@ -276,6 +276,8 @@ selector: '<' selector_seq_seq '>' $$ = malloc (sizeof (struct subgraph)); $$->start = new_token_node (ctx, FORK_TKN, NULL, NULL); $$->end = new_token_node (ctx, JOIN_TKN, NULL, NULL); + ((struct cmd_token *)$$->start->data)->forkjoin = $$->end; + ((struct cmd_token *)$$->end->data)->forkjoin = $$->start; for (unsigned int i = 0; i < vector_active ($2->start->to); i++) { struct graph_node *sn = vector_slot ($2->start->to, i), @@ -331,6 +333,8 @@ selector: '{' selector_seq_seq '}' $$ = malloc (sizeof (struct subgraph)); $$->start = new_token_node (ctx, FORK_TKN, NULL, NULL); $$->end = new_token_node (ctx, JOIN_TKN, NULL, NULL); + ((struct cmd_token *)$$->start->data)->forkjoin = $$->end; + ((struct cmd_token *)$$->end->data)->forkjoin = $$->start; graph_add_edge ($$->start, $$->end); for (unsigned int i = 0; i < vector_active ($2->start->to); i++) { @@ -379,6 +383,8 @@ option: '[' option_token_seq ']' $$ = malloc (sizeof (struct subgraph)); $$->start = new_token_node (ctx, FORK_TKN, NULL, NULL); $$->end = new_token_node (ctx, JOIN_TKN, NULL, NULL); + ((struct cmd_token *)$$->start->data)->forkjoin = $$->end; + ((struct cmd_token *)$$->end->data)->forkjoin = $$->start; // add a path through the sequence to the end graph_add_edge ($$->start, $2->start); graph_add_edge ($2->end, $$->end); |
