Fixed parsing of block statements vs initializer expressions.

This commit is contained in:
Jonathan Turner
2011-10-01 10:19:45 -06:00
parent e1e0561c7e
commit bc75df4d58
2 changed files with 7 additions and 7 deletions

View File

@@ -1605,7 +1605,7 @@ namespace chaiscript
retval = true; retval = true;
Container_Arg_List(); Container_Arg_List();
if (!Char('}')) { if (!Char('}')) {
throw exception::eval_error("Missing closing square bracket", File_Position(m_line, m_col), *m_filename); throw exception::eval_error("Missing closing curly bracket", File_Position(m_line, m_col), *m_filename);
} }
if ((prev_stack_top != m_match_stack.size()) && (m_match_stack.back()->children.size() > 0)) { if ((prev_stack_top != m_match_stack.size()) && (m_match_stack.back()->children.size() > 0)) {
if (m_match_stack.back()->children[0]->identifier == AST_Node_Type::Value_Range) { if (m_match_stack.back()->children[0]->identifier == AST_Node_Type::Value_Range) {
@@ -1977,6 +1977,11 @@ namespace chaiscript
retval = true; retval = true;
saw_eol = false; saw_eol = false;
} }
else if (Block()) {
has_more = true;
retval = true;
saw_eol = true;
}
else if (Equation()) { else if (Equation()) {
if (!saw_eol) { if (!saw_eol) {
throw exception::eval_error("Two expressions missing line separator", File_Position(prev_line, prev_col), *m_filename); throw exception::eval_error("Two expressions missing line separator", File_Position(prev_line, prev_col), *m_filename);
@@ -1990,11 +1995,6 @@ namespace chaiscript
retval = true; retval = true;
saw_eol = true; saw_eol = true;
} }
else if (Block()) {
has_more = true;
retval = true;
saw_eol = true;
}
else { else {
has_more = false; has_more = false;
} }

View File

@@ -259,7 +259,7 @@ def generate_range(x, y) { \n\
}\n\ }\n\
# Returns a new Vector with the first value to the second value as its elements\n\ # Returns a new Vector with the first value to the second value as its elements\n\
def collate(x, y) { \n\ def collate(x, y) { \n\
{x, y}; \n\ return {x, y}; \n\
} \n\ } \n\
def zip_with(f, x, y, inserter) : call_exists(range, x) && call_exists(range, y) { \n\ def zip_with(f, x, y, inserter) : call_exists(range, x) && call_exists(range, y) { \n\
auto r_x = range(x); \n\ auto r_x = range(x); \n\