Skip to content

Commit

Permalink
RakuAST: add adverb handling to RakuAST::QuotedRegex .raku/deparsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Mar 19, 2023
1 parent 18a5dab commit b8488d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/core.c/RakuAST/Deparse.pm6
Expand Up @@ -806,7 +806,9 @@ class RakuAST::Deparse {
#- Q ---------------------------------------------------------------------------

multi method deparse(RakuAST::QuotedRegex:D $ast --> Str:D) {
($ast.match-immediately ?? 'm' !! '')
my str $adverbs = $ast.adverbs.map({ self.deparse($_) }).join;
($ast.match-immediately ?? 'm' !! $adverbs ?? 'rx' !! '')
~ $adverbs
~ $.regex-open
~ self.deparse($ast.body)
~ $.regex-close
Expand Down
6 changes: 5 additions & 1 deletion src/core.c/RakuAST/Raku.pm6
Expand Up @@ -90,6 +90,10 @@ augment class RakuAST::Node {
}

my $special := BEGIN nqp::hash(
'adverbs', -> {
my $adverbs := nqp::decont(self.adverbs);
:$adverbs if $adverbs
},
'args', -> {
my $args := self.args;
:$args if $args && $args.args
Expand Down Expand Up @@ -522,7 +526,7 @@ augment class RakuAST::Node {
#- Q ---------------------------------------------------------------------------

multi method raku(RakuAST::QuotedRegex:D: --> Str:D) {
self!nameds: <match-immediately body>
self!nameds: <match-immediately body adverbs>
}

multi method raku(RakuAST::QuotedString:D: --> Str:D) {
Expand Down

0 comments on commit b8488d2

Please sign in to comment.