diff --git a/src/syntax/lexer.rs b/src/syntax/lexer.rs index c46fa37b..43a4872b 100644 --- a/src/syntax/lexer.rs +++ b/src/syntax/lexer.rs @@ -430,6 +430,10 @@ impl Lexer<'_> { // Keep numbers and grapheme clusters together. if c.is_numeric() { self.s.eat_while(char::is_numeric); + let mut s = self.s; + if s.eat_if('.') && !s.eat_while(char::is_numeric).is_empty() { + self.s = s; + } } else { let len = self .s diff --git a/tests/ref/math/frac.png b/tests/ref/math/frac.png index fc8789b3..58d8ef89 100644 Binary files a/tests/ref/math/frac.png and b/tests/ref/math/frac.png differ diff --git a/tests/typ/math/frac.typ b/tests/typ/math/frac.typ index 2e915de2..15b5da33 100644 --- a/tests/typ/math/frac.typ +++ b/tests/typ/math/frac.typ @@ -27,6 +27,7 @@ $ 1/2/3 = (1/2)/3 = 1/(2/3) $ --- // Test precedence. $ a_1/b_2, 1/f(x), zeta(x)/2, "foo"[|x|]/2 \ + 1.2/3.7, 2.3^3.4 \ 🏳️‍🌈[x]/2, f [x]/2, phi [x]/2, 🏳️‍🌈 [x]/2 \ +[x]/2, 1(x)/2, 2[x]/2 \ (a)b/2, b(a)[b]/2 $