Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add first (incomplete) version of <+subrule>.
  • Loading branch information
pmichaud committed Oct 12, 2009
1 parent a0c9610 commit 7155d02
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions src/Regex/P6Regex/Actions.pm
Expand Up @@ -229,32 +229,38 @@ method assertion:sym<[>($/) {

method cclass_elem($/) {
my $str := '';
for $<charspec> {
if $_[1] {
my $a := $_[0];
my $b := $_[1][0];
my $c := Q:PIR {
$P0 = find_lex '$a'
$S0 = $P0
$I0 = ord $S0
$P1 = find_lex '$b'
$S1 = $P1
$I1 = ord $S1
$S2 = ''
cclass_loop:
if $I0 > $I1 goto cclass_done
$S0 = chr $I0
$S2 .= $S0
inc $I0
goto cclass_loop
cclass_done:
%r = box $S2
};
$str := $str ~ $c;
my $past;
if $<name> {
$past := PAST::Regex.new( :name(~$<name>), :pasttype('subrule'),
:subtype('method') );
} else {
for $<charspec> {
if $_[1] {
my $a := $_[0];
my $b := $_[1][0];
my $c := Q:PIR {
$P0 = find_lex '$a'
$S0 = $P0
$I0 = ord $S0
$P1 = find_lex '$b'
$S1 = $P1
$I1 = ord $S1
$S2 = ''
cclass_loop:
if $I0 > $I1 goto cclass_done
$S0 = chr $I0
$S2 .= $S0
inc $I0
goto cclass_loop
cclass_done:
%r = box $S2
};
$str := $str ~ $c;
}
else { $str := $str ~ $_[0]; }
}
else { $str := $str ~ $_[0]; }
$past := PAST::Regex.new( $str, :pasttype('enumcharlist') );
}
my $past := PAST::Regex.new( $str, :pasttype('enumcharlist') );
$past.negate( $<sign> eq '-' );
make $past;
}

0 comments on commit 7155d02

Please sign in to comment.