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
Clean up handling of initial negated character class subrule.
  • Loading branch information
pmichaud committed Oct 13, 2009
1 parent 302f7f2 commit 982f190
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Regex/P6Regex/Actions.pm
Expand Up @@ -320,7 +320,8 @@ method assertion:sym<name>($/) {
method assertion:sym<[>($/) {
my $clist := $<cclass_elem>;
my $past := $clist[0].ast;
if $past.negate {
if $past.negate && $past.pasttype eq 'subrule' {
$past.subtype('zerowidth');
$past := PAST::Regex.new(
$past,
PAST::Regex.new( :pasttype('charclass'), :subtype('.') )
Expand All @@ -331,6 +332,7 @@ method assertion:sym<[>($/) {
while $i < $n {
my $ast := $clist[$i].ast;
if $ast.negate {
$past.subtype('zerowidth');
$past := PAST::Regex.new( $ast, $past, :pasttype('concat') );
}
else {
Expand Down

0 comments on commit 982f190

Please sign in to comment.