diff options
| author | PgBiel <9021226+PgBiel@users.noreply.github.com> | 2024-06-25 20:39:38 -0300 |
|---|---|---|
| committer | PgBiel <9021226+PgBiel@users.noreply.github.com> | 2024-06-26 12:17:53 -0300 |
| commit | 65dc277fc5cd4603653e71905a004d63248fcb6c (patch) | |
| tree | 10f2783d0aece6386df4d560cd1adbca36de4c61 /crates/typst-syntax | |
| parent | 14dfb3f63004d06d4ba1c34a24fff6686b6e5312 (diff) | |
minor decorator lexing improvements
Diffstat (limited to 'crates/typst-syntax')
| -rw-r--r-- | crates/typst-syntax/src/lexer.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs index 9bfc64cb..ac6de18c 100644 --- a/crates/typst-syntax/src/lexer.rs +++ b/crates/typst-syntax/src/lexer.rs @@ -265,7 +265,7 @@ impl Lexer<'_> { let mut current_start = self.s.cursor(); let mut expecting_comma = false; let mut finished = false; - while !self.s.peek().is_some_and(is_newline) { + while !self.s.at(is_newline) { let token = match self.s.eat() { Some(c) if c.is_whitespace() => { self.s.eat_while(is_inline_whitespace); @@ -277,10 +277,10 @@ impl Lexer<'_> { // After we finished specifying arguments, there must only // be whitespaces until the line ends. self.s.eat_until(char::is_whitespace); - self.error("expected whitespace") + self.error("expected end of decorator") } Some('"') if expecting_comma => { - self.s.eat_until(|c| c == ',' || is_newline(c)); + self.s.eat_until(|c| c == ',' || c == ')' || is_newline(c)); self.error("expected comma") } Some('"') => { |
