Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stepParser/feed ignores Skipping #95

Open
ony opened this issue Feb 1, 2022 · 0 comments
Open

stepParser/feed ignores Skipping #95

ony opened this issue Feb 1, 2022 · 0 comments

Comments

@ony
Copy link

ony commented Feb 1, 2022

I'm trying to get incremental parsing of values/tokens repetition.
But it seems that I can't get parser re-started from new offset for processing leftover and further chunks.

Consider simple case where we parsed first byte/char "y" and we have leftover "x"

"yx" `feed` stepParser (char 'x') (Columns 1 1)
StepCont (Rope (Columns 2 2) (fromList [Strand "yx" (Columns 2 2)])) (Success 'x') ...

This works great, but I don't want to re-supply dummy input and want to benefit of Skipping strand:

"x" `feed` (Skipping (Columns 1 1) `feed` stepParser (char 'x') (Columns 1 1))
StepCont (Rope (Columns 2 2) (fromList [Skipping (Columns 1 1),Strand "x" (Columns 1 1)])) (Failure (ErrInfo {_errDoc = (interactive):1:2: error: unexpected EOF, expected: "x"
1 | x<EOF> 
  |  ^     , _errDeltas = [Columns 1 1]})) ...

I would expect there is sort of equivalence

(stepParser p mempty)   ~   (Skipping pos `feed` stepParser p pos)

(and difference is only in numeric errors offset)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant