Created
October 29, 2009 20:28
-
-
Save pmichaud/221783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat x | |
grammar ABC { | |
token TOP { $<num>=[\d+] <?{ +$<num> <= 255 }> } | |
} | |
for 1, 1000, 255, 256, 17 { | |
print($_); | |
say( ABC.parse($_) ?? ' matches' !! " doesn't match" ); | |
} | |
$ ./nqp x | |
1 matches | |
1000 doesn't match | |
255 matches | |
256 doesn't match | |
17 matches | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment