diff options
author | Li Jin <dragon-fly@qq.com> | 2022-09-26 17:38:37 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-09-26 17:38:37 +0800 |
commit | a6b6753fda9745f316f3236462b74794b35b85c9 (patch) | |
tree | 19165e68cde03aadd71b5caac9cc3b7785643dc1 | |
parent | 181708953ed4c13b3c0ff03752d50296b3e577ea (diff) | |
download | yuescript-a6b6753fda9745f316f3236462b74794b35b85c9.tar.gz yuescript-a6b6753fda9745f316f3236462b74794b35b85c9.tar.bz2 yuescript-a6b6753fda9745f316f3236462b74794b35b85c9.zip |
fix ending white space parsing.
-rwxr-xr-x | src/yuescript/yue_parser.cpp | 10 | ||||
-rwxr-xr-x | src/yuescript/yue_parser.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index c5cae0b..9fca97e 100755 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
@@ -659,20 +659,20 @@ YueParser::YueParser() { | |||
659 | 659 | ||
660 | Body = InBlock | Space >> Statement; | 660 | Body = InBlock | Space >> Statement; |
661 | 661 | ||
662 | empty_line_stop = ( | 662 | empty_line_break = ( |
663 | check_indent >> (MultiLineComment >> Space | Comment) | | 663 | check_indent >> (MultiLineComment >> Space | Comment) | |
664 | advance >> ensure(MultiLineComment >> Space | Comment, PopIndent) | | 664 | advance >> ensure(MultiLineComment >> Space | Comment, PopIndent) | |
665 | plain_space) >> and_(Stop); | 665 | plain_space) >> and_(Break); |
666 | 666 | ||
667 | Line = | 667 | Line = |
668 | CheckIndent >> Statement | | 668 | CheckIndent >> Statement | |
669 | Advance >> ensure(Space >> and_(PipeOperator) >> Statement, PopIndent) | | 669 | Advance >> ensure(Space >> and_(PipeOperator) >> Statement, PopIndent) | |
670 | empty_line_stop; | 670 | empty_line_break; |
671 | Block = Seperator >> Line >> *(+Break >> Line); | 671 | Block = Seperator >> Line >> *(+Break >> Line); |
672 | 672 | ||
673 | Shebang = expr("#!") >> *(not_(Stop) >> Any); | 673 | Shebang = expr("#!") >> *(not_(Stop) >> Any); |
674 | BlockEnd = Block >> Stop; | 674 | BlockEnd = Block >> White >> Stop; |
675 | File = -Shebang >> -Block >> Stop; | 675 | File = -Shebang >> -Block >> White >> Stop; |
676 | } | 676 | } |
677 | // clang-format on | 677 | // clang-format on |
678 | 678 | ||
diff --git a/src/yuescript/yue_parser.h b/src/yuescript/yue_parser.h index 7085d04..62f507e 100755 --- a/src/yuescript/yue_parser.h +++ b/src/yuescript/yue_parser.h | |||
@@ -195,7 +195,7 @@ private: | |||
195 | rule expo_exp; | 195 | rule expo_exp; |
196 | rule exp_not_tab; | 196 | rule exp_not_tab; |
197 | rule local_const_item; | 197 | rule local_const_item; |
198 | rule empty_line_stop; | 198 | rule empty_line_break; |
199 | rule yue_comment; | 199 | rule yue_comment; |
200 | rule yue_line_comment; | 200 | rule yue_line_comment; |
201 | rule yue_multiline_comment; | 201 | rule yue_multiline_comment; |