diff options
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 | ||||
-rw-r--r-- | src/yuescript/yue_parser.cpp | 19 |
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 | ||
74 | const std::string_view version = "0.15.20"sv; | 74 | const std::string_view version = "0.15.21"sv; |
75 | const std::string_view extension = "yue"sv; | 75 | const std::string_view extension = "yue"sv; |
76 | 76 | ||
77 | class YueCompilerImpl { | 77 | class 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 | ||