Skip to content

Commit

Permalink
Some more CharClassElement deparsing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jan 14, 2023
1 parent 0e218e3 commit 67647f7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core.c/RakuAST/Deparse.pm6
Expand Up @@ -996,14 +996,18 @@ class RakuAST::Deparse {
multi method deparse(
RakuAST::Regex::CharClassElement::Enumeration:D $ast
--> Str:D) {
'[' ~ $ast.elements.map({ self.deparse($_) }).join(' ') ~ ']'
($ast.negated ?? '-' !! '+')
~ '[' ~ $ast.elements.map({ self.deparse($_) }).join(' ') ~ ']'
}

multi method deparse(
RakuAST::Regex::CharClassElement::Property:D $ast
--> Str:D) {
my str @parts = ':';
@parts.push('-') if $ast.inverted;
my str @parts;

@parts.push($ast.negated ?? '-' !! '+');
@parts.push(':');
@parts.push('!') if $ast.inverted;
@parts.push($ast.property);
@parts.push(self.deparse($_)) with $ast.predicate;
@parts.join
Expand Down

0 comments on commit 67647f7

Please sign in to comment.