From 7882ea3a953b16af0ae4e0ed7a4a7ef90741e414 Mon Sep 17 00:00:00 2001 From: pmichaud Date: Mon, 24 May 2010 19:35:23 -0500 Subject: [PATCH] Enable code interpolations. --- src/NQP/Actions.pm | 4 ++-- src/NQP/Grammar.pm | 6 +++--- t/nqp/49-regex-interpolation.t | 4 +--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/NQP/Actions.pm b/src/NQP/Actions.pm index 279030e..5d48bbe 100644 --- a/src/NQP/Actions.pm +++ b/src/NQP/Actions.pm @@ -825,8 +825,8 @@ class NQP::RegexActions is Regex::P6Regex::Actions { } method assertion:sym<{ }>($/) { - make PAST::Regex.new( $.ast, - :pasttype, :node($/) ); + make PAST::Regex.new( '!INTERPOLATE_REGEX', $.ast, + :pasttype, :subtype, :node($/)); } method assertion:sym($/) { diff --git a/src/NQP/Grammar.pm b/src/NQP/Grammar.pm index e632f18..881a66b 100644 --- a/src/NQP/Grammar.pm +++ b/src/NQP/Grammar.pm @@ -558,9 +558,9 @@ grammar NQP::Regex is Regex::P6Regex::Grammar { } - # token assertion:sym<{ }> { - # - # } + token assertion:sym<{ }> { + + } token assertion:sym { $=[ <[?!]> ] diff --git a/t/nqp/49-regex-interpolation.t b/t/nqp/49-regex-interpolation.t index 9246fe7..9280246 100644 --- a/t/nqp/49-regex-interpolation.t +++ b/t/nqp/49-regex-interpolation.t @@ -1,6 +1,6 @@ #! nqp -plan(28); +plan(32); my $b := "b+"; my @foo := [ "b+", "c+" ]; @@ -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');