This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pat_advanced.t: Update test
[perl5.git] / regen / keywords.pl
index 5f7f1ef..9619d86 100755 (executable)
@@ -11,7 +11,7 @@
 use strict;
 use Devel::Tokenizer::C 0.05;
 
-require 'regen/regen_lib.pl';
+require './regen/regen_lib.pl';
 
 my $h = open_new('keywords.h', '>',
                 { by => 'regen/keywords.pl', from => 'its data',
@@ -34,18 +34,19 @@ while (<DATA>) {
 }
 
 # If this hash changes, make sure the equivalent hash in
-# dist/B-Deparse/Deparse.pm is also updated.
+# lib/B/Deparse.pm (%feature_keywords) is also updated.
 my %feature_kw = (
-       given   => 'switch',
-       when    => 'switch',
-       default => 'switch',
-       # continue is already a keyword
-       break   => 'switch',
-
-       say     => 'say',
-
-       state   => 'state',
-       );
+    state     => 'state',
+    say       => 'say',
+    given     => 'switch',
+    when      => 'switch',
+    default   => 'switch',
+    # continue is already a keyword
+    break     => 'switch',
+    evalbytes => 'evalbytes',
+    __SUB__   => '__SUB__',
+    fc        => 'fc',
+);
 
 my %pos = map { ($_ => 1) } @{$by_strength{'+'}};
 
@@ -64,12 +65,11 @@ print $c <<"END";
 #define PERL_IN_KEYWORDS_C
 #include "perl.h"
 #include "keywords.h"
+#include "feature.h"
 
 I32
 Perl_keyword (pTHX_ const char *name, I32 len, bool all_keywords)
 {
-  dVAR;
-
   PERL_ARGS_ASSERT_KEYWORD;
 
 $switch
@@ -91,7 +91,7 @@ END
   elsif (my $feature = $feature_kw{$k}) {
     $feature =~ s/([\\"])/\\$1/g;
     return <<END;
-return (all_keywords || FEATURE_IS_ENABLED("$feature") ? ${sign}KEY_$k : 0);
+return (all_keywords || FEATURE_\U$feature\E_IS_ENABLED ? ${sign}KEY_$k : 0);
 END
   }
   return <<END;
@@ -113,10 +113,10 @@ __END__
 -__PACKAGE__
 +__DATA__
 +__END__
+-__SUB__
 +AUTOLOAD
 +BEGIN
 +UNITCHECK
--CORE
 +DESTROY
 +END
 +INIT
@@ -165,10 +165,12 @@ __END__
 -eof
 -eq
 +eval
+-evalbytes
 -exec
 +exists
 -exit
 -exp
+-fc
 -fcntl
 -fileno
 -flock