mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Build up repetitions right-recursively.
This commit is contained in:
parent
8406ba35c2
commit
da988a4c6f
@ -281,7 +281,7 @@ runAssignment toNode source = (\ assignment state -> disamb Left (Right . minimu
|
||||
anywhere node = case assignment of
|
||||
Location -> yield (Info.Range (stateOffset state) (stateOffset state) :. Info.Span (statePos state) (statePos state) :. Nil) state
|
||||
Choose _ (Just atEnd) -> yield atEnd state
|
||||
Many rule -> fix (\ recur list state -> (go rule state >>= \ (a, state') -> (if stateOffset state == stateOffset state' then yield else recur) (list <> [a]) state') <> yield list state) [] state
|
||||
Many rule -> fix (\ recur state -> (go rule state >>= \ (a, state') -> if stateOffset state == stateOffset state' then pure ([a], state') else first (a:) <$> recur state') <> pure ([], state)) state >>= uncurry yield
|
||||
Alt as -> Some as >>= flip yield state
|
||||
Throw e -> None e
|
||||
Catch during handler -> go during state `catchError` (flip go state { stateErrorCounter = succ (stateErrorCounter state) } . handler) >>= uncurry yield
|
||||
|
Loading…
Reference in New Issue
Block a user