From acf20e1802b03fed63b845ac8c0274fff415fb22 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 6 Aug 2020 12:11:01 +0800 Subject: fix a case multiline binary operator expression conflicts with new statement started with an unary expression. --- src/MoonP/moon_compiler.cpp | 2 +- src/MoonP/moon_parser.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp index f517e27..1652e17 100644 --- a/src/MoonP/moon_compiler.cpp +++ b/src/MoonP/moon_compiler.cpp @@ -49,7 +49,7 @@ inline std::string s(std::string_view sv) { } const std::string_view version() { - return "0.4.7"sv; + return "0.4.8"sv; } // name of table stored in lua registry diff --git a/src/MoonP/moon_parser.cpp b/src/MoonP/moon_parser.cpp index 43e6887..6fa014f 100644 --- a/src/MoonP/moon_parser.cpp +++ b/src/MoonP/moon_parser.cpp @@ -308,9 +308,9 @@ MoonParser::MoonParser() { expo_exp = Value >> *expo_value; unary_operator = - expr('-') >> not_(expr('>') | space_one) | + expr('-') >> not_(set(">=") | space_one) | expr('#') | - expr('~') >> not_(space_one) | + expr('~') >> not_(expr('=') | space_one) | expr("not") >> not_(AlphaNum); unary_exp = *(Space >> unary_operator) >> expo_exp; @@ -331,7 +331,7 @@ MoonParser::MoonParser() { expr(">>") | expr("//") | set("+-*/%><|&~"); - exp_op_value = White >> BinaryOperator >> *SpaceBreak >> backcall_exp; + exp_op_value = (White >> not_(unary_operator) | Space) >> BinaryOperator >> *SpaceBreak >> backcall_exp; Exp = Seperator >> backcall_exp >> *exp_op_value; ChainValue = Seperator >> (Chain | Callable) >> -existential_op >> -InvokeArgs; -- cgit v1.2.3-55-g6feb