I tried this one, but the problem is that caseInsensitive is not understood by all parser (and in particular by PPChoiceParser), so I cannot write:
keywords reduce: [ :a :b | a asParser caseInsensitive / b asParser caseInsensitive ]
Aha, i missed that part. What about
(keywords collect: [ :k | k asParser caseInsensitive ]) reduce: #/
In this case, inject:into: can be a choice, but indeed with the current implementation we get one parser too many in the choice. Now the question is if it would not make sense to implement:
PPFailingParser>>/ aParser ^ aParser
That's a bit ugly :-)
Lukas
?
Like this you can inject it in a collection without creating an extra parser at the beginning. In the same spirit, we could also implement PPEpsilonParser>>, in a similar way.
Is there an argument against that?
Cheers, Doru
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
-- Lukas Renggli www.lukas-renggli.ch
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"To lead is not to demand things, it is to make them happen."
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev