Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcfb61be

Browse files
committed
Clean up check_keywords.pl script, making it 'strict' and removing a few
leftover unused variables.Laurent Laborde
1 parent19499bf commitcfb61be

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

‎src/tools/check_keywords.pl

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
1-
#!/usr/bin/perl
1+
#!/usr/bin/perl -w
2+
3+
use strict;
24

35
# Check that the keyword lists in gram.y and kwlist.h are sane. Run from
46
# the top directory, or pass a path to a top directory as argument.
57
#
6-
# $PostgreSQL: pgsql/src/tools/check_keywords.pl,v 1.1 2009/04/29 05:05:57 heikki Exp $
8+
# $PostgreSQL: pgsql/src/tools/check_keywords.pl,v 1.2 2009/04/30 10:26:35 heikki Exp $
9+
10+
my$path;
711

812
if (@ARGV) {
913
$path =$ARGV[0];
1014
shift@ARGV;
15+
}else {
16+
$path =".";
1117
}
1218

13-
if ($patheq'') {$path ="."; }
14-
1519
$[ = 1;# set array base to 1
1620
$, ='';# set output field separator
1721
$\ ="\n";# set output record separator
1822

23+
my%keyword_categories;
1924
$keyword_categories{'unreserved_keyword'} ='UNRESERVED_KEYWORD';
2025
$keyword_categories{'col_name_keyword'} ='COL_NAME_KEYWORD';
2126
$keyword_categories{'type_func_name_keyword'} ='TYPE_FUNC_NAME_KEYWORD';
2227
$keyword_categories{'reserved_keyword'} ='RESERVED_KEYWORD';
2328

24-
$gram_filename ="$path/src/backend/parser/gram.y";
25-
open(GRAM,$gram_filename) ||die("Could not open$gram_filename!");
29+
my$gram_filename ="$path/src/backend/parser/gram.y";
30+
open(GRAM,$gram_filename) ||die("Could not open :$gram_filename");
31+
32+
my ($S,$s,$k,$n,$kcat);
33+
my$comment;
34+
my@arr;
35+
my%keywords;
36+
2637
line:while (<GRAM>) {
2738
chomp;# strip record separator
28-
@Fld =split('',$_, -1);
2939

3040
$S =$_;
3141
# Make sure any braces are split
@@ -50,7 +60,7 @@
5060
$n = (@arr =split('',$S));
5161

5262
# Ok, we're in a keyword list. Go through each field in turn
53-
for ($fieldIndexer = 1;$fieldIndexer <=$n;$fieldIndexer++) {
63+
for (my$fieldIndexer = 1;$fieldIndexer <=$n;$fieldIndexer++) {
5464
if ($arr[$fieldIndexer]eq'*/' &&$comment) {
5565
$comment = 0;
5666
next;
@@ -69,7 +79,6 @@
6979

7080
if ($arr[$fieldIndexer]eq';') {
7181
# end of keyword list
72-
$line ='';
7382
$kcat ='';
7483
next;
7584
}
@@ -85,6 +94,7 @@
8594
close GRAM;
8695

8796
# Check that all keywords are in alphabetical order
97+
my ($prevkword,$kword,$bare_kword);
8898
foreach$kcat (keys%keyword_categories) {
8999
$prevkword ='';
90100

@@ -103,6 +113,7 @@
103113
# kwhashes is a hash of hashes, keyed by keyword category id, e.g.
104114
# UNRESERVED_KEYWORD. Each inner hash is a keyed by keyword id, e.g. ABORT_P
105115
# with a dummy value.
116+
my%kwhashes;
106117
while (my ($kcat,$kcat_id) =each(%keyword_categories) ) {
107118
@arr = @{$keywords{$kcat}};
108119

@@ -114,10 +125,12 @@
114125

115126
# Now read in kwlist.h
116127

117-
$kwlist_filename ="$path/src/include/parser/kwlist.h";
118-
open(KWLIST,$kwlist_filename) ||die("Could not open$kwlist_filename!");
128+
my$kwlist_filename ="$path/src/include/parser/kwlist.h";
129+
open(KWLIST,$kwlist_filename) ||die("Could not open:$kwlist_filename");
119130

120-
$prevkwstring ='';
131+
my$prevkwstring ='';
132+
my$bare_kwname;
133+
my%kwhash;
121134
kwlist_line:while (<KWLIST>) {
122135
my($line) =$_;
123136

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp