diff options
Diffstat (limited to 'src/yuescript/yue_parser.cpp')
-rw-r--r-- | src/yuescript/yue_parser.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index 3f1b9a1..24f821c 100644 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
@@ -242,18 +242,21 @@ YueParser::YueParser() { | |||
242 | SwitchCase = Space >> key("when") >> disable_chain(disable_arg_table_block(SwitchList)) >> body_with("then"); | 242 | SwitchCase = Space >> key("when") >> disable_chain(disable_arg_table_block(SwitchList)) >> body_with("then"); |
243 | SwitchElse = Space >> key("else") >> body; | 243 | SwitchElse = Space >> key("else") >> body; |
244 | 244 | ||
245 | SwitchBlock = *EmptyLine >> | 245 | SwitchBlock = |
246 | Advance >> Seperator >> | ||
247 | SwitchCase >> | ||
248 | *(Break >> *EmptyLine >> CheckIndent >> SwitchCase) >> | 246 | *(Break >> *EmptyLine >> CheckIndent >> SwitchCase) >> |
249 | -(Break >> *EmptyLine >> CheckIndent >> SwitchElse) >> | 247 | -(Break >> *EmptyLine >> CheckIndent >> SwitchElse); |
250 | PopIndent; | ||
251 | 248 | ||
252 | exp_not_tab = not_(simple_table | TableLit) >> Exp; | 249 | exp_not_tab = not_(simple_table | TableLit) >> Exp; |
253 | 250 | ||
254 | SwitchList = Seperator >> (and_(simple_table | TableLit) >> Exp | exp_not_tab >> *(sym(',') >> exp_not_tab)); | 251 | SwitchList = Seperator >> (and_(simple_table | TableLit) >> Exp | exp_not_tab >> *(sym(',') >> exp_not_tab)); |
255 | Switch = Space >> key("switch") >> disable_do(Exp) >> -(Space >> key("do")) | 252 | Switch = Space >> key("switch") >> Exp >> |
256 | >> -Space >> Break >> SwitchBlock; | 253 | Seperator >> ( |
254 | SwitchCase >> Space >> ( | ||
255 | Break >> *EmptyLine >> CheckIndent >> SwitchCase >> SwitchBlock | | ||
256 | *SwitchCase >> -SwitchElse | ||
257 | ) | | ||
258 | SpaceBreak >> *EmptyLine >> Advance >> SwitchCase >> SwitchBlock >> PopIndent | ||
259 | ) >> SwitchBlock; | ||
257 | 260 | ||
258 | assignment = ExpList >> Assign; | 261 | assignment = ExpList >> Assign; |
259 | IfCond = disable_chain(disable_arg_table_block(assignment | Exp)); | 262 | IfCond = disable_chain(disable_arg_table_block(assignment | Exp)); |