diff --git a/include/chaiscript/language/chaiscript_parser.hpp b/include/chaiscript/language/chaiscript_parser.hpp index fd58ef2c..0e186e30 100644 --- a/include/chaiscript/language/chaiscript_parser.hpp +++ b/include/chaiscript/language/chaiscript_parser.hpp @@ -1459,12 +1459,9 @@ namespace chaiscript * Reads a switch statement from input */ bool Switch() { - bool retval = false; - size_t prev_stack_top = m_match_stack.size(); if (Keyword("switch")) { - retval = true; if (!Char('(')) { throw exception::eval_error("Incomplete 'switch' expression", File_Position(m_line, m_col), *m_filename); @@ -1477,8 +1474,6 @@ namespace chaiscript while (Eol()) {} if (Char('{')) { - retval = true; - while (Eol()) {} while (Case()) { @@ -1496,9 +1491,12 @@ namespace chaiscript } build_match(AST_NodePtr(new eval::Switch_AST_Node()), prev_stack_top); + return true; + + } else { + return false; } - return retval; } /** @@ -1971,7 +1969,6 @@ namespace chaiscript bool saw_eol = true; while (has_more) { - has_more = false; int prev_line = m_line; int prev_col = m_col; if (Def()) {