Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Enable code interpolations.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed May 25, 2010
1 parent 43b5e39 commit 7882ea3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/NQP/Actions.pm
Expand Up @@ -825,8 +825,8 @@ class NQP::RegexActions is Regex::P6Regex::Actions {
}

method assertion:sym<{ }>($/) {
make PAST::Regex.new( $<codeblock>.ast,
:pasttype<pastnode>, :node($/) );
make PAST::Regex.new( '!INTERPOLATE_REGEX', $<codeblock>.ast,
:pasttype<subrule>, :subtype<method>, :node($/));
}

method assertion:sym<?{ }>($/) {
Expand Down
6 changes: 3 additions & 3 deletions src/NQP/Grammar.pm
Expand Up @@ -558,9 +558,9 @@ grammar NQP::Regex is Regex::P6Regex::Grammar {
<?[$@]> <var=.LANG('MAIN', 'variable')>
}

# token assertion:sym<{ }> {
# <?[{]> <codeblock>
# }
token assertion:sym<{ }> {
<?[{]> <codeblock>
}

token assertion:sym<?{ }> {
$<zw>=[ <[?!]> <?before '{'> ] <codeblock>
Expand Down
4 changes: 1 addition & 3 deletions t/nqp/49-regex-interpolation.t
@@ -1,6 +1,6 @@
#! nqp

plan(28);
plan(32);

my $b := "b+";
my @foo := [ "b+", "c+" ];
Expand Down Expand Up @@ -28,8 +28,6 @@ ok(!("ac+d" ~~ /a <@foo> d/), 'array assertion interpolates as alternations of
ok("abbbbbd" ~~ /a <@foo> d/, 'array assertion interpolates as alternations of regexen 3');
ok("acccccd" ~~ /a <@foo> d/, 'array assertion interpolates as alternations of regexen 4');

=begin END
ok(!("ab+d" ~~ /a <{ "b+" }> d/), 'code assersion interpolates as regex 1');
ok("abbbbd" ~~ /a <{ "b+" }> d/, 'code assersion interpolates as regex 2');

Expand Down

0 comments on commit 7882ea3

Please sign in to comment.