This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Code comments, by Brandon Black
[perl5.git] / keywords.pl
index acdf807..d702a1a 100755 (executable)
@@ -1,23 +1,47 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
+use strict;
 
-unlink "keywords.h";
+require 'regen_lib.pl';
+safer_unlink ("keywords.h");
 open(KW, ">keywords.h") || die "Can't create keywords.h: $!\n";
+binmode KW;
 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";
+
+close KW or die "Error closing keywords.h: $!";
+
 ###########################################################################
 sub tab {
-    local($l, $t) = @_;
+    my ($l, $t) = @_;
     $t .= "\t" x ($l - (length($t) + 1) / 8);
     $t;
 }
@@ -32,17 +56,12 @@ __DATA__
 __END__
 AUTOLOAD
 BEGIN
+UNITCHECK
 CORE
 DESTROY
 END
-EQ
-GE
-GT
 INIT
-LE
-LT
-NE
-STOP
+CHECK
 abs
 accept
 alarm
@@ -51,6 +70,7 @@ atan2
 bind
 binmode
 bless
+break
 caller
 chdir
 chmod
@@ -68,6 +88,7 @@ cos
 crypt
 dbmclose
 dbmopen
+default
 defined
 delete
 die
@@ -84,6 +105,7 @@ endpwent
 endservent
 eof
 eq
+err
 eval
 exec
 exists
@@ -124,6 +146,7 @@ getservbyport
 getservent
 getsockname
 getsockopt
+given
 glob
 gmtime
 goto
@@ -201,6 +224,7 @@ rewinddir
 rindex
 rmdir
 s
+say
 scalar
 seek
 seekdir
@@ -235,6 +259,7 @@ sprintf
 sqrt
 srand
 stat
+state
 study
 sub
 substr
@@ -271,6 +296,7 @@ wait
 waitpid
 wantarray
 warn
+when
 while
 write
 x