From 9a80a5d3c652746f5e51d38aea1cf49f8a1949e4 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 17 Mar 2019 21:30:56 +0100 Subject: T1305: allow configs to end with a leaf node. --- parser/vyos1x_parser.mly | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'parser') diff --git a/parser/vyos1x_parser.mly b/parser/vyos1x_parser.mly index 17f4909..707538d 100644 --- a/parser/vyos1x_parser.mly +++ b/parser/vyos1x_parser.mly @@ -45,15 +45,21 @@ value: ; -leaf_node: +leaf_node_body: | comment = comments; - name = IDENTIFIER; value = value; NEWLINE; + name = IDENTIFIER; value = value; { Vytree.make_full {default_data with values=[value]; comment=comment} name []} | comment = comments; - name = IDENTIFIER; NEWLINE (* valueless node *) + name = IDENTIFIER; (* valueless node *) { Vytree.make_full {default_data with comment=comment} name [] } ; +leaf_node: + | n = leaf_node_body; NEWLINE; + { n } + | n = leaf_node_body; EOF; + { n } + node: | comment = comments; name = IDENTIFIER; LEFT_BRACE; children = list(node_content); RIGHT_BRACE; -- cgit v1.2.3