This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Give the 'local' declarator a new key, such that 'local our'
authorGerard Goossen <gerard@tty.nl>
Tue, 8 May 2007 17:42:45 +0000 (19:42 +0200)
committerDave Mitchell <davem@fdisolutions.com>
Sat, 12 May 2007 22:44:02 +0000 (22:44 +0000)
declaration don't have multiple 'd' keys.

Subject:  [PATCH] mad: different key for the locale declarator
Message-Id:  <20070508171125.GI17043@ostwald>

p4raw-id: //depot/perl@31208

mad/Nomad.pm
op.h
perly.act
perly.y

index e425467..4fdd3a8 100755 (executable)
@@ -440,6 +440,7 @@ sub newtype {
 sub madness {
     my $self = shift;
     my @keys = split(' ', shift);
+    @keys = map { $_ eq 'd' ? ('k', 'd') : $_ } @keys;
     my @vals = ();
     for my $key (@keys) {
        my $madprop = $self->{mp}{$key};
diff --git a/op.h b/op.h
index a8cd55d..13fb30e 100644 (file)
--- a/op.h
+++ b/op.h
@@ -696,6 +696,7 @@ struct token {
  * g       op was forced to be a word
  * i       if/unless modifier
  * I       if/elsif/unless statement
+ * k       local declarator
  * K       retired kid op
  * l       last index of array ($#foo)
  * L       label
index 3cdae59..25568e4 100644 (file)
--- a/perly.act
+++ b/perly.act
@@ -1213,7 +1213,7 @@ case 2:
   case 154:
 #line 1085 "perly.y"
     { (yyval.opval) = localize((ps[(2) - (2)].val.opval),IVAL((ps[(1) - (2)].val.i_tkval)));
-                         TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'d');
+                         TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'k');
                        ;}
     break;
 
diff --git a/perly.y b/perly.y
index 33b269a..9960c97 100644 (file)
--- a/perly.y
+++ b/perly.y
@@ -1083,7 +1083,7 @@ term      :       termbinop
                        { $$ = $1; }
        |       LOCAL term      %prec UNIOP
                        { $$ = localize($2,IVAL($1));
-                         TOKEN_GETMAD($1,$$,'d');
+                         TOKEN_GETMAD($1,$$,'k');
                        }
        |       '(' expr ')'
                        { $$ = sawparens(IF_MAD(newUNOP(OP_NULL,0,$2), $2));