diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-12-09 21:22:23 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-12-09 21:22:23 +0100 |
| commit | c38d55614af0226be8eb3f3e1500da8b7be2fec8 (patch) | |
| tree | 88ab7d81cbb849d8592baf32a4e5de5a8c9e36ab /src/syntax/parser.rs | |
| parent | cd089b6194c57b2e8dff70efaa7cbd53035f7327 (diff) | |
A few math fixes
Diffstat (limited to 'src/syntax/parser.rs')
| -rw-r--r-- | src/syntax/parser.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs index 3e133fe1..a0b1e7d1 100644 --- a/src/syntax/parser.rs +++ b/src/syntax/parser.rs @@ -338,9 +338,13 @@ impl<'s> Parser<'s> { Some(SyntaxKind::RightParen) => self.inside(Group::Paren), Some(SyntaxKind::Star) => self.inside(Group::Strong), Some(SyntaxKind::Underscore) => self.inside(Group::Emph), - Some(SyntaxKind::Dollar) => { - self.groups.last().map(|group| group.kind) == Some(Group::Math) - } + Some(SyntaxKind::Dollar) => self + .groups + .iter() + .rev() + .skip_while(|group| matches!(group.kind, Group::MathRow(..))) + .next() + .map_or(false, |group| group.kind == Group::Math), Some(SyntaxKind::Semicolon) => self.inside(Group::Expr), Some(SyntaxKind::From) => self.inside(Group::Imports), Some(SyntaxKind::Atom(s)) => match s.as_str() { |
