> Am 20.01.2017 um 15:24 schrieb Peter Uhnak <i.uh...@gmail.com>: > > Is PetitParser eager by default? > > I've used PetitParser countless times so I am really baffled why this doesn't > work > > str := 'a0b'. > #any asParser star, #digit asParser, #any asParser star parse: str. > > -> PPFailure (input expected at: 3) >
PetitParser is not greedy per default. But back tracking only works if a parser fails. Using , creates a sequence of combined parsers. If one fails the whole sequence fails. As a star parser always succeeds it would be huge luck if your rule would succeed. The probability that the parser consumes exactly one character is not high. Maybe negating the first sequence part is what you want Norbert