diff options
| author | Marmare314 <49279081+Marmare314@users.noreply.github.com> | 2023-05-03 11:16:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-03 11:16:38 +0200 |
| commit | edc0632d8c9d7a17cc795a57de27c6b22a748158 (patch) | |
| tree | a1c6e412512bed7b56c7c100b8affeac7e29f389 /src/syntax/parser.rs | |
| parent | 2772e6436c8a010662820c3e545e69ab922f133a (diff) | |
Add shorthand for root operation (#929)
Diffstat (limited to 'src/syntax/parser.rs')
| -rw-r--r-- | src/syntax/parser.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs index 1198774b..13c7bd47 100644 --- a/src/syntax/parser.rs +++ b/src/syntax/parser.rs @@ -282,6 +282,16 @@ fn math_expr_prec(p: &mut Parser, min_prec: usize, stop: SyntaxKind) { p.eat(); } + SyntaxKind::Root => { + if min_prec < 3 { + p.eat(); + let m2 = p.marker(); + math_expr_prec(p, 2, stop); + math_unparen(p, m2); + p.wrap(m, SyntaxKind::MathRoot); + } + } + _ => p.expected("expression"), } |
