develooper Front page | perl.perl5.porters | Postings from October 2008

Re: [perl #56880][PATCH] can't use v[0-9]+ as label (vstring)

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
October 29, 2008 02:28
Subject:
Re: [perl #56880][PATCH] can't use v[0-9]+ as label (vstring)
Message ID:
b77c1dce0810290228w33cac35ep628cf9ebaa1ec58a@mail.gmail.com
2008/10/29 Renée Bäcker <renee.baecker@smart-websolutions.de>:
> Hi,
>
> attached is a small patch that allows v[0-9]+ to be used as a label.

Obvious question -- how does it react in the presence of double
colons, like in v10::foo ?
I would probably put the condition with the isALPHA below so the
PL_expect is tested too.

(Also, I would suggest to send only one patch, and not one patch per
file modified, and make them appliable without problems by using the
same number of slashes in the +++ and --- lines. Actually git-diff and
even better git-format-patch do that for you. But all those rants will
be better put in the P5 wiki and in the perlhack.pod document, will
come real soon now...)

> --- ../orig/perl-5.10.0/toke.c  2007-12-18 11:47:08.000000000 +0100
> +++ toke.c      2008-10-28 10:51:12.000000000 +0100
> @@ -5106,6 +5106,9 @@
>                s = scan_num(s, &pl_yylval);
>                TERM(THING);
>            }
> +            else if ( *start == ':' ){
> +               goto keylookup;
> +            }
>            /* avoid v123abc() or $h{v1}, allow C<print v10;> */
>            else if (!isALPHA(*start) && (PL_expect == XTERM
>                        || PL_expect == XREF || PL_expect == XSTATE
>
>



-- 
'Do you know what they called a sausage-in-a-bun in Quirm?' said Mr Pin,
as the two walked away. --- 'No?' said Mr Tulip. --- 'They called it "le
sausage-in-le-bun".'                       -- Terry Pratchett, The Truth

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About