From: Rafael Garcia-Suarez Date: Mon, 5 Jan 2009 17:14:01 +0000 (+0100) Subject: Require a space or a newline after a "#line XXX" directive X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=26b6dc3ff01d5987ade8e7bb4d8844b01828ff83;p=p5sagit%2Fp5-mst-13.2.git Require a space or a newline after a "#line XXX" directive This fixes bug [perl #59170] Typo: bad regex for #line directive in perlsyn. --- diff --git a/t/comp/parser.t b/t/comp/parser.t index 2e23226..9e1d427 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -9,7 +9,7 @@ BEGIN { } BEGIN { require "./test.pl"; } -plan( tests => 110 ); +plan( tests => 112 ); eval '%@x=0;'; like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' ); @@ -330,6 +330,9 @@ check(qr/^"BBFRPRAFPGHPP$/, 43, "actually missing a quote is still valid"); #line 47 bang eth check(qr/^"BBFRPRAFPGHPP$/, 46, "but spaces aren't allowed without quotes"); +#line 77sevenseven +check(qr/^"BBFRPRAFPGHPP$/, 49, "need a space after the line number"); + eval <<'EOSTANZA'; die $@ if $@; #line 51 "With wonderful deathless ditties|We build up the world's great cities,|And out of a fabulous story|We fashion an empire's glory:|One man with a dream, at pleasure,|Shall go forth and conquer a crown;|And three with a new song's measure|Can trample a kingdom down." check(qr/^With.*down\.$/, 51, "Overflow the second small buffer check"); diff --git a/toke.c b/toke.c index 580ca91..750e4d4 100644 --- a/toke.c +++ b/toke.c @@ -824,6 +824,8 @@ S_incline(pTHX_ const char *s) n = s; while (isDIGIT(*s)) s++; + if (!SPACE_OR_TAB(*s) && *s != '\n' && *s != '\0') + return; while (SPACE_OR_TAB(*s)) s++; if (*s == '"' && (t = strchr(s+1, '"'))) {