diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs index 0e211e692..46150ff2b 100644 --- a/src/syntax/parser.rs +++ b/src/syntax/parser.rs @@ -361,6 +361,8 @@ fn math_delimited(p: &mut Parser, stop: MathClass) { p.unexpected(); } } + + p.wrap(m, SyntaxKind::Math); } fn math_unparen(p: &mut Parser, m: Marker) { diff --git a/tests/ref/math/unbalanced.png b/tests/ref/math/unbalanced.png new file mode 100644 index 000000000..5b4d77363 Binary files /dev/null and b/tests/ref/math/unbalanced.png differ diff --git a/tests/typ/math/unbalanced.typ b/tests/typ/math/unbalanced.typ new file mode 100644 index 000000000..9eeb3bfc9 --- /dev/null +++ b/tests/typ/math/unbalanced.typ @@ -0,0 +1,6 @@ +// Test unbalanced delimiters. + +--- +$ 1/(2 (x) $ +$ 1_(2 y (x) () $ +$ 1/(2 y (x) (2(3)) $