mirror of
https://github.com/typst/typst
synced 2025-08-16 07:58:32 +08:00
parse multi-char numbers consistently in math
This commit is contained in:
parent
cfb3b1a270
commit
dbdc8ea069
@ -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)
|
||||||
|
BIN
tests/ref/issue-4828-math-number-multi-char.png
Normal file
BIN
tests/ref/issue-4828-math-number-multi-char.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 465 B |
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user