diff options
Diffstat (limited to 'src/yuescript/yue_parser.cpp')
-rw-r--r-- | src/yuescript/yue_parser.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index 4532d21..2fc1333 100644 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
@@ -387,7 +387,7 @@ YueParser::YueParser() { | |||
387 | 387 | ||
388 | Comprehension = '[' >> not_('[') >> space >> Exp >> space >> CompInner >> space >> ']'; | 388 | Comprehension = '[' >> not_('[') >> space >> Exp >> space >> CompInner >> space >> ']'; |
389 | CompValue = ',' >> space >> Exp; | 389 | CompValue = ',' >> space >> Exp; |
390 | TblComprehension = '{' >> space >> Exp >> space >> -(CompValue >> space) >> CompInner >> space >> '}'; | 390 | TblComprehension = '{' >> (space >> Exp >> space >> -(CompValue >> space) >> CompInner >> space >> '}' | braces_expression_error); |
391 | 391 | ||
392 | CompInner = Seperator >> (CompForEach | CompFor) >> *(space >> comp_clause); | 392 | CompInner = Seperator >> (CompForEach | CompFor) >> *(space >> comp_clause); |
393 | StarExp = '*' >> space >> Exp; | 393 | StarExp = '*' >> space >> Exp; |
@@ -736,6 +736,11 @@ YueParser::YueParser() { | |||
736 | 736 | ||
737 | ConstValue = (expr("nil") | "true" | "false") >> not_alpha_num; | 737 | ConstValue = (expr("nil") | "true" | "false") >> not_alpha_num; |
738 | 738 | ||
739 | braces_expression_error = pl::user("{", [](const item_t& item) { | ||
740 | throw ParserError("invalid brace expression", *item.begin, *item.end); | ||
741 | return false; | ||
742 | }); | ||
743 | |||
739 | SimpleValue = | 744 | SimpleValue = |
740 | TableLit | ConstValue | If | Switch | Try | With | | 745 | TableLit | ConstValue | If | Switch | Try | With | |
741 | ClassDecl | ForEach | For | While | Do | | 746 | ClassDecl | ForEach | For | While | Do | |