Permalink
Browse files

Fix broken parsing of signs in character classes

  • Loading branch information...
1 parent 79d1139 commit 1666bb507ada5d922a5cc8aa3d964d0e4a39a825 @sorear sorear committed Aug 23, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/NieczaActions.pm6
  2. +1 −1 src/STD.pm6
View
2 src/NieczaActions.pm6
@@ -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;
@@ -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)));
View
2 src/STD.pm6
@@ -5031,6 +5031,7 @@ grammar Regex is STD {
token cclass_expr {
::
<.normspace>?
+ <sign>
<cclass_union>+ % [$<op>=[ '|' | '^' ]]
}
@@ -5041,7 +5042,6 @@ grammar Regex is STD {
token cclass_add {
<.normspace>?
- <sign>
<cclass_elem>+ % [$<op>=[ '+' | '-' ]<.normspace>?]
}

0 comments on commit 1666bb5

Please sign in to comment.