summaryrefslogtreecommitdiff
path: root/lib/cmdtree.h
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-07-17 21:49:16 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-07-17 21:49:16 +0000
commit478bdaeb3b9699d2ceaa9607ef37166e7ca69faf (patch)
tree7f1cc818b840a6d4ac9a7b1e5ea88906d5de8d23 /lib/cmdtree.h
parent071b077cad5af4e55b4a0c479ed0e7912e8964ad (diff)
lib: Finish implementing grammar, DFA construction
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/cmdtree.h')
-rw-r--r--lib/cmdtree.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/cmdtree.h b/lib/cmdtree.h
index cdcf347006..e9a10d7ec5 100644
--- a/lib/cmdtree.h
+++ b/lib/cmdtree.h
@@ -20,13 +20,24 @@ struct graph_node
{
enum graph_node_type type;
vector children;
- int is_leaf, is_root;
+ int is_root; // true if first token in command
+ int is_leaf; // true if last token in command
+
int (*func)(struct vty *, int, const char *[]);
+
+ /* various data fields for nodes */
+ char* text; // for words and variables
+ int value; // for numbers
+ int start, end; // for ranges
};
/*
* Adds a child to a node. If the node already has the exact same
* child, nothing is done.
+ * @param[in] parent node
+ * @param[in] child node
+ * @return the new child, or the existing child if the parent already has the
+ * new child
*/
extern struct graph_node *
add_node(struct graph_node *, struct graph_node *);