Fix lexer on sth followed by comments (#4739)

This commit is contained in:
Yip Coekjan 2024-08-16 03:53:15 +08:00 committed by GitHub
parent 351bac8b68
commit ccd4524106
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 1 deletions

View File

@ -503,7 +503,10 @@ impl Lexer<'_> {
}
fn space_or_end(&self) -> bool {
self.s.done() || self.s.at(char::is_whitespace)
self.s.done()
|| self.s.at(char::is_whitespace)
|| self.s.at("//")
|| self.s.at("/*")
}
}

View File

@ -34,6 +34,41 @@ Second part
First part //
Second part
--- issue-4632-sth-followed-by-comment ---
// Test heading markers followed by comments.
#test([
=// Comment
=/* Comment */
], [
=
=
])
// Test list markers followed by comments.
#test([
-// Comment
-/* Comment */
], [
-
-
])
// Test enum markers followed by comments.
#test([
+// Comment
+/* Comment */
1.// Comment
2./* Comment */
], [
+
+
1.
2.
])
--- comment-block-unclosed ---
// End should not appear without start.
// Error: 7-9 unexpected end of block comment