mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Make factorial take precedence over fraction in math expressions (#1487)
Fixes #1475.
This commit is contained in:
parent
8513c2b0fb
commit
ececd07424
@ -307,6 +307,12 @@ fn math_expr_prec(p: &mut Parser, min_prec: usize, stop: SyntaxKind) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while !p.eof() && !p.at(stop) {
|
while !p.eof() && !p.at(stop) {
|
||||||
|
if p.directly_at(SyntaxKind::Text) && p.current_text() == "!" {
|
||||||
|
p.eat();
|
||||||
|
p.wrap(m, SyntaxKind::Math);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let Some((kind, stop, assoc, mut prec)) = math_op(p.current()) else {
|
let Some((kind, stop, assoc, mut prec)) = math_op(p.current()) else {
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 24 KiB |
@ -30,4 +30,5 @@ $ a_1/b_2, 1/f(x), zeta(x)/2, "foo"[|x|]/2 \
|
|||||||
1.2/3.7, 2.3^3.4 \
|
1.2/3.7, 2.3^3.4 \
|
||||||
🏳️🌈[x]/2, f [x]/2, phi [x]/2, 🏳️🌈 [x]/2 \
|
🏳️🌈[x]/2, f [x]/2, phi [x]/2, 🏳️🌈 [x]/2 \
|
||||||
+[x]/2, 1(x)/2, 2[x]/2 \
|
+[x]/2, 1(x)/2, 2[x]/2 \
|
||||||
(a)b/2, b(a)[b]/2 $
|
(a)b/2, b(a)[b]/2 \
|
||||||
|
n!/2, 5!/2, n !/2, 1/n!, 1/5! $
|
||||||
|
Loading…
x
Reference in New Issue
Block a user