Created
April 25, 2010 13:54
-
-
Save masak/378420 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 examples/mygrammar | |
use v6; | |
use GGE; | |
my $debug = False; | |
class MyGrammar is GGE::Grammar { | |
GGE::Perl6Regex.new("<bar>", :$debug, :grammar<MyGrammar>, :name<TOP>); | |
GGE::Perl6Regex.new("'OH HAI'", :$debug, :grammar<MyGrammar>, :name<bar>); | |
} | |
my GGE::Match $match | |
= MyGrammar.parse('this string contains "OH HAI" as a substring', :$debug); | |
say $match ?? $match.dump_str('mob', ' ', '') !! "No match\n"; | |
$ alpha examples/mygrammar | |
mob: <OH HAI @ 22> | |
mob<bar>: <OH HAI @ 22> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment