From b2a99d41055543fd31c1508ea5deeeb4c301fc97 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Sat, 4 Jul 2009 02:17:50 +0000 Subject: [PATCH] Add modulus operator to parser --- chaiscript/chaiscript_parser.hpp | 4 ++-- chaiscript/chaiscript_prelude.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chaiscript/chaiscript_parser.hpp b/chaiscript/chaiscript_parser.hpp index 569a0330..c7f0655a 100644 --- a/chaiscript/chaiscript_parser.hpp +++ b/chaiscript/chaiscript_parser.hpp @@ -1132,12 +1132,12 @@ namespace chaiscript if (Dot_Access()) { retval = true; - if (Symbol("*", true) || Symbol("/", true)) { + if (Symbol("*", true) || Symbol("/", true) || Symbol("%", true)) { do { if (!Dot_Access()) { 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); } diff --git a/chaiscript/chaiscript_prelude.hpp b/chaiscript/chaiscript_prelude.hpp index 10178bb3..c9ab7e2b 100644 --- a/chaiscript/chaiscript_prelude.hpp +++ b/chaiscript/chaiscript_prelude.hpp @@ -8,7 +8,7 @@ const char *chaiscript_prelude = " \ def to_string(x) : call_exists(first, x) && call_exists(second, x) { \n\ \"<\" + x.first.to_string() + \", \" + x.second.to_string() + \">\"\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\ }\n\ def to_string(x) { \n\