From d0677b71b7653e219170d4c83f2b7c80d41a86d3 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Sun, 6 Aug 2017 08:05:53 -0400 Subject: [PATCH] Disable backtracking in repetitions. --- src/Data/Syntax/Assignment.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Syntax/Assignment.hs b/src/Data/Syntax/Assignment.hs index 4c500431d..86f9676b7 100644 --- a/src/Data/Syntax/Assignment.hs +++ b/src/Data/Syntax/Assignment.hs @@ -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