mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Fix lexer on sth followed by comments (#4739)
This commit is contained in:
parent
351bac8b68
commit
ccd4524106
@ -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("/*")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user