diff options
| author | Ian Wrzesinski <wrzian@umich.edu> | 2024-07-20 21:21:53 -0500 |
|---|---|---|
| committer | Ian Wrzesinski <wrzian@umich.edu> | 2025-01-23 16:28:29 -0500 |
| commit | 0b8b7d0f233f748a5c12d1b8e31f657803122eba (patch) | |
| tree | bbb904cb876ad5741f3e8a46758363af70af10e4 /crates/typst-syntax/src/lexer.rs | |
| parent | 2d33393df967bbe55646b839e188c04380d823fe (diff) | |
Just add MathText SyntaxKind
Diffstat (limited to 'crates/typst-syntax/src/lexer.rs')
| -rw-r--r-- | crates/typst-syntax/src/lexer.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs index 17401044..b8f2bf25 100644 --- a/crates/typst-syntax/src/lexer.rs +++ b/crates/typst-syntax/src/lexer.rs @@ -685,6 +685,7 @@ impl Lexer<'_> { if s.eat_if('.') && !s.eat_while(char::is_numeric).is_empty() { self.s = s; } + SyntaxKind::MathText } else { let len = self .s @@ -693,8 +694,14 @@ impl Lexer<'_> { .next() .map_or(0, str::len); self.s.jump(start + len); + if len > c.len_utf8() { + // Grapheme clusters are treated as normal text and stay grouped + // This may need to change in the future. + SyntaxKind::Text + } else { + SyntaxKind::MathText + } } - SyntaxKind::Text } /// Handle named arguments in math function call. |
