aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-02-27 12:03:30 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-02-28 10:25:32 -0800
commit94b1d58cc28800cbc7f00febf499a1d9c9928a21 (patch)
tree8dc05506b3bc27df1178f21230519466613f8ea0 /parser.cpp
parentc55cbd3f2f003ea6e36727f8b985e880d6aded85 (diff)
Diffstat (limited to 'parser.cpp')
-rw-r--r--parser.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/parser.cpp b/parser.cpp
index 82c108a6..e0a79ea7 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -746,8 +746,8 @@ int parser_t::eval_args(const wchar_t *line, std::vector<completion_t> &args)
eval_args may be called while evaulating another command, so we
save the previous tokenizer and restore it on exit
*/
- scoped_push<tokenizer_t*> tokenizer_push(current_tokenizer, &tok);
- scoped_push<int> tokenizer_pos_push(current_tokenizer_pos, 0);
+ scoped_push<tokenizer_t*> tokenizer_push(&current_tokenizer, &tok);
+ scoped_push<int> tokenizer_pos_push(&current_tokenizer_pos, 0);
error_code=0;
@@ -1556,8 +1556,9 @@ void parser_t::parse_job_argument_list(process_t *p,
new_io.reset(new_io_file);
}
}
-
- if (new_io.get() != NULL) {
+
+ if (new_io.get() != NULL)
+ {
j->io.push_back(new_io);
}
@@ -1648,7 +1649,7 @@ int parser_t::parse_job(process_t *p,
bool allow_bogus_command = false; // If we are an elseif that will not be executed, or an AND or OR that will have been short circuited, don't complain about non-existent commands
block_t *prev_block = current_block;
- scoped_push<int> tokenizer_pos_push(current_tokenizer_pos, tok_get_pos(tok));
+ scoped_push<int> tokenizer_pos_push(&current_tokenizer_pos, tok_get_pos(tok));
while (args.empty())
{
@@ -2410,7 +2411,7 @@ void parser_t::eval_job(tokenizer_t *tok)
int was_builtin = 0;
if (j->first_process->type==INTERNAL_BUILTIN && !j->first_process->next)
was_builtin = 1;
- scoped_push<int> tokenizer_pos_push(current_tokenizer_pos, job_begin_pos);
+ scoped_push<int> tokenizer_pos_push(&current_tokenizer_pos, job_begin_pos);
exec(*this, j);
/* Only external commands require a new fishd barrier */
@@ -2552,9 +2553,9 @@ int parser_t::eval(const wcstring &cmdStr, const io_chain_t &io, enum block_type
block_t *start_current_block = current_block;
/* Record the current chain so we can put it back later */
- scoped_push<io_chain_t> block_io_push(block_io, io);
+ scoped_push<io_chain_t> block_io_push(&block_io, io);
- scoped_push<std::vector<wcstring> > forbidden_function_push(forbidden_function);
+ scoped_push<wcstring_list_t> forbidden_function_push(&forbidden_function);
if (block_type == SUBST)
{
@@ -2591,7 +2592,8 @@ int parser_t::eval(const wcstring &cmdStr, const io_chain_t &io, enum block_type
this->push_block(new scope_block_t(block_type));
- scoped_push<tokenizer_t*> tokenizer_push(current_tokenizer, new tokenizer_t(cmd, 0));
+ tokenizer_t local_tokenizer(cmd, 0);
+ scoped_push<tokenizer_t *> tokenizer_push(&current_tokenizer, &local_tokenizer);
error_code = 0;
@@ -2641,7 +2643,7 @@ int parser_t::eval(const wcstring &cmdStr, const io_chain_t &io, enum block_type
this->print_errors_stderr();
- delete current_tokenizer;
+ tokenizer_push.restore();
while (forbidden_function.size() > forbid_count)
parser_t::allow_function();
@@ -2819,8 +2821,8 @@ int parser_t::test_args(const wchar_t * buff, wcstring *out, const wchar_t *pre
CHECK(buff, 1);
tokenizer_t tok(buff, 0);
- scoped_push<tokenizer_t*> tokenizer_push(current_tokenizer, &tok);
- scoped_push<int> tokenizer_pos_push(current_tokenizer_pos);
+ scoped_push<tokenizer_t*> tokenizer_push(&current_tokenizer, &tok);
+ scoped_push<int> tokenizer_pos_push(&current_tokenizer_pos);
for (; do_loop && tok_has_next(&tok); tok_next(&tok))
{
@@ -2946,8 +2948,8 @@ int parser_t::test(const wchar_t *buff, int *block_level, wcstring *out, const w
tokenizer_t tok(buff, 0);
- scoped_push<tokenizer_t*> tokenizer_push(current_tokenizer, &tok);
- scoped_push<int> tokenizer_pos_push(current_tokenizer_pos);
+ scoped_push<tokenizer_t*> tokenizer_push(&current_tokenizer, &tok);
+ scoped_push<int> tokenizer_pos_push(&current_tokenizer_pos);
for (;; tok_next(&tok))
{