diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2014-01-13 13:14:18 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-01-13 13:19:58 -0800 |
commit | 212eeaa77c7408893df92aa9b312855bfc9dcd8e (patch) | |
tree | 74bee5635b75805f58a1714e1342f23169fd5170 /parse_tree.cpp | |
parent | eb28c710baa385cbd9b979e99736ef65b16de0db (diff) |
Correctly report errors for 'and' and 'or' in pipelines with new parser
Diffstat (limited to 'parse_tree.cpp')
-rw-r--r-- | parse_tree.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/parse_tree.cpp b/parse_tree.cpp index 41873bbe..6bb7a3cd 100644 --- a/parse_tree.cpp +++ b/parse_tree.cpp @@ -1357,13 +1357,15 @@ bool parse_node_tree_t::command_for_plain_statement(const parse_node_t &node, co return result; } -bool parse_node_tree_t::plain_statement_is_in_pipeline(const parse_node_t &node, bool include_first) const +bool parse_node_tree_t::statement_is_in_pipeline(const parse_node_t &node, bool include_first) const { // Moderately nasty hack! Walk up our ancestor chain and see if we are in a job_continuation. This checks if we are in the second or greater element in a pipeline; if we are the first element we treat this as false + // This accepts a few statement types bool result = false; const parse_node_t *ancestor = &node; - if (ancestor) + // If we're given a plain statement, try to get its decorated statement parent + if (ancestor && ancestor->type == symbol_plain_statement) ancestor = this->get_parent(*ancestor, symbol_decorated_statement); if (ancestor) ancestor = this->get_parent(*ancestor, symbol_statement); |