This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
An implementation of change 29735 for blead (PL_curcop could be NULL)
[perl5.git] / regen_perly.pl
index 674aa78..fb01dbd 100644 (file)
@@ -175,6 +175,11 @@ sub extract {
     # C<#line 188 "perlytmp.c"> gets picked up by make depend, so remove them.
     $actlines =~ s/^#line \d+ "\Q$tmpc_file\E".*$//gm;
 
+    # convert yyvsp[nnn] into ps[nnn].val
+
+    $actlines =~ s/yyvsp\[(.*?)\]/ps[$1].val/g
+       or die "Can't convert value stack name\n";
+
     return $actlines. "\n", $tablines. "\n";
 }
 
@@ -216,6 +221,10 @@ sub make_type_tab {
     my $default_token;
     open my $fh, '<', $y_file or die "Can't open $y_file: $!\n";
     while (<$fh>) {
+       if (/(\$\d+)\s*=/) {
+           warn "$y_file:$.: dangerous assignment to $1: $_";
+       }
+
        if (/__DEFAULT__/) {
            m{(\w+) \s* ; \s* /\* \s* __DEFAULT__}x
                or die "$y_file: can't parse __DEFAULT__ line: $_";
@@ -253,7 +262,6 @@ sub make_type_tab {
        . join(", ", map "toketype_$_", sort keys %types)
        . "\n} toketypes;\n\n"
        . "/* type of each token/terminal */\n"
-       . "static const toketypes XXX;\n"
        . "static const toketypes yy_type_tab[] =\n{\n"
        . $fields
        . "\n};\n";