aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-07-13 00:31:26 +0800
committerLi Jin <dragon-fly@qq.com>2022-07-13 00:31:26 +0800
commitaa194667c7cb7bb70f2a58477555d1419ae33eb0 (patch)
tree292178acd6346f28c241d4ad660bfa03431bec9d
parent9beb7e00e8b030fdd7c3ecbad3f7ebe8ca14fda6 (diff)
downloadyuescript-aa194667c7cb7bb70f2a58477555d1419ae33eb0.tar.gz
yuescript-aa194667c7cb7bb70f2a58477555d1419ae33eb0.tar.bz2
yuescript-aa194667c7cb7bb70f2a58477555d1419ae33eb0.zip
report syntax error when mix destructures and other expressions in switch when branches.
-rwxr-xr-xsrc/yuescript/yue_compiler.cpp2
-rwxr-xr-xsrc/yuescript/yue_parser.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index 83bad2e..c7ceeb4 100755
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -56,7 +56,7 @@ using namespace parserlib;
56 56
57typedef std::list<std::string> str_list; 57typedef std::list<std::string> str_list;
58 58
59const std::string_view version = "0.13.1"sv; 59const std::string_view version = "0.13.2"sv;
60const std::string_view extension = "yue"sv; 60const std::string_view extension = "yue"sv;
61 61
62class YueCompilerImpl { 62class YueCompilerImpl {
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp
index 199c0bd..66043d3 100755
--- a/src/yuescript/yue_parser.cpp
+++ b/src/yuescript/yue_parser.cpp
@@ -237,7 +237,7 @@ YueParser::YueParser() {
237 237
238 exp_not_tab = not_(simple_table | TableLit) >> Exp; 238 exp_not_tab = not_(simple_table | TableLit) >> Exp;
239 239
240 SwitchList = Seperator >> Exp >> *(sym(',') >> exp_not_tab); 240 SwitchList = Seperator >> (and_(simple_table | TableLit) >> Exp | exp_not_tab >> *(sym(',') >> exp_not_tab));
241 Switch = Space >> key("switch") >> disable_do(Exp) >> -(Space >> key("do")) 241 Switch = Space >> key("switch") >> disable_do(Exp) >> -(Space >> key("do"))
242 >> -Space >> Break >> SwitchBlock; 242 >> -Space >> Break >> SwitchBlock;
243 243