Skip to content

stepParser/feed ignores Skipping #95

Open
@ony

Description

@ony

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions