@@ -66,6 +66,7 @@ YueParser::YueParser() {
6666 space = -(and_ (set (" \t -\\ " )) >> *space_one >> -comment);
6767 space_break = space >> line_break;
6868 white = space >> *(line_break >> space);
69+ plain_white = plain_space >> *(line_break >> plain_space);
6970 alpha_num = range (' a' , ' z' ) | range (' A' , ' Z' ) | range (' 0' , ' 9' ) | ' _' ;
7071 not_alpha_num = not_ (alpha_num);
7172 Name = (range (' a' , ' z' ) | range (' A' , ' Z' ) | ' _' ) >> *alpha_num >> not_ (larger (255 ));
@@ -1109,15 +1110,16 @@ YueParser::YueParser() {
11091110 yue_line_comment;
11101111 YueComment =
11111112 check_indent >> comment_line >> and_ (stop) |
1112- advance >> ensure (comment_line, pop_indent) >> and_ (stop) |
1113- plain_space >> and_ (stop);
1113+ advance >> ensure (comment_line, pop_indent) >> and_ (stop);
1114+
1115+ EmptyLine = plain_space >> and_ (stop);
11141116
11151117 indentation_error = pl::user (not_ (pipe_operator | eof ()), [](const item_t & item) {
11161118 RaiseError (" unexpected indent" sv, item);
11171119 return false ;
11181120 });
11191121
1120- line = (
1122+ line = *(EmptyLine >> line_break) >> (
11211123 check_indent_match >> space >> Statement |
11221124 YueComment |
11231125 advance_match >> ensure (space >> (indentation_error | Statement), pop_indent)
@@ -1128,8 +1130,8 @@ YueParser::YueParser() {
11281130 }) >> lax_line >> *(line_break >> lax_line) | line >> *(line_break >> line));
11291131
11301132 shebang = " #!" >> *(not_ (stop) >> any_char);
1131- BlockEnd = Block >> stop;
1132- File = -shebang >> -Block >> stop;
1133+ BlockEnd = Block >> plain_white >> stop;
1134+ File = -shebang >> -Block >> plain_white >> stop;
11331135
11341136 lax_line = advance_match >> ensure (*(not_ (stop) >> any ()), pop_indent) | line >> and_ (stop) | check_indent_match >> *(not_ (stop) >> any ());
11351137}
0 commit comments