summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/syntax/parser.rs6
-rw-r--r--tests/ref/math/frac.pngbin21679 -> 24197 bytes
-rw-r--r--tests/typ/math/frac.typ3
3 files changed, 8 insertions, 1 deletions
diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs
index 5fc9ec26..7d057ab9 100644
--- a/src/syntax/parser.rs
+++ b/src/syntax/parser.rs
@@ -307,6 +307,12 @@ fn math_expr_prec(p: &mut Parser, min_prec: usize, stop: SyntaxKind) {
}
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 {
break;
};
diff --git a/tests/ref/math/frac.png b/tests/ref/math/frac.png
index 6f0e8139..a116c876 100644
--- a/tests/ref/math/frac.png
+++ b/tests/ref/math/frac.png
Binary files differ
diff --git a/tests/typ/math/frac.typ b/tests/typ/math/frac.typ
index 15b5da33..dc120ec3 100644
--- a/tests/typ/math/frac.typ
+++ b/tests/typ/math/frac.typ
@@ -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 \
🏳️‍🌈[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 $
+ (a)b/2, b(a)[b]/2 \
+ n!/2, 5!/2, n !/2, 1/n!, 1/5! $