summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-27 16:09:26 +0200
committerLaurenz <laurmaedje@gmail.com>2023-03-27 16:09:26 +0200
commitc5fb34123cad86294887defe9571cd773e9ace99 (patch)
treef9a718e7fd05a417326adc6c263711aee037b027
parent477275c0303ab98270255357df267b11be737fab (diff)
Fix parsing of unbalanced delimiters in math
-rw-r--r--src/syntax/parser.rs2
-rw-r--r--tests/ref/math/unbalanced.pngbin0 -> 2482 bytes
-rw-r--r--tests/typ/math/unbalanced.typ6
3 files changed, 8 insertions, 0 deletions
diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs
index 0e211e69..46150ff2 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 00000000..5b4d7736
--- /dev/null
+++ b/tests/ref/math/unbalanced.png
Binary files differ
diff --git a/tests/typ/math/unbalanced.typ b/tests/typ/math/unbalanced.typ
new file mode 100644
index 00000000..9eeb3bfc
--- /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)) $