This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In pp_regcomp and pp_entereval, use newSVpvn_flags() to simplify code.
[perl5.git] / keywords.pl
index d3426be..7ce010e 100755 (executable)
@@ -1,22 +1,59 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
+# 
+# Regenerate (overwriting only if changed):
+#
+#    keywords.h
+#
+# from information stored in the DATA section of this file.
+#
+# Accepts the standard regen_lib -q and -v args.
+#
+# This script is normally invoked from regen.pl.
 
-open(KW, ">keywords.h") || die "Can't create keywords.h: $!\n";
-select KW;
+use strict;
+
+require 'regen_lib.pl';
+
+my $kw = safer_open("keywords.h-new");
+select $kw;
+
+print <<EOM;
+/* -*- buffer-read-only: t -*-
+ *
+ *    keywords.h
+ *
+ *    Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2005,
+ *    2006, 2007, by Larry Wall and others
+ *
+ *    You may distribute under the terms of either the GNU General Public
+ *    License or the Artistic License, as specified in the README file.
+ *
+ * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
+ *  This file is built by keywords.pl from its data.  Any changes made here
+ *  will be lost!
+ */
+EOM
 
 # Read & print data.
 
-$keynum = 0;
+my $keynum = 0;
 while (<DATA>) {
     chop;
     next unless $_;
     next if /^#/;
-    ($keyword) = split;
+    my ($keyword) = split;
     print &tab(5, "#define KEY_$keyword"), $keynum++, "\n";
 }
 
+print $kw "\n/* ex: set ro: */\n";
+
+safer_close($kw);
+
+rename_if_different("keywords.h-new", "keywords.h");
+
 ###########################################################################
 sub tab {
-    local($l, $t) = @_;
+    my ($l, $t) = @_;
     $t .= "\t" x ($l - (length($t) + 1) / 8);
     $t;
 }
@@ -24,20 +61,19 @@ sub tab {
 __END__
 
 NULL
-__LINE__
 __FILE__
+__LINE__
+__PACKAGE__
+__DATA__
 __END__
 AUTOLOAD
 BEGIN
+UNITCHECK
 CORE
 DESTROY
 END
-EQ
-GE
-GT
-LE
-LT
-NE
+INIT
+CHECK
 abs
 accept
 alarm
@@ -46,6 +82,7 @@ atan2
 bind
 binmode
 bless
+break
 caller
 chdir
 chmod
@@ -63,6 +100,7 @@ cos
 crypt
 dbmclose
 dbmopen
+default
 defined
 delete
 die
@@ -119,6 +157,7 @@ getservbyport
 getservent
 getsockname
 getsockopt
+given
 glob
 gmtime
 goto
@@ -141,6 +180,7 @@ link
 listen
 local
 localtime
+lock
 log
 lstat
 lt
@@ -161,6 +201,7 @@ open
 opendir
 or
 ord
+our
 pack
 package
 pipe
@@ -168,9 +209,11 @@ pop
 pos
 print
 printf
+prototype
 push
 q
 qq
+qr
 quotemeta
 qw
 qx
@@ -192,6 +235,7 @@ rewinddir
 rindex
 rmdir
 s
+say
 scalar
 seek
 seekdir
@@ -226,17 +270,21 @@ sprintf
 sqrt
 srand
 stat
+state
 study
 sub
 substr
 symlink
 syscall
+sysopen
 sysread
+sysseek
 system
 syswrite
 tell
 telldir
 tie
+tied
 time
 times
 tr
@@ -259,6 +307,7 @@ wait
 waitpid
 wantarray
 warn
+when
 while
 write
 x