On Wed, Dec 3, 2008 at 6:19 PM, GW <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I found something that could be problematic (haven't yet found out if it
> should be a special case) in Synopsis 5. More precisely it is under the
> chapter "Accessing captured subrules" in the test case
> t/regex/from_perl6_rules/capture.t lines 67–71:
>
> ok(eval(' "bookkeeper" ~~ m/<single> ($/<single>)/ '), 'Named backref',
> :todo<feature>);
>
> How can the parser know what you mean by $/<single>? Maybe you want $/
> followed by <single> or maybe $/<single>?
If you wanted $/ followed by <single> then you would introduce some
intervening whitespace.
This is just like interpolation into double quoted strings. When you say
my @what = <some example string>;
my $str = "This is a @what[2]";
you always get the 3rd item from the @what array interpolated, not the
string '@what[2]'. If you want the latter, you have to use some other
technique (concatenation, single quotes, etc.)
> A rewrite of this to $<single> would solve this specific problem, but
> not situations like: $/<single><sth>. Variants like $/.<single> are also
> ambiguous.
Same for these.
And if you're doing this in a context where whitespace has meaning (e.g.
:sigspace is in effect), but you don't want the significant whitespace, you
can turn that off temporarily (or again, use some other technique).
HTH,
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]