diff options
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; } |
