From bb0c8140950b3eec020a4f0147bbc4ea65f3952a Mon Sep 17 00:00:00 2001 From: wznmickey Date: Mon, 9 Dec 2024 05:56:42 -0500 Subject: Forbid base prefix for numbers with a unit (#5548) Co-authored-by: Laurenz --- crates/typst-syntax/src/lexer.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crates/typst-syntax/src') 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 } -- cgit v1.2.3