Am 06.05.2011 um 13:59 schrieb Damien Pollet:
I have a unit test for a parser of mine:
testLine self fail: 'Just a line.' rule: #lineBlank. "passes" self parse: 'Just a line.' rule: #lineNonBlank. "passes" self parse: 'Just a line.' rule: #line. "end of input expected at 0"
Now the fun part:
line ^ lineBlank / lineNonBlank
try line ^ lineNonBlank / lineBlank Norbert
For reference, here are the rest of the involved rules:
blank ^ #blank asParser
lineBlank ^ blank star
lineNonBlank ^ blank star , blank not , lineEnd negate plus
lineEnd ^ (Character lf asParser) / (Character cr asParser , Character lf asParser optional)
Insights ?
-- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet