Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[nrx] Reimplement brackets
  • Loading branch information
sorear committed Sep 6, 2010
1 parent b199a36 commit 705c3d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/RxOp.pm
Expand Up @@ -169,9 +169,13 @@ use CgOp;
extends 'RxOp';

# TODO once :lang is implemented, this will be a bit more complicated
sub op {
my ($self, $cn, $cont) = @_;
$self->zyg->[0]->op($cn, $cont);
sub code {
my ($self, $body) = @_;
my @code;
push @code, CgOp::rxpushb("BRACK");
push @code, $self->zyg->[0]->code($body);
push @code, CgOp::rxpushb("ENDBRACK");
@code;
}

sub lad {
Expand Down
6 changes: 3 additions & 3 deletions test2.pl
Expand Up @@ -176,9 +176,9 @@
#rxtest /<[ y ]>/, '<[ y ]>', ("y"), (" ", "x", "z");
#rxtest /<[ i .. k ]>/, '<[ i .. k ]>', ("i", "j", "k"), ("h", "l");
#rxtest /<[ \W a..z ]>/, '<[\W a..z]>', ("a", "z", "+"), ("\x4E00");
#
#rxtest /a || b/, 'a || b', ("a", "b"), ("c", "");
#rxtest /x [a || aa]: c/, 'x[a||b]:c', ("xac",), ("xaac",);

rxtest /a || b/, 'a || b', ("a", "b"), ("c", "");
rxtest /x [a || aa]: c/, 'x[a||aa]:c', ("xac",), ("xaac",);

#ok "axy" ~~ / a <before x> \w y / , "before is zero-width";
#ok "axy" ~~ / a <?before x> \w y / , "?before is zero-width";
Expand Down

0 comments on commit 705c3d8

Please sign in to comment.