summaryrefslogtreecommitdiff
path: root/t/base
diff options
context:
space:
mode:
authorKenneth Albanowski <kjahds@kjahds.com>1997-07-27 18:49:26 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-08-07 00:00:00 +1200
commit1bcde0caf99dffc5d0184a16aa465899f96b7bb4 (patch)
treef30128c7cae5e057962420765e8a815c28cb934c /t/base
parent2a92aaa05aa1acbf01092228d30e9b1d7b2a3f61 (diff)
downloadperl-1bcde0caf99dffc5d0184a16aa465899f96b7bb4.tar.gz
Re: q and escaping paired delimiters
On Sun, 27 Jul 1997 chrisn@rock.petersons.com wrote: > $\ = "\n"; > print '\'this\''; > print q{'this'}; > print q{{this}}; > print q{\{this\}}; > > I would expect the output to be: > > 'this' > 'this' > {this} > {this} That this should be fixed makes perfect sense to me. You can view easily view backwhacking both sides as a generalization of backwhacking the quote for an unbalanced q''. In fact, the code in toke.c looks a little suspicious, as if a cut'n'paste error happened, and the balanced branch didn't get the cleanup it deserved. There's a "if term != '\\'" statement that does nothing, for example. Here'a patch over 5.004_01 (although I'd expect it to work with most versions) to allow you to escape both the starting and end quotes for q (unbalanced and qq is unchanged), and the obligatory addition to the tests. If nobody has any complaints, I expect this will be in _02. Credited: Gurusamy Sarathy <gsar@engin.umich.edu> p5p-msgid: Pine.LNX.3.93.970727172201.350K-100000@kjahds.com
Diffstat (limited to 't/base')
-rwxr-xr-xt/base/lex.t4
1 files changed, 3 insertions, 1 deletions
diff --git a/t/base/lex.t b/t/base/lex.t
index 7e0ca70fd7..6d03b9e8df 100755
--- a/t/base/lex.t
+++ b/t/base/lex.t
@@ -2,7 +2,7 @@
# $RCSfile: lex.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:04 $
-print "1..26\n";
+print "1..27\n";
$x = 'x';
@@ -103,3 +103,5 @@ print "${foo{$bar}}" eq "BAZ" ? "ok 23\n" : "not ok 23\n";
print "FOO:" =~ /$foo[:]/ ? "ok 24\n" : "not ok 24\n";
print "ABC" =~ /^$ary[$A]$/ ? "ok 25\n" : "not ok 25\n";
print "FOOZ" =~ /^$foo[$A-Z]$/ ? "ok 26\n" : "not ok 26\n";
+
+print (((q{{\{\(}} . q{{\)\}}}) eq '{{\(}{\)}}') ? "ok 27\n" : "not ok 27\n");