diff options
Diffstat (limited to 'src/yuescript/yue_parser.cpp')
-rwxr-xr-x | src/yuescript/yue_parser.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index 78b4713..199c0bd 100755 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
@@ -225,7 +225,7 @@ YueParser::YueParser() { | |||
225 | WithExp = ExpList >> -Assign; | 225 | WithExp = ExpList >> -Assign; |
226 | 226 | ||
227 | With = Space >> key("with") >> -existential_op >> disable_do_chain_arg_table_block(WithExp) >> plain_body_with("do"); | 227 | With = Space >> key("with") >> -existential_op >> disable_do_chain_arg_table_block(WithExp) >> plain_body_with("do"); |
228 | SwitchCase = Space >> key("when") >> disable_chain(disable_arg_table_block(ExpList)) >> plain_body_with("then"); | 228 | SwitchCase = Space >> key("when") >> disable_chain(disable_arg_table_block(SwitchList)) >> plain_body_with("then"); |
229 | SwitchElse = Space >> key("else") >> plain_body; | 229 | SwitchElse = Space >> key("else") >> plain_body; |
230 | 230 | ||
231 | SwitchBlock = *EmptyLine >> | 231 | SwitchBlock = *EmptyLine >> |
@@ -235,6 +235,9 @@ YueParser::YueParser() { | |||
235 | -(Break >> *EmptyLine >> CheckIndent >> SwitchElse) >> | 235 | -(Break >> *EmptyLine >> CheckIndent >> SwitchElse) >> |
236 | PopIndent; | 236 | PopIndent; |
237 | 237 | ||
238 | exp_not_tab = not_(simple_table | TableLit) >> Exp; | ||
239 | |||
240 | SwitchList = Seperator >> Exp >> *(sym(',') >> exp_not_tab); | ||
238 | Switch = Space >> key("switch") >> disable_do(Exp) >> -(Space >> key("do")) | 241 | Switch = Space >> key("switch") >> disable_do(Exp) >> -(Space >> key("do")) |
239 | >> -Space >> Break >> SwitchBlock; | 242 | >> -Space >> Break >> SwitchBlock; |
240 | 243 | ||
@@ -550,14 +553,14 @@ YueParser::YueParser() { | |||
550 | symx(':') >> not_(':') >> | 553 | symx(':') >> not_(':') >> |
551 | (Exp | TableBlock | +SpaceBreak >> Exp); | 554 | (Exp | TableBlock | +SpaceBreak >> Exp); |
552 | 555 | ||
553 | default_pair = (sym(':') >> Variable >> not_('#') >> Seperator | KeyName >> symx(':') >> Seperator >> Exp | Exp >> Seperator) >> sym('=') >> Exp; | 556 | default_pair = (sym(':') >> Variable >> not_('#') >> Seperator | KeyName >> symx(':') >> Seperator >> exp_not_tab | exp_not_tab >> Seperator) >> sym('=') >> Exp; |
554 | 557 | ||
555 | meta_variable_pair = sym(':') >> Variable >> expr('#'); | 558 | meta_variable_pair = sym(':') >> Variable >> expr('#'); |
556 | 559 | ||
557 | meta_normal_pair = Space >> -(Name | symx('[') >> not_('[') >> Exp >> sym(']')) >> expr("#:") >> | 560 | meta_normal_pair = Space >> -(Name | symx('[') >> not_('[') >> Exp >> sym(']')) >> expr("#:") >> |
558 | (Exp | TableBlock | +(SpaceBreak) >> Exp); | 561 | (Exp | TableBlock | +(SpaceBreak) >> Exp); |
559 | 562 | ||
560 | meta_default_pair = (sym(':') >> Variable >> expr('#') >> Seperator | Space >> -Name >> expr("#:") >> Seperator >> Exp) >> sym('=') >> Exp; | 563 | meta_default_pair = (sym(':') >> Variable >> expr('#') >> Seperator | Space >> -Name >> expr("#:") >> Seperator >> exp_not_tab) >> sym('=') >> Exp; |
561 | 564 | ||
562 | KeyValue = variable_pair | normal_pair | meta_variable_pair | meta_normal_pair; | 565 | KeyValue = variable_pair | normal_pair | meta_variable_pair | meta_normal_pair; |
563 | KeyValueList = KeyValue >> *(sym(',') >> KeyValue); | 566 | KeyValueList = KeyValue >> *(sym(',') >> KeyValue); |