aboutsummaryrefslogtreecommitdiffhomepage
path: root/parse_tree.h
diff options
context:
space:
mode:
authorGravatar Sanne Wouda <sanne.wouda@gmail.com>2015-03-11 23:53:24 +0100
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-04-13 13:23:59 +0800
commitfd731fb74f7e0af3151f5afd8bc8b789e0e47dd4 (patch)
tree9c42d4269b8ba8dc80e92031be9acd899187cb79 /parse_tree.h
parentd1a56139e1d99530d38443f3681f3e7372e9923e (diff)
Modify parser to accept 'begin' without ';'
Examples that work as expected (even completions don't get confused): $ begin true; end; $ begin if true; end; end $ begin if true; echo hi; end The last example correctly expects another 'end' to match 'begin'. Fixes #1248.
Diffstat (limited to 'parse_tree.h')
-rw-r--r--parse_tree.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/parse_tree.h b/parse_tree.h
index 74e9d436..ff44d862 100644
--- a/parse_tree.h
+++ b/parse_tree.h
@@ -249,14 +249,14 @@ bool parse_tree_from_string(const wcstring &str, parse_tree_flags_t flags, parse
case_item = CASE argument_list <TOK_END> job_list
- block_statement = block_header <TOK_END> job_list end_command arguments_or_redirections_list
- block_header = for_header | while_header | function_header | begin_header
- for_header = FOR var_name IN argument_list
- while_header = WHILE job
- begin_header = BEGIN
+ block_statement = block_header job_list end_command arguments_or_redirections_list
+ block_header = for_header | while_header | function_header | begin_header
+ for_header = FOR var_name IN argument_list <TOK_END>
+ while_header = WHILE job <TOK_END>
+ begin_header = BEGIN | BEGIN <TOK_END>
# Functions take arguments, and require at least one (the name). No redirections allowed.
- function_header = FUNCTION argument argument_list
+ function_header = FUNCTION argument argument_list <TOK_END>
# A boolean statement is AND or OR or NOT