summaryrefslogtreecommitdiff
path: root/lib/command_parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'lib/command_parse.y')
-rw-r--r--lib/command_parse.y27
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/command_parse.y b/lib/command_parse.y
index 146c8b6101..57a0ba3f82 100644
--- a/lib/command_parse.y
+++ b/lib/command_parse.y
@@ -78,8 +78,8 @@ struct cmd_element *command; // command we're parsing
/* grammar proper */
%%
-start: sentence_root
- cmd_token_seq
+start:
+ sentence_root cmd_token_seq
{
// create leaf node
struct graph_node *end = new_node(END_GN);
@@ -93,6 +93,29 @@ start: sentence_root
}
fprintf(stderr, "Parsed full command successfully.\n");
}
+| sentence_root cmd_token_seq '.' placeholder_token
+{
+ currnode = add_node(currnode, $4);
+ if (currnode != $4)
+ free_node ($4);
+
+ // since varargs may match any number of the last token,
+ // simply add this node as a child of itself and proceed
+ // wth normal command termination procedure
+ add_node(currnode, currnode);
+
+ // create leaf node
+ struct graph_node *end = new_node(END_GN);
+ end->element = command;
+
+ // add node
+ if (add_node(currnode, end) != end)
+ {
+ yyerror("Duplicate command.");
+ YYABORT;
+ }
+ fprintf(stderr, "Parsed full command successfully.\n");
+}
sentence_root: WORD
{