aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-02 13:11:17 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-03-02 13:11:17 -0800
commit6b3a37c59785872eb62112e9045e7cc2b2e2406e (patch)
treef1d6ef0ac083f4ba319bc34d1b17bf9ec35e244f /parser.cpp
parentb187125b636c14253d626e4c2470f89e192168cf (diff)
Remove obviated builtins and additional cleanup of old parser
Diffstat (limited to 'parser.cpp')
-rw-r--r--parser.cpp111
1 files changed, 3 insertions, 108 deletions
diff --git a/parser.cpp b/parser.cpp
index de1a635a..f23ddda9 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -349,93 +349,6 @@ block_t *parser_t::current_block()
return block_stack.empty() ? NULL : block_stack.back();
}
-/**
- Search the text for the end of the current block
-*/
-static const wchar_t *parser_find_end(const wchar_t * buff)
-{
- int had_cmd=0;
- int count = 0;
- int error=0;
- int mark=0;
-
- CHECK(buff, 0);
-
- tokenizer_t tok(buff, 0);
- for (; tok_has_next(&tok) && !error; tok_next(&tok))
- {
- int last_type = tok_last_type(&tok);
- switch (last_type)
- {
- case TOK_STRING:
- {
- if (!had_cmd)
- {
- if (wcscmp(tok_last(&tok), L"end")==0)
- {
- count--;
- }
- else if (parser_keywords_is_block(tok_last(&tok)))
- {
- count++;
- }
-
- if (count < 0)
- {
- error = 1;
- }
- had_cmd = 1;
- }
- break;
- }
-
- case TOK_END:
- {
- had_cmd = 0;
- break;
- }
-
- case TOK_PIPE:
- case TOK_BACKGROUND:
- {
- if (had_cmd)
- {
- had_cmd = 0;
- }
- else
- {
- error = 1;
- }
- break;
-
- }
-
- case TOK_ERROR:
- error = 1;
- break;
-
- default:
- break;
-
- }
- if (!count)
- {
- tok_next(&tok);
- mark = tok_get_pos(&tok);
- break;
- }
-
- }
- if (!count && !error)
- {
-
- return buff+mark;
- }
- return 0;
-
-}
-
-
void parser_t::forbid_function(const wcstring &function)
{
forbidden_function.push_back(function);
@@ -826,29 +739,11 @@ 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))
- return -1;
-
- lineno = current_tokenizer->line_number_of_character_at_offset(current_tokenizer_pos);
-
- const wchar_t *function_name;
- if ((function_name = is_function()))
+ int lineno = -1;
+ if (! execution_contexts.empty())
{
- lineno += function_get_definition_offset(function_name);
+ lineno = execution_contexts.back()->get_current_line_number();
}
-
return lineno;
}