Skip to content

Commit

Permalink
Fix broken parsing of signs in character classes
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Aug 23, 2012
1 parent 79d1139 commit 1666bb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/NieczaActions.pm6
Expand Up @@ -907,6 +907,7 @@ method cc_to_rxop($z) {
method cclass_expr($/) {
my @ops = @$<op>;
my @zyg = map *.ast, @$<cclass_union>;
if $<sign> eq '-' { @zyg[0] = self.negate_cc(@zyg[0]) }
for @ops -> $op {
my $z1 = shift @zyg;
my $z2 = shift @zyg;
Expand All @@ -925,7 +926,6 @@ method cclass_union($/) {
method cclass_add($/) {
my ($a, @zyg) = map *.ast, @$<cclass_elem>;
if $<sign> eq '-' { $a = self.negate_cc($a) }
for @$<op> {
$a = ($_ eq '+') ?? self.or_cc($a, shift(@zyg))
!! self.and_cc($a, self.negate_cc(shift(@zyg)));
Expand Down
2 changes: 1 addition & 1 deletion src/STD.pm6
Expand Up @@ -5031,6 +5031,7 @@ grammar Regex is STD {
token cclass_expr {
::
<.normspace>?
<sign>
<cclass_union>+ % [$<op>=[ '|' | '^' ]]
}

Expand All @@ -5041,7 +5042,6 @@ grammar Regex is STD {

token cclass_add {
<.normspace>?
<sign>
<cclass_elem>+ % [$<op>=[ '+' | '-' ]<.normspace>?]
}

Expand Down

0 comments on commit 1666bb5

Please sign in to comment.