1
1
mirror of https://github.com/github/semantic.git synced 2024-12-19 12:51:52 +03:00

Disable backtracking in repetitions.

This commit is contained in:
Rob Rix 2017-08-06 08:05:53 -04:00
parent 15eee07c5d
commit d0677b71b7

View File

@ -292,7 +292,7 @@ runAssignment toNode source = (\ assignment state -> disamb Left (Right . minimu
anywhere node = case assignment of
Location -> yield (Info.Range stateOffset stateOffset :. Info.Span statePos statePos :. Nil) state
Choose _ _ (Just atEnd) -> yield atEnd state
Many rule -> fix (\ recur state -> (go rule state >>= \ (a, state') -> first (a:) <$> if state == state' then pure ([], state') else recur state') <> pure ([], state)) state >>= uncurry yield
Many rule -> fix (\ recur state -> (go rule state >>= \ (a, state') -> first (a:) <$> if state == state' then pure ([], state') else recur state') `catchError` const (pure ([], state))) state >>= uncurry yield
Alt as -> foldr (\ each next -> case yield each state of
None (err, state') -> if state == state' then next else None (err, state')
Some as -> Some as) (None (makeError node, state)) as