diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2016-12-16 23:27:39 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-02-10 15:39:04 +0100 |
| commit | de8f7a39836a8f121370c1506cc00e3321f284a2 (patch) | |
| tree | 659afcae689747e0cbf858d29808fa9f9e7ec979 /lib/grammar_sandbox.c | |
| parent | 6432969db96ba03452b0e13906d85e718d6c633e (diff) | |
lib: parser: rewrite token deduplication
Merge the parsed graph into the existing one as a separate step. This
makes it possible to merge identical subgraphs, which is used e.g. in
bgpd for <A.B.C.D|X:X::X:X|WORD> neighbor names.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/grammar_sandbox.c')
| -rw-r--r-- | lib/grammar_sandbox.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 315bd4d59c..0779f23060 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -68,7 +68,12 @@ DEFUN (grammar_test, cmd->func = NULL; // parse the command and install it into the command graph - command_parse_format (nodegraph, cmd); + struct graph *graph = graph_new(); + struct cmd_token *token = new_cmd_token (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); + graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token); + + command_parse_format (graph, cmd); + cmd_merge_graphs (nodegraph, graph, +1); return CMD_SUCCESS; } |
