Permalink
Browse files

[GGE::Grammar] added convenience method .regex

This method shifts us a bit closer to the actual syntax for grammars (while
still being entirely unsugared).
  • Loading branch information...
1 parent 147d1af commit 475e2b72db319a5dc5ca1d1a3f6c86467bfb40b3 @masak committed Jul 31, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/GGE/Grammar.pm
View
@@ -1,8 +1,12 @@
use v6;
-use GGE::Match;
+use GGE::Perl6Regex;
class GGE::Grammar is GGE::Match {
+ method regex($name, $rule) {
+ GGE::Perl6Regex.new($rule, :grammar(self.WHAT.perl), :$name);
+ }
+
method parse($target, :$debug, :$stepwise) {
die "Cannot call .parse on a grammar with no TOP rule"
unless self.can('TOP');

0 comments on commit 475e2b7

Please sign in to comment.