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