From: Donald Sharp Date: Wed, 25 Jan 2017 12:49:21 +0000 (-0500) Subject: Merge pull request #105 from opensourcerouting/cli_merge_step_prep X-Git-Tag: frr-3.0-branchpoint~64^2~7 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=d2ce19c9b5e2a707dd5620dc6bb3cb8562a06261;p=mirror_frr.git Merge pull request #105 from opensourcerouting/cli_merge_step_prep Prepare for split-off cli parser "merge" step --- d2ce19c9b5e2a707dd5620dc6bb3cb8562a06261 diff --cc lib/command.h index 1e490cc4c,3da77d3af..ff1b1a0e8 --- a/lib/command.h +++ b/lib/command.h @@@ -420,12 -422,18 +423,16 @@@ extern void cmd_terminate (void) extern void cmd_exit (struct vty *vty); extern int cmd_list_cmds (struct vty *vty, int do_permute); + /* NOT safe for general use; call this only if DEV_BUILD! */ + extern void grammar_sandbox_init (void); + /* memory management for cmd_token */ -struct cmd_token * -new_cmd_token (enum cmd_token_type, u_char attr, char *, char *); -void -del_cmd_token (struct cmd_token *); -struct cmd_token * -copy_cmd_token (struct cmd_token *); +extern struct cmd_token *new_cmd_token (enum cmd_token_type, u_char attr, + const char *text, const char *desc); +extern void del_cmd_token (struct cmd_token *); +extern struct cmd_token *copy_cmd_token (struct cmd_token *); + extern vector completions_to_vec (struct list *completions); extern void command_parse_format (struct graph *graph, struct cmd_element *cmd); /* Export typical functions. */ diff --cc lib/command_parse.y index 7f98704f9,dd8e6fb59..e9d36ca41 --- a/lib/command_parse.y +++ b/lib/command_parse.y @@@ -107,15 -111,10 +111,10 @@@ /* bison declarations */ void - cmd_yyerror (struct parser_ctx *ctx, char const *msg); - - /* subgraph semantic value */ - struct subgraph { - struct graph_node *start, *end; - }; + cmd_yyerror (CMD_YYLTYPE *locp, struct parser_ctx *ctx, char const *msg); /* helper functions for parser */ - static char * + static const char * doc_next (struct parser_ctx *ctx); static struct graph_node * @@@ -130,11 -129,11 +129,11 @@@ static struct graph_node * new_token_node (struct parser_ctx *, enum cmd_token_type type, - char *text, - char *doc); + const char *text, + const char *doc); static void - terminate_graph (struct parser_ctx *ctx, + terminate_graph (CMD_YYLTYPE *locp, struct parser_ctx *ctx, struct graph_node *); static void @@@ -215,14 -213,9 +213,9 @@@ simple_token | placeholder_token ; - compound_token: - selector - | option - ; - literal_token: WORD { - $$ = new_token_node (ctx, WORD_TKN, strdup($1), doc_next(ctx)); + $$ = new_token_node (ctx, WORD_TKN, $1, doc_next(ctx)); free ($1); } ;