parse multi-char numbers consistently in math

This commit is contained in:
Ian Wrzesinski 2025-02-27 13:11:00 -05:00
parent cfb3b1a270
commit dbdc8ea069
3 changed files with 5 additions and 0 deletions

View File

@ -272,6 +272,7 @@ fn math_expr_prec(p: &mut Parser, min_prec: usize, stop: SyntaxKind) {
SyntaxKind::Text | SyntaxKind::MathText | SyntaxKind::MathShorthand => { SyntaxKind::Text | SyntaxKind::MathText | SyntaxKind::MathShorthand => {
continuable = !p.at(SyntaxKind::MathShorthand) continuable = !p.at(SyntaxKind::MathShorthand)
&& !p.current_text().chars().all(char::is_numeric)
&& matches!( && matches!(
math_class(p.current_text()), math_class(p.current_text()),
None | Some(MathClass::Alphabetic) None | Some(MathClass::Alphabetic)

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

View File

@ -28,6 +28,10 @@ $ dot \ dots \ ast \ tilde \ star $
$floor(phi.alt.)$ $floor(phi.alt.)$
$floor(phi.alt. )$ $floor(phi.alt. )$
--- issue-4828-math-number-multi-char ---
// Numbers should parse the same regardless of number of characters.
$1/2(x)$ vs. $1/10(x)$
--- math-unclosed --- --- math-unclosed ---
// Error: 1-2 unclosed delimiter // Error: 1-2 unclosed delimiter
$a $a