Skip to content

Commit

Permalink
[nrx] Reimplement grammars
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Sep 5, 2010
1 parent 9cf770c commit 5ceab02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/Niecza/Actions.pm
Expand Up @@ -370,7 +370,6 @@ sub regex_def { my ($cl, $M) = @_;
$ast = RxOp::ProtoRedis->new(name => $name);
}

my ($cn, $op) = $ast->term_rx;
$M->{_ast} = Op::SubDef->new(
var => $var,
method_too => ($scope eq 'has' ? $name : undef),
Expand All @@ -379,8 +378,8 @@ sub regex_def { my ($cl, $M) = @_;
ltm => $ast->lad,
class => 'Regex',
type => 'regex',
signature => $sig->for_regex($cn),
do => $op));
signature => $sig->for_regex,
do => Op::RegexBody->new(rxop => $ast)));
}

sub regex_declarator { my ($cl, $M) = @_;
Expand Down
14 changes: 7 additions & 7 deletions test2.pl
Expand Up @@ -34,14 +34,14 @@
ok !("adc" ~~ /ab+c/), "plus cannot match other";
ok !("ac" ~~ /ab+c/), "plus cannot match none";
#grammar Bob {
# rule TOP {ab*c}
#}
grammar Bob {
regex TOP {ab*c}
}
#ok Bob.parse("abbc"), "grammars work (1)";
#ok !Bob.parse("adc"), "grammars work (2)";
#ok !Bob.parse("xac"), "grammars anchor (1)";
#ok !Bob.parse("acx"), "grammars anchor (2)";
ok Bob.parse("abbc"), "grammars work (1)";
ok !Bob.parse("adc"), "grammars work (2)";
ok !Bob.parse("xac"), "grammars anchor (1)";
ok !Bob.parse("acx"), "grammars anchor (2)";
}
# {
Expand Down

0 comments on commit 5ceab02

Please sign in to comment.