On Wed, Nov 19, 2008 at 07:23:38AM -0800, Carl Mäsak wrote:
> Rakudo r32873 cannot parse the Unicode version of Texas quotes («»),
> and misunderstands the ASCII-friendly variant (<<>>).
> 
> $ ./perl6 -e 'say <a $b c>.perl'
> ["a", "\$b", "c"]
> $ ./perl6 -e 'my $b = "foo"; say <<a $b c>>.perl'
> 1
> $ ./perl6 -e 'my $b = "foo"; say «a $b c».perl'
> Statement not terminated properly at line 1, near "\x{ab}a $b c\x{c2}\x{bb}."
> [...]

The ASCII versions of some of these are now added in r33209.

First, the texas quotes "work" except they don't properly split
interpolated values (I need to check into this).  Thus:

$ ./parrot perl6.pbc
> my $b = 'foo';   say < a $b c >.perl;
["a", "\$b", "c"]
> my $b = 'foo';   say << a $b c >>.perl;
["a", "foo", "c"]
> my $b = 'foo';   say << a "$b $b" c >>.perl;
["a", "foo foo", "c"]
> my $b = 'foo';   say << a '$b' c >>.perl;
["a", "\$b", "c"]
> my $b = 3;   say << a { $b + 4 } c >>.perl;
["a", "7", "c"]

Here's a case that doesn't yet work -- the interpolated value
isn't properly split.

> my $b = 'foo bar';  say << a $b c >>.perl;
["a", "foo bar", "c"]   # wrong

And, of course, as with double-quoted strings we aren't
interpolating arrays or hashes yet, but that will come soon.
(In the meantime one can use curlies to interpolate them.)

As a bonus, the multiple-bracket-quote variants of q also work now:

> say q << String with > in it. >>.perl;
" String with > in it. "
> say q <<< String with >> and > in it. >>>.perl;
" String with >> and > in it. "
> say qw << Word quoting <things> >>.perl;
["Word", "quoting", "<things>"]

We don't yet handle nested brackets, though -- I'll
wait for the full STD.pm-based quote parser for that.

The « French quotes » will need some slight modification to PGE
to be able to properly handle unicode strings in the grammar.
I'm not quite certain why it's not working already, but it should
be a relatively simple fix, and once it's in (and we have tests)
I think we can close this ticket.

Pm

Reply via email to