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_graph.h | |
| parent | e9f7b2b597ad8c6947ce3b7238e89391e4f9f863 (diff) | |
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_graph.h')
| -rw-r--r-- | lib/command_graph.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/command_graph.h b/lib/command_graph.h index 86157f872e..ed4da6aa4c 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -79,11 +79,20 @@ enum { CMD_ATTR_NORMAL, CMD_ATTR_YANG, }; +enum varname_src { + VARNAME_NONE = 0, + VARNAME_AUTO, + VARNAME_VAR, + VARNAME_TEXT, + VARNAME_EXPLICIT, +}; + /* Command token struct. */ struct cmd_token { enum cmd_token_type type; // token type uint8_t attr; // token attributes bool allowrepeat; // matcher allowed to match token repetitively? + uint8_t varname_src; uint32_t refcnt; char *text; // token text @@ -119,6 +128,8 @@ extern struct cmd_token *cmd_token_new(enum cmd_token_type, uint8_t attr, extern struct cmd_token *cmd_token_dup(struct cmd_token *); extern void cmd_token_del(struct cmd_token *); extern void cmd_token_varname_set(struct cmd_token *token, const char *varname); +extern void cmd_token_varname_seqappend(struct graph_node *n); +extern void cmd_token_varname_join(struct graph_node *n, const char *varname); extern void cmd_graph_parse(struct graph *graph, const struct cmd_element *cmd); extern void cmd_graph_names(struct graph *graph); |
