diff options
author | Sanne Wouda <sanne.wouda@gmail.com> | 2015-03-11 23:53:24 +0100 |
---|---|---|
committer | David Adam <zanchey@ucc.gu.uwa.edu.au> | 2015-04-13 13:23:59 +0800 |
commit | fd731fb74f7e0af3151f5afd8bc8b789e0e47dd4 (patch) | |
tree | 9c42d4269b8ba8dc80e92031be9acd899187cb79 /parse_execution.cpp | |
parent | d1a56139e1d99530d38443f3681f3e7372e9923e (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_execution.cpp')
-rw-r--r-- | parse_execution.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/parse_execution.cpp b/parse_execution.cpp index 2b43ccc4..eb162ccd 100644 --- a/parse_execution.cpp +++ b/parse_execution.cpp @@ -413,7 +413,7 @@ parse_execution_result_t parse_execution_context_t::run_block_statement(const pa const parse_node_t &block_header = *get_child(statement, 0, symbol_block_header); //block header const parse_node_t &header = *get_child(block_header, 0); //specific header type (e.g. for loop) - const parse_node_t &contents = *get_child(statement, 2, symbol_job_list); //block contents + const parse_node_t &contents = *get_child(statement, 1, symbol_job_list); //block contents parse_execution_result_t ret = parse_execution_success; switch (header.type) @@ -428,7 +428,7 @@ parse_execution_result_t parse_execution_context_t::run_block_statement(const pa case symbol_function_header: { - const parse_node_t &function_end = *get_child(statement, 3, symbol_end_command); //the 'end' associated with the block + const parse_node_t &function_end = *get_child(statement, 2, symbol_end_command); //the 'end' associated with the block ret = run_function_statement(header, function_end); break; } |