diff options
| author | Leedehai <18319900+Leedehai@users.noreply.github.com> | 2024-04-30 08:30:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-30 12:30:38 +0000 |
| commit | 44bc51ba4fef66b7778668b3877a65425ac2eedc (patch) | |
| tree | 751f47fb89067c43b988463e3afbce1315185599 /crates/typst-syntax | |
| parent | eac2200c978afffc3abef191364d5d5e4d6afc3b (diff) | |
Let let-binding raise error on unexpected keywords (#4034)
Diffstat (limited to 'crates/typst-syntax')
| -rw-r--r-- | crates/typst-syntax/src/parser.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/typst-syntax/src/parser.rs b/crates/typst-syntax/src/parser.rs index e61618e0..d8ac1198 100644 --- a/crates/typst-syntax/src/parser.rs +++ b/crates/typst-syntax/src/parser.rs @@ -1452,12 +1452,11 @@ fn pattern_leaf<'s>( seen: &mut HashSet<&'s str>, dupe: Option<&'s str>, ) { - if !p.at_set(set::PATTERN_LEAF) { - if p.current().is_keyword() { - p.eat_and_get().expected("pattern"); - } else { - p.expected("pattern"); - } + if p.current().is_keyword() { + p.eat_and_get().expected("pattern"); + return; + } else if !p.at_set(set::PATTERN_LEAF) { + p.expected("pattern"); return; } |
