summaryrefslogtreecommitdiff
path: root/crates/typst-syntax
diff options
context:
space:
mode:
authorbluebear94 <uruwi@protonmail.com>2023-10-12 04:19:07 -0400
committerGitHub <noreply@github.com>2023-10-12 10:19:07 +0200
commitd3b62bd02ef92b747b724f344e9b8c7d5668ffbe (patch)
treefae56c4bb8018e3d6c06a4669ee8216e13ea9892 /crates/typst-syntax
parentd1a702f3fda49f7180ccde4f336fa725861be17f (diff)
MathAttach::primes: account for possible hash before base (#2363)
Fixes #2358.
Diffstat (limited to 'crates/typst-syntax')
-rw-r--r--crates/typst-syntax/src/ast.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/typst-syntax/src/ast.rs b/crates/typst-syntax/src/ast.rs
index 83e4ff9c..f411326f 100644
--- a/crates/typst-syntax/src/ast.rs
+++ b/crates/typst-syntax/src/ast.rs
@@ -863,7 +863,11 @@ impl<'a> MathAttach<'a> {
/// Extract attached primes if present.
pub fn primes(self) -> Option<MathPrimes<'a>> {
- self.0.children().nth(1).and_then(|n| n.cast())
+ self.0
+ .children()
+ .skip_while(|node| node.cast::<Expr<'_>>().is_none())
+ .nth(1)
+ .and_then(|n| n.cast())
}
}