Login  Register

Re: PetitParser - skip everything up to X

Posted by Sean P. DeNigris on Nov 11, 2010; 11:36pm
URL: https://forum.world.st/PetitParser-skip-everything-up-to-X-tp3038824p3038839.html

What do you think of adding it to the API?

Something like PPParser-skipUntil.st:

PPParser>>skipUntil

        ^ self negate plus, self ==> [ :nodes | nodes second ].

parser2 := 'dd' asParser skipUntil.
parser2 parse: 'kslkxjclkxjcdd'. "Returns 'dd'"

Cheers,
Sean