On 8/4/10 5:49 PM, Lukas Renggli wrote:
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 ]
Thanks to both of you for the suggestions, now the keyword parser (and similarly the separator) is implemented using:
keywordParsers := keywords keysSortedSafely collect: [:eachKey | keywords at: eachKey ].
^ (keywordParsers reduce: [ :a :b | a / b ]) token trimBlanks
Since I already have a dictionary "keywords" with each keyword as a key, and the corresponding parser (not tokenized) as a value.
Should these parsers be caseInsensitive? I thought keywords are case sensitive. Maybe that was another story?
Ciao, Alberto
Hi Alberto,
On 5 Aug 2010, at 09:45, Alberto Bacchelli wrote:
On 8/4/10 5:49 PM, Lukas Renggli wrote:
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 ]
Thanks to both of you for the suggestions, now the keyword parser (and similarly the separator) is implemented using:
keywordParsers := keywords keysSortedSafely collect: [:eachKey | keywords at: eachKey ].
^ (keywordParsers reduce: [ :a :b | a / b ]) token trimBlanks
Since I already have a dictionary "keywords" with each keyword as a key, and the corresponding parser (not tokenized) as a value.
This looks better.
Should these parsers be caseInsensitive? I thought keywords are case sensitive. Maybe that was another story?
The Java keywords are not caseInsensitive :). I was talking about other situations when you might need that.
Cheers, Doru
Ciao, Alberto _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"In a world where everything is moving ever faster, one might have better chances to win by moving slower."