diff options
Diffstat (limited to 'src/yuescript/yue_parser.cpp')
-rw-r--r-- | src/yuescript/yue_parser.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index e755fb2..b1f29a9 100644 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
@@ -650,7 +650,7 @@ YueParser::YueParser() { | |||
650 | unary_value | TblComprehension | TableLit | Comprehension | | 650 | unary_value | TblComprehension | TableLit | Comprehension | |
651 | FunLit | Num); | 651 | FunLit | Num); |
652 | 652 | ||
653 | ExpListAssign = ExpList >> -(Update | Assign); | 653 | ExpListAssign = ExpList >> -(Update | Assign) >> not_(Space >> expr('=')); |
654 | 654 | ||
655 | if_line = Space >> IfType >> IfCond; | 655 | if_line = Space >> IfType >> IfCond; |
656 | while_line = Space >> WhileType >> Exp; | 656 | while_line = Space >> WhileType >> Exp; |
@@ -661,13 +661,15 @@ YueParser::YueParser() { | |||
661 | yue_multiline_comment = multi_line_open >> YueMultilineComment >> multi_line_close; | 661 | yue_multiline_comment = multi_line_open >> YueMultilineComment >> multi_line_close; |
662 | yue_comment = check_indent >> (yue_multiline_comment >> *(set(" \t") | yue_multiline_comment) >> -yue_line_comment | yue_line_comment) >> and_(Break); | 662 | yue_comment = check_indent >> (yue_multiline_comment >> *(set(" \t") | yue_multiline_comment) >> -yue_line_comment | yue_line_comment) >> and_(Break); |
663 | 663 | ||
664 | ChainAssign = Seperator >> Exp >> +(sym('=') >> Exp >> Space >> and_('=')) >> Assign; | ||
665 | |||
664 | statement_appendix = (if_line | while_line | CompInner) >> Space; | 666 | statement_appendix = (if_line | while_line | CompInner) >> Space; |
665 | statement_sep = and_(*SpaceBreak >> CheckIndent >> Space >> (set("($'\"") | expr("[[") | expr("[="))); | 667 | statement_sep = and_(*SpaceBreak >> CheckIndent >> Space >> (set("($'\"") | expr("[[") | expr("[="))); |
666 | Statement = Seperator >> -(yue_comment >> *(Break >> yue_comment) >> Break >> CheckIndent) >> Space >> ( | 668 | Statement = Seperator >> -(yue_comment >> *(Break >> yue_comment) >> Break >> CheckIndent) >> Space >> ( |
667 | Import | While | Repeat | For | ForEach | | 669 | Import | While | Repeat | For | ForEach | |
668 | Return | Local | Global | Export | Macro | | 670 | Return | Local | Global | Export | Macro | |
669 | MacroInPlace | BreakLoop | Label | Goto | ShortTabAppending | | 671 | MacroInPlace | BreakLoop | Label | Goto | ShortTabAppending | |
670 | LocalAttrib | Backcall | PipeBody | ExpListAssign | | 672 | LocalAttrib | Backcall | PipeBody | ExpListAssign | ChainAssign | |
671 | statement_appendix >> empty_block_error | 673 | statement_appendix >> empty_block_error |
672 | ) >> Space >> | 674 | ) >> Space >> |
673 | -statement_appendix >> -statement_sep; | 675 | -statement_appendix >> -statement_sep; |
@@ -679,7 +681,7 @@ YueParser::YueParser() { | |||
679 | advance >> ensure(MultiLineComment >> Space | Comment, PopIndent) | | 681 | advance >> ensure(MultiLineComment >> Space | Comment, PopIndent) | |
680 | plain_space) >> and_(Break); | 682 | plain_space) >> and_(Break); |
681 | 683 | ||
682 | indentation_error = pl::user(not_(PipeOperator), [](const item_t& item) { | 684 | indentation_error = pl::user(not_(PipeOperator | eof()), [](const item_t& item) { |
683 | throw ParserError("unexpected indent", *item.begin, *item.end); | 685 | throw ParserError("unexpected indent", *item.begin, *item.end); |
684 | return false; | 686 | return false; |
685 | }); | 687 | }); |