diff options
author | 2013-10-08 18:48:01 -0700 | |
---|---|---|
committer | 2013-10-08 18:48:01 -0700 | |
commit | a51bd03a5c86d5532063610cc185f3d377daa4e1 (patch) | |
tree | 967470c3a266ded9c620a4491c18740967808c59 /builtin.cpp | |
parent | 54d7c29221e066ed4150e53f3bcca90013e5d795 (diff) |
Remove parse_exec stuff
Diffstat (limited to 'builtin.cpp')
-rw-r--r-- | builtin.cpp | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/builtin.cpp b/builtin.cpp index 06c9a9b8..b84d78e7 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -65,7 +65,6 @@ #include "path.h" #include "history.h" #include "parse_tree.h" -#include "parse_exec.h" /** The default prompt for the read command @@ -3956,104 +3955,6 @@ static int builtin_history(parser_t &parser, wchar_t **argv) #pragma mark Simulator -struct parse_execution_simulator_t : public parse_execution_visitor_t -{ - wcstring_list_t result; - - wcstring &back() - { - assert(! result.empty()); - return result.back(); - } - - void append_src(node_offset_t idx) - { - wcstring tmp; - context->get_source(idx, &tmp); - back().append(tmp); - } - - void append(const wchar_t *s) - { - back().append(s); - } - - bool enter_job_list(void) - { - return true; - } - - bool enter_job(void) - { - result.resize(result.size() + 1); - return true; - } - - void visit_statement(void) - { - } - - virtual void visit_boolean_statement(void) - { - } - - virtual void enter_if_clause(const exec_if_clause_t &statement) - { - } - - virtual void exit_if_clause(const exec_if_clause_t &statement) - { - append_format(back(), L"\nIF successful jump to %lu", (unsigned long)statement.body); - } - - void visit_basic_statement(const exec_basic_statement_t &statement) - { - wcstring &line = this->back(); - if (! line.empty()) - { - line.append(L" <pipe> "); - } - switch (statement.decoration) - { - case exec_basic_statement_t::decoration_builtin: - line.append(L"<builtin> "); - break; - - case exec_basic_statement_t::decoration_command: - line.append(L"<command> "); - break; - - default: - break; - } - - line.append(L"cmd:"); - this->append_src(statement.command_idx); - for (size_t i=0; i < statement.arguments().size(); i++) - { - const exec_argument_t &arg = statement.arguments().at(i); - append(L" "); - append(L"arg:"); - append_src(arg.parse_node_idx); - } - } - - void visit_function(const exec_function_header_t &function) - { - wcstring &line = this->back(); - line.append(L"define function: "); - wcstring tmp; - context->get_source(function.name_idx, &tmp); - line.append(tmp); - } - - void exit_job_list(void) - { - } -}; - - - int builtin_parse(parser_t &parser, wchar_t **argv) { struct sigaction act; @@ -4090,21 +3991,6 @@ int builtin_parse(parser_t &parser, wchar_t **argv) { const wcstring dump = parse_dump_tree(parse_tree, src); fprintf(stderr, "%ls", dump.c_str()); - if (0) - { - parse_execution_context_t ctx(parse_tree, src); - parse_execution_simulator_t sim; - sim.context = &ctx; - while (ctx.visit_next_node(&sim)) - { - } - stdout_buffer.append(L"Simulating execution:\n"); - for (size_t i=0; i < sim.result.size(); i++) - { - stdout_buffer.append(sim.result.at(i)); - stdout_buffer.push_back(L'\n'); - } - } } } return STATUS_BUILTIN_OK; |