Add modulus operator to parser
This commit is contained in:
@@ -1132,12 +1132,12 @@ namespace chaiscript
|
|||||||
|
|
||||||
if (Dot_Access()) {
|
if (Dot_Access()) {
|
||||||
retval = true;
|
retval = true;
|
||||||
if (Symbol("*", true) || Symbol("/", true)) {
|
if (Symbol("*", true) || Symbol("/", true) || Symbol("%", true)) {
|
||||||
do {
|
do {
|
||||||
if (!Dot_Access()) {
|
if (!Dot_Access()) {
|
||||||
throw Parse_Error("Incomplete math expression", File_Position(line, col), filename);
|
throw Parse_Error("Incomplete math expression", File_Position(line, col), filename);
|
||||||
}
|
}
|
||||||
} while (retval && (Symbol("*", true) || Symbol("/", true)));
|
} while (retval && (Symbol("*", true) || Symbol("/", true) || Symbol("%", true)));
|
||||||
|
|
||||||
build_match(Token_Type::Multiplicative, prev_stack_top);
|
build_match(Token_Type::Multiplicative, prev_stack_top);
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@ const char *chaiscript_prelude = " \
|
|||||||
def to_string(x) : call_exists(first, x) && call_exists(second, x) { \n\
|
def to_string(x) : call_exists(first, x) && call_exists(second, x) { \n\
|
||||||
\"<\" + x.first.to_string() + \", \" + x.second.to_string() + \">\"\n\
|
\"<\" + x.first.to_string() + \", \" + x.second.to_string() + \">\"\n\
|
||||||
}\n\
|
}\n\
|
||||||
def to_string(x) : !is_type(\"string\", x) && call_exists(range, x) { \n\
|
def to_string(x) : call_exists(range, x) && !is_type(\"string\", x){ \n\
|
||||||
\"[\" + x.join(\", \") + \"]\"\n\
|
\"[\" + x.join(\", \") + \"]\"\n\
|
||||||
}\n\
|
}\n\
|
||||||
def to_string(x) { \n\
|
def to_string(x) { \n\
|
||||||
|
Reference in New Issue
Block a user