summaryrefslogtreecommitdiff
path: root/crates/typst-syntax/src
diff options
context:
space:
mode:
authorwznmickey <first@wznmickey.com>2024-12-09 05:56:42 -0500
committerGitHub <noreply@github.com>2024-12-09 10:56:42 +0000
commitbb0c8140950b3eec020a4f0147bbc4ea65f3952a (patch)
tree55289836e446e3e415cac0edeeaaa983ee84bf21 /crates/typst-syntax/src
parentf960fe60121ff7d03dfc5db429b756d7efd0cc1f (diff)
Forbid base prefix for numbers with a unit (#5548)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-syntax/src')
-rw-r--r--crates/typst-syntax/src/lexer.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/typst-syntax/src/lexer.rs b/crates/typst-syntax/src/lexer.rs
index 1314016f..358c25b2 100644
--- a/crates/typst-syntax/src/lexer.rs
+++ b/crates/typst-syntax/src/lexer.rs
@@ -766,6 +766,12 @@ impl Lexer<'_> {
return self.error(eco_format!("invalid number suffix: {}", suffix));
}
+ if base != 10 {
+ let kind = self.error(eco_format!("invalid base-{base} prefix"));
+ self.hint("numbers with a unit cannot have a base prefix");
+ return kind;
+ }
+
SyntaxKind::Numeric
}