aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-01 20:33:26 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-01 20:33:26 -0800
commitb187125b636c14253d626e4c2470f89e192168cf (patch)
tree2bece4c85b78e4bd5cedbfb77e57b0e7fe850c91 /parser.cpp
parent84ea96f383d3713f750d39a74d7b8693275db25d (diff)
parentd232a0f9512d0e1b575235fdf4119a63353ecedd (diff)
Merge branch 'master' into parser_cleanup
Diffstat (limited to 'parser.cpp')
-rw-r--r--parser.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/parser.cpp b/parser.cpp
index adfa263a..de1a635a 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -1,4 +1,4 @@
-/** \file parser.cpp
+/** \file parser.c
The fish parser. Contains functions for parsing and evaluating code.
@@ -826,6 +826,16 @@ const wchar_t *parser_t::is_function() const
int parser_t::get_lineno() const
{
+ if (parser_use_ast())
+ {
+ int lineno = -1;
+ if (! execution_contexts.empty())
+ {
+ lineno = execution_contexts.back()->get_current_line_number();
+ }
+ return lineno;
+ }
+
int lineno;
if (! current_tokenizer || ! tok_string(current_tokenizer))
@@ -1162,6 +1172,13 @@ int parser_t::eval_new_parser(const wcstring &cmd, const io_chain_t &io, enum bl
parse_execution_context_t *ctx = new parse_execution_context_t(tree, cmd, this, exec_eval_level);
execution_contexts.push_back(ctx);
+ /* Execute the first node */
+ int result = 1;
+ if (! tree.empty())
+ {
+ result = this->eval_block_node(0, io, block_type);
+ }
+
/* Clean up the execution context stack */
assert(! execution_contexts.empty() && execution_contexts.back() == ctx);
execution_contexts.pop_back();