summaryrefslogtreecommitdiff
path: root/crates/typst-syntax
diff options
context:
space:
mode:
authorPgBiel <9021226+PgBiel@users.noreply.github.com>2024-06-20 23:37:22 -0300
committerPgBiel <9021226+PgBiel@users.noreply.github.com>2024-06-26 12:17:53 -0300
commita1d5861a58d2b4f2b9fdf753ade8c2b5c3d7fbbd (patch)
treedb81a3771b7fe5ccfb56adae7e67dfe2366d143f /crates/typst-syntax
parent16859f57e20f0ee243b5a88d24539a099a972943 (diff)
don't swallow newlines in decorator lexing
Diffstat (limited to 'crates/typst-syntax')
-rw-r--r--crates/typst-syntax/src/lexer.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs
index 341484c7..e1fb0026 100644
--- a/crates/typst-syntax/src/lexer.rs
+++ b/crates/typst-syntax/src/lexer.rs
@@ -193,8 +193,8 @@ impl Lexer<'_> {
}
fn decorator(&mut self) -> SyntaxKind {
- while !self.s.eat_newline() {
- let start = self.s.cursor();
+ let mut start = self.s.cursor();
+ while !self.s.peek().is_some_and(is_newline) {
let token = match self.s.eat() {
Some(c) if is_space(c, self.mode) => self.whitespace(start, c),
Some('/') if self.s.eat_if('/') => break,
@@ -216,6 +216,7 @@ impl Lexer<'_> {
let end = self.s.cursor();
self.subtree.push((token, end));
+ start = end;
}
SyntaxKind::Decorator