aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-16 14:49:51 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-20 21:32:02 -0700
commit8ec73b2dd40bf95d2b665cfb4cc22c26a2717cae (patch)
tree1edf1cef90414d28d2eb38ceffccc0da079627a6 /parser.cpp
parent5c54ef7b0dceee99f180131a59ae19e649b31e84 (diff)
Removing some variables from parser_t that are no longer used in the new
execution model
Diffstat (limited to 'parser.cpp')
-rw-r--r--parser.cpp40
1 files changed, 12 insertions, 28 deletions
diff --git a/parser.cpp b/parser.cpp
index 8513d530..9db07903 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -199,10 +199,7 @@ parser_t::parser_t(enum parser_type_t type, bool errors) :
cancellation_requested(false),
is_within_fish_initialization(false),
current_tokenizer(NULL),
- current_tokenizer_pos(0),
- job_start_pos(0),
- eval_level(-1),
- block_io(shared_ptr<io_data_t>())
+ current_tokenizer_pos(0)
{
}
@@ -497,7 +494,7 @@ void parser_t::print_errors(wcstring &target, const wchar_t *prefix)
tmp = current_tokenizer_pos;
current_tokenizer_pos = err_pos;
- append_format(target, L"%ls", this->current_line());
+ target.append(this->current_line());
current_tokenizer_pos=tmp;
}
@@ -516,11 +513,11 @@ void parser_t::print_errors_stderr()
tmp = current_tokenizer_pos;
current_tokenizer_pos = err_pos;
- fwprintf(stderr, L"%ls", this->current_line());
+ wcstring current_line = this->current_line();
+ fwprintf(stderr, L"%ls", current_line.c_str());
current_tokenizer_pos=tmp;
}
-
}
void parser_t::eval_args(const wchar_t *line, std::vector<completion_t> &args)
@@ -635,7 +632,7 @@ void parser_t::stack_trace(size_t block_idx, wcstring &buff) const
return;
}
- if (b->type() == FUNCTION_CALL || b->type()==SOURCE || b->type()==SUBST)
+ if (b->type() == FUNCTION_CALL || b->type() == FUNCTION_CALL_NO_SHADOW || b->type()==SOURCE || b->type()==SUBST)
{
/*
These types of blocks should be printed
@@ -653,6 +650,7 @@ void parser_t::stack_trace(size_t block_idx, wcstring &buff) const
break;
}
case FUNCTION_CALL:
+ case FUNCTION_CALL_NO_SHADOW:
{
const function_block_t *fb = static_cast<const function_block_t*>(b);
append_format(buff, _(L"in function '%ls'\n"), fb->name.c_str());
@@ -728,7 +726,7 @@ const wchar_t *parser_t::is_function() const
for (size_t block_idx = 0; block_idx < this->block_count(); block_idx++)
{
const block_t *b = this->block_at_index(block_idx);
- if (b->type() == FUNCTION_CALL)
+ if (b->type() == FUNCTION_CALL || b->type() == FUNCTION_CALL_NO_SHADOW)
{
const function_block_t *fb = static_cast<const function_block_t *>(b);
result = fb->name.c_str();
@@ -766,6 +764,7 @@ const wchar_t *parser_t::current_filename() const
for (size_t i=0; i < this->block_count(); i++)
{
const block_t *b = this->block_at_index(i);
+ /* Note that we deliberately skip FUNCTION_CALL_NO_SHADOW here, because the only such functions in wide use are '.' and eval, and we don't want to report those */
if (b->type() == FUNCTION_CALL)
{
const function_block_t *fb = static_cast<const function_block_t *>(b);
@@ -809,8 +808,10 @@ static int printed_width(const wchar_t *str, int len)
}
-const wchar_t *parser_t::current_line()
+wcstring parser_t::current_line()
{
+ wcstring lineinfo;
+
int lineno=1;
const wchar_t *file;
@@ -836,8 +837,6 @@ const wchar_t *parser_t::current_line()
return L"";
- lineinfo.clear();
-
/*
Calculate line number, line offset, etc.
*/
@@ -923,24 +922,9 @@ const wchar_t *parser_t::current_line()
free((void *)line);
parser_t::stack_trace(0, lineinfo);
- return lineinfo.c_str();
-}
-
-int parser_t::get_pos() const
-{
- return tok_get_pos(current_tokenizer);
+ return lineinfo;
}
-int parser_t::get_job_pos() const
-{
- return job_start_pos;
-}
-
-
-void parser_t::set_pos(int p)
-{
- tok_set_pos(current_tokenizer, p);
-}
const wchar_t *parser_t::get_buffer() const
{