summaryrefslogtreecommitdiff
path: root/lib/grammar_sandbox.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-09-09 19:57:54 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-09-09 19:57:54 +0000
commit97c45dae54bc4d4fc3a24155ef7703beac4ae7aa (patch)
tree6dab891ed71a9deaf6d34b86d1ddad120cbfedf1 /lib/grammar_sandbox.c
parent500b1a5becd68f7db0e37bfc457b501c05da0999 (diff)
lib: Reorganize grammar sandbox
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/grammar_sandbox.c')
-rw-r--r--lib/grammar_sandbox.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index 521029af6b..1ba76babda 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -36,6 +36,7 @@
#define GRAMMAR_STR "CLI grammar sandbox\n"
+/** headers **/
void
grammar_sandbox_init (void);
void
@@ -43,19 +44,9 @@ pretty_print_graph (struct graph_node *, int);
void
init_cmdgraph (struct graph **);
-/* Command graph. Used to match user input to cmd_elements. */
+/** shim interface commands **/
struct graph *nodegraph;
-void
-init_cmdgraph (struct graph **graph)
-{
- // initialize graph, add start noe
- *graph = graph_new ();
- struct cmd_token_t *token = new_cmd_token (START_TKN, NULL, NULL);
- graph_new_node (*graph, token, (void (*)(void *)) &del_cmd_token);
- fprintf (stdout, "initialized graph\n");
-}
-
DEFUN (grammar_test,
grammar_test_cmd,
"grammar parse .COMMAND",
@@ -294,6 +285,16 @@ pretty_print_graph (struct graph_node *start, int level)
}
/** stuff that should go in command.c + command.h */
+void
+init_cmdgraph (struct graph **graph)
+{
+ // initialize graph, add start noe
+ *graph = graph_new ();
+ struct cmd_token_t *token = new_cmd_token (START_TKN, NULL, NULL);
+ graph_new_node (*graph, token, (void (*)(void *)) &del_cmd_token);
+ fprintf (stdout, "initialized graph\n");
+}
+
struct cmd_token_t *
new_cmd_token (enum cmd_token_type_t type, char *text, char *desc)
{