summaryrefslogtreecommitdiff
path: root/lib/grammar_sandbox.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-07-18 16:16:36 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-07-18 16:16:36 +0000
commit4b0abf2434806d5243527b5c75b8bfdcc311edd7 (patch)
tree357c2f1e7e6288792e1d2a501d103ffad65f81ef /lib/grammar_sandbox.c
parent478bdaeb3b9699d2ceaa9607ef37166e7ca69faf (diff)
lib: Fix some DFA construction bugs
Options get null paths, parser state is properly cleaned up, caller passes start node Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/grammar_sandbox.c')
-rw-r--r--lib/grammar_sandbox.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index fd0eec02d6..0cc6896d8e 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -1,5 +1,6 @@
#include "command.h"
#include "command_parse.h"
+#include "cmdtree.h"
#define GRAMMAR_STR "CLI grammar sandbox\n"
@@ -21,8 +22,12 @@ DEFUN (grammar_test,
strcat(cat, " ");
}
- cmd_parse_format_new((const char*) cat, "lol");
-
+ struct graph_node *result = new_node(NUL_GN);
+ /* cmd_parse_format_new((const char*) cat, "lol", result);*/
+ cmd_parse_format_new ("test <command|options> lol", "lol", result);
+ cmd_parse_format_new ("test <command|options> lol", "lol", result);
+ walk_graph(result, 0);
+
return CMD_SUCCESS;
}