fix: avoid choice nodes with LeadingIdentBehavior.both
This commit is contained in:
parent
e6954bb4f3
commit
80a92cceeb
1 changed files with 7 additions and 3 deletions
|
|
@ -1620,9 +1620,13 @@ def indexed {α : Type} (map : TokenMap α) (c : ParserContext) (s : ParserState
|
|||
| none => find identKind
|
||||
| LeadingIdentBehavior.both =>
|
||||
match map.find? val with
|
||||
| some as => match map.find? identKind with
|
||||
| some as' => (s, as ++ as')
|
||||
| _ => (s, as)
|
||||
| some as =>
|
||||
if val == identKind then
|
||||
(s, as) -- avoid running the same parsers twice
|
||||
else
|
||||
match map.find? identKind with
|
||||
| some as' => (s, as ++ as')
|
||||
| _ => (s, as)
|
||||
| none => find identKind
|
||||
| Except.ok (Syntax.node _ k _) => find k
|
||||
| Except.ok _ => (s, [])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue