diff options
| author | Eduardo Sánchez Muñoz <eduardosanchezmunoz@gmail.com> | 2025-03-24 19:16:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-24 18:16:33 +0000 |
| commit | 38213ed534d8a7cd520c0265b99a345bc2966b39 (patch) | |
| tree | 248bbfcead3218067e399145be10b2ef3187624e /crates/typst-syntax | |
| parent | 636eea18bc1c3fe2acb09e59e67f38a4a0c1b323 (diff) | |
Use `u64` instead of `usize` to store counter and enumeration item numbers, so behavior does not vary from 64-bit to 32-bit platforms (#6026)
Diffstat (limited to 'crates/typst-syntax')
| -rw-r--r-- | crates/typst-syntax/src/ast.rs | 2 | ||||
| -rw-r--r-- | crates/typst-syntax/src/lexer.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crates/typst-syntax/src/ast.rs b/crates/typst-syntax/src/ast.rs index f79e6598..7b211bfc 100644 --- a/crates/typst-syntax/src/ast.rs +++ b/crates/typst-syntax/src/ast.rs @@ -778,7 +778,7 @@ node! { impl<'a> EnumItem<'a> { /// The explicit numbering, if any: `23.`. - pub fn number(self) -> Option<usize> { + pub fn number(self) -> Option<u64> { self.0.children().find_map(|node| match node.kind() { SyntaxKind::EnumMarker => node.text().trim_end_matches('.').parse().ok(), _ => Option::None, diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs index b8f2bf25..ac69eb61 100644 --- a/crates/typst-syntax/src/lexer.rs +++ b/crates/typst-syntax/src/lexer.rs @@ -480,7 +480,7 @@ impl Lexer<'_> { self.s.eat_while(char::is_ascii_digit); let read = self.s.from(start); - if self.s.eat_if('.') && self.space_or_end() && read.parse::<usize>().is_ok() { + if self.s.eat_if('.') && self.space_or_end() && read.parse::<u64>().is_ok() { return SyntaxKind::EnumMarker; } |
