I think this parser is called PPFailingParser. It is useful to generate custom error messages. It always fails without consuming anything.
However for the given example I would use
keywords reduce: [ :a :b | a asParser / b asParser ]
for a shorter and more performant implementation.
Lukas
On Wednesday, August 4, 2010, Tudor Girba tudor.girba@gmail.com wrote:
Hi,
I went quickly through the PetitJava implementation and I stumbled across the keywords implementation. I would propose a simpler solution:
keyword ^ (arrayOfKeywords inject: PPEpsilonParser new not into: [:p :key | p / key asParser ]) token trimBlanks .
Now the question is if it makes sense to have a separate parser class equivalent to PPEpsilonParser new not. If yes, what would a good name be?
Cheers, Doru
-- www.tudorgirba.com
"Speaking louder won't make the point worthier."
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev