-
-
Save arnsholt/4ee0fa479b5c9dc61c80e72beb922b7d 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
regexp: foo | |
generator: bar |
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
grammar Thing { | |
token TOP { <check>+ } | |
proto regex check {*} | |
token check:sym<regexp> { <sym> ':' \s* (\N*)\n } | |
token check:sym<generator> { <sym> ':' \s* (\N*)\n } | |
} | |
class Actions { | |
method check:sym<regexp>($/) { say "Got regexp $0" } | |
method check:sym<generator>($/) { say "Got generator $0" } | |
} | |
Thing.parsefile('test.dat', :actions(Actions.new)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment