From 70581f07756bfa74a763274ed0f7319b19584700 Mon Sep 17 00:00:00 2001 From: "Flavio S. Glock" Date: Wed, 14 Nov 2012 17:30:17 +0100 Subject: [PATCH] Perlito5 - parser - TODO cleanup: deref inside double quotes --- TODO-perlito5 | 8 -------- t5/01-perlito/04-string.t | 11 ++++++++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/TODO-perlito5 b/TODO-perlito5 index e982458b5..a1ec47482 100644 --- a/TODO-perlito5 +++ b/TODO-perlito5 @@ -61,14 +61,6 @@ TODO list for Perlito5 --- check signature in sort() --- fix the prototype for 'stat(*)' (see t/test.pl in the perl test suite) --- deref inside double quotes: - $ node perlito5.js -Bjs -e ' my $x = "123"; my $y = \$x; print "[$$y]\n" ' - [$[object Object]] - - $ node perlito5.js -MO=Deparse -e ' " $v->{x} $$v{x} " ' - (' ' . $v . '->{x} $' . $v{'x'} . ' '); - - -- add "print", "printf", "say" special parsing - note this is related to indirect object notation -- indirect object notation http://lwn.net/Articles/451486/ diff --git a/t5/01-perlito/04-string.t b/t5/01-perlito/04-string.t index 9e98152d3..06f6b4d90 100755 --- a/t5/01-perlito/04-string.t +++ b/t5/01-perlito/04-string.t @@ -2,7 +2,7 @@ use v5; use strict; use feature 'say'; -say '1..18'; +say '1..19'; my $x = "abcd"; if (substr($x,1,1) ne "b") { @@ -99,4 +99,13 @@ print 'not ' if $r ne '-890-'; say "ok 18 - array deref interpolation - $r"; # print 'not ' if $r ne '-890-'; say 'ok 18 - array deref interpolation'; # } +$r = "-$$v[2]-"; +print 'not ' if $r ne '-890-'; say "ok 18 - array deref interpolation - $r"; + +{ + my $x = "123"; + my $y = \$x; + $r = "[$$y]"; + print 'not ' if $r ne '[123]'; say "ok 19 - scalar deref interpolation - $r"; +}