File tree Expand file tree Collapse file tree
core/src/Streamly/Internal/Data/ParserK Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -774,14 +774,14 @@ toParser parser = ParserD.Parser step initial extract
774774 r <- cont None
775775 case r of
776776 -- This is extract so no input has been given, therefore, the
777- -- translation here is (1 + n ) rather than n.
778- -- XXX How should we visualize (1 + n)?
779- -- XXX Go forward by 1 element on extract?
780- Done n b -> assert (n <= 0 ) (return $ ParserD. SDone (1 + n ) b)
777+ -- translation here is (n - 1 ) rather than n.
778+ -- In ParserD @n@ means go back by @n@ including the current input
779+ -- Since there is no current input we reduce moving by 1.
780+ Done n b -> assert (n <= 0 ) (return $ ParserD. SDone (n - 1 ) b)
781781 Error _ e -> return $ ParserD. Error e
782782 Partial _ cont1 -> extract cont1
783783 Continue n cont1 ->
784- assert (n <= 0 ) (return $ ParserD. SContinue (1 + n ) cont1)
784+ assert (n <= 0 ) (return $ ParserD. SContinue (n - 1 ) cont1)
785785
786786{-# RULES "fromParser/toParser fusion" [2]
787787 forall s. toParser (adapt s) = s #-}
You can’t perform that action at this time.
0 commit comments