Adopt the new AST in parse_execution

parse_execution is what turns a parsed tree into jobs, etc. Switch it from
parse_tree to the new AST.
This commit is contained in:
ridiculousfish
2020-07-03 11:16:51 -07:00
parent 6c6088f45c
commit 3534c07584
14 changed files with 530 additions and 419 deletions

View File

@@ -1214,11 +1214,19 @@ const parse_node_t *parse_node_tree_t::get_child(const parse_node_t &parent, nod
return result;
}
parsed_source_t::parsed_source_t(wcstring s, ast::ast_t &&ast)
: src(std::move(s)), ast(make_unique<ast::ast_t>(std::move(ast))) {}
parsed_source_t::~parsed_source_t() = default;
parsed_source_ref_t parse_source(wcstring src, parse_tree_flags_t flags,
parse_error_list_t *errors) {
parse_node_tree_t tree;
if (!parse_tree_from_string(src, flags, &tree, errors, symbol_job_list)) return {};
return std::make_shared<parsed_source_t>(std::move(src), std::move(tree));
using namespace ast;
ast_t ast = ast_t::parse(src, flags, errors);
if (ast.errored() && !(flags & parse_flag_continue_after_error)) {
return nullptr;
}
return std::make_shared<parsed_source_t>(std::move(src), std::move(ast));
}
const parse_node_t &parse_node_tree_t::find_child(const parse_node_t &parent,