aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2023-01-11 16:06:02 +0800
committerLi Jin <dragon-fly@qq.com>2023-01-11 16:06:31 +0800
commit0cc452c7cf2301e75bab1069c9da6ee73c7c5cfd (patch)
tree80fd0daf283ed033e2170c853fa7a3b0aa8620ce
parenta794024dce6a741719a70c9ab5b4b0fa1afb531b (diff)
downloadyuescript-0.15.21.tar.gz
yuescript-0.15.21.tar.bz2
yuescript-0.15.21.zip
fix issue #120.v0.15.21
-rw-r--r--src/yuescript/yue_compiler.cpp2
-rw-r--r--src/yuescript/yue_parser.cpp19
2 files changed, 11 insertions, 10 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index db59c08..6d33a7e 100644
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -71,7 +71,7 @@ static std::unordered_set<std::string> Metamethods = {
71 "close"s // Lua 5.4 71 "close"s // Lua 5.4
72}; 72};
73 73
74const std::string_view version = "0.15.20"sv; 74const std::string_view version = "0.15.21"sv;
75const std::string_view extension = "yue"sv; 75const std::string_view extension = "yue"sv;
76 76
77class YueCompilerImpl { 77class YueCompilerImpl {
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp
index acdc343..d23ff4b 100644
--- a/src/yuescript/yue_parser.cpp
+++ b/src/yuescript/yue_parser.cpp
@@ -363,10 +363,10 @@ YueParser::YueParser() {
363 363
364 Assignable = Space >> (AssignableChain | Variable | SelfName); 364 Assignable = Space >> (AssignableChain | Variable | SelfName);
365 365
366 unary_value = unary_operator >> *(Space >> unary_operator) >> Value; 366 unary_value = +(unary_operator >> Space) >> Value;
367 367
368 ExponentialOperator = expr('^'); 368 ExponentialOperator = expr('^');
369 expo_value = Space >> ExponentialOperator >> *SpaceBreak >> Value; 369 expo_value = Space >> ExponentialOperator >> *SpaceBreak >> Space >> Value;
370 expo_exp = Value >> *expo_value; 370 expo_exp = Value >> *expo_value;
371 371
372 unary_operator = 372 unary_operator =
@@ -374,7 +374,7 @@ YueParser::YueParser() {
374 expr('#') | 374 expr('#') |
375 expr('~') >> not_(expr('=') | space_one) | 375 expr('~') >> not_(expr('=') | space_one) |
376 expr("not") >> not_(AlphaNum); 376 expr("not") >> not_(AlphaNum);
377 unary_exp = *(Space >> unary_operator) >> expo_exp; 377 unary_exp = Space >> *(unary_operator >> Space) >> expo_exp;
378 378
379 PipeOperator = expr("|>"); 379 PipeOperator = expr("|>");
380 pipe_value = Space >> PipeOperator >> *SpaceBreak >> unary_exp; 380 pipe_value = Space >> PipeOperator >> *SpaceBreak >> unary_exp;
@@ -414,10 +414,10 @@ YueParser::YueParser() {
414 return st->noChainBlockStack.empty() || !st->noChainBlockStack.top(); 414 return st->noChainBlockStack.empty() || !st->noChainBlockStack.top();
415 }) >> +SpaceBreak >> Advance >> ensure( 415 }) >> +SpaceBreak >> Advance >> ensure(
416 chain_line >> *(+SpaceBreak >> chain_line), PopIndent); 416 chain_line >> *(+SpaceBreak >> chain_line), PopIndent);
417 ChainValue = Space >> Seperator >> (Chain | Callable) >> -existential_op >> -(InvokeArgs | chain_block) >> -table_appending_op; 417 ChainValue = Seperator >> (Chain | Callable) >> -existential_op >> -(InvokeArgs | chain_block) >> -table_appending_op;
418 418
419 simple_table = Seperator >> KeyValue >> *(sym(',') >> KeyValue); 419 simple_table = Seperator >> KeyValue >> *(sym(',') >> KeyValue);
420 Value = SimpleValue | simple_table | ChainValue | Space >> String; 420 Value = SimpleValue | simple_table | ChainValue | String;
421 421
422 single_string_inner = expr('\\') >> set("'\\") | not_(expr('\'')) >> Any; 422 single_string_inner = expr('\\') >> set("'\\") | not_(expr('\'')) >> Any;
423 SingleString = symx('\'') >> *single_string_inner >> symx('\''); 423 SingleString = symx('\'') >> *single_string_inner >> symx('\'');
@@ -663,10 +663,11 @@ YueParser::YueParser() {
663 663
664 const_value = (expr("nil") | expr("true") | expr("false")) >> not_(AlphaNum); 664 const_value = (expr("nil") | expr("true") | expr("false")) >> not_(AlphaNum);
665 665
666 SimpleValue = Space >> (const_value | 666 SimpleValue =
667 If | Switch | Try | With | ClassDecl | ForEach | For | While | Do | 667 TableLit | const_value | If | Switch | Try | With |
668 unary_value | TblComprehension | TableLit | Comprehension | 668 ClassDecl | ForEach | For | While | Do |
669 FunLit | Num); 669 unary_value | TblComprehension | Comprehension |
670 FunLit | Num;
670 671
671 ExpListAssign = ExpList >> -(Update | Assign) >> not_(Space >> expr('=')); 672 ExpListAssign = ExpList >> -(Update | Assign) >> not_(Space >> expr('='));
672 673