Change 'elseif' to 'else if' to better support C++ expectations
This commit is contained in:
@@ -531,7 +531,7 @@ namespace chaiscript
|
|||||||
cond = dispatchkit::boxed_cast<bool &>(retval);
|
cond = dispatchkit::boxed_cast<bool &>(retval);
|
||||||
}
|
}
|
||||||
catch (const dispatchkit::bad_boxed_cast &) {
|
catch (const dispatchkit::bad_boxed_cast &) {
|
||||||
throw Eval_Error("Elseif condition not boolean", node->children[i+1]);
|
throw Eval_Error("'else if' condition not boolean", node->children[i+1]);
|
||||||
}
|
}
|
||||||
if (cond) {
|
if (cond) {
|
||||||
retval = eval_token(ss, node->children[i+2]);
|
retval = eval_token(ss, node->children[i+2]);
|
||||||
|
@@ -846,7 +846,9 @@ namespace chaiscript
|
|||||||
while (has_matches) {
|
while (has_matches) {
|
||||||
while (Eol());
|
while (Eol());
|
||||||
has_matches = false;
|
has_matches = false;
|
||||||
if (Keyword("elseif", true)) {
|
if (Keyword("else", true)) {
|
||||||
|
if (Keyword("if")) {
|
||||||
|
match_stack.back()->text = "else if";
|
||||||
if (!Char('(')) {
|
if (!Char('(')) {
|
||||||
throw Eval_Error("Incomplete 'else if' expression", File_Position(line, col), filename);
|
throw Eval_Error("Incomplete 'else if' expression", File_Position(line, col), filename);
|
||||||
}
|
}
|
||||||
@@ -862,7 +864,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
has_matches = true;
|
has_matches = true;
|
||||||
}
|
}
|
||||||
else if (Keyword("else", true)) {
|
else {
|
||||||
while (Eol());
|
while (Eol());
|
||||||
|
|
||||||
if (!Block()) {
|
if (!Block()) {
|
||||||
@@ -871,6 +873,7 @@ namespace chaiscript
|
|||||||
has_matches = true;
|
has_matches = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
build_match(Token_Type::If, prev_stack_top);
|
build_match(Token_Type::If, prev_stack_top);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user