diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-11-04 17:11:02 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-11-04 17:11:02 -0800 |
commit | 7bb844a77835b446365aa56729483927acc6c561 (patch) | |
tree | 437a4eccf47112b0e1c83799f933a5e1a3f04247 /parser.cpp | |
parent | 8c24d49c732624e6fefbab637940afa1a789cb1c (diff) |
Fix bug where 'else if' does not support functions and redirections
Diffstat (limited to 'parser.cpp')
-rw-r--r-- | parser.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1309,11 +1309,13 @@ job_t *parser_t::job_get_from_pid( int pid ) \param j the job to which the process belongs to \param tok the tokenizer to read options from \param args the argument list to insert options into + \param args unskip whether we should ignore current_block->skip. Big hack because of our dumb handling of if statements. */ void parser_t::parse_job_argument_list( process_t *p, job_t *j, tokenizer *tok, - std::vector<completion_t> &args ) + std::vector<completion_t> &args, + bool unskip ) { int is_finished=0; @@ -1401,7 +1403,7 @@ void parser_t::parse_job_argument_list( process_t *p, { skip = 1; } - else if( current_block->skip ) + else if( current_block->skip && ! unskip ) { /* If this command should be skipped, we do not expand the arguments @@ -1505,7 +1507,7 @@ void parser_t::parse_job_argument_list( process_t *p, Otherwise, bogus errors may be the result. (Do check that token is string, though) */ - if( current_block->skip ) + if( current_block->skip && ! unskip ) { tok_next( tok ); if( tok_last_type( tok ) != TOK_STRING ) @@ -1965,7 +1967,7 @@ int parser_t::parse_job( process_t *p, continue; } - if( use_function && !current_block->skip ) + if( use_function && ( unskip || ! current_block->skip )) { bool nxt_forbidden=false; wcstring forbid; @@ -2267,7 +2269,7 @@ int parser_t::parse_job( process_t *p, } else { - parse_job_argument_list(p, j, tok, args); + parse_job_argument_list(p, j, tok, args, unskip); } } |