mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Run newly-configured perltidy script on Perl files.
Run on HEAD and 9.2.
This commit is contained in:
@@ -6,39 +6,39 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
print "/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
|
||||
print
|
||||
"/* autogenerated from src/backend/utils/errcodes.txt, do not edit */\n";
|
||||
print "/* there is deliberately not an #ifndef SPIEXCEPTIONS_H here */\n";
|
||||
|
||||
open my $errcodes, $ARGV[0] or die;
|
||||
|
||||
while (<$errcodes>) {
|
||||
chomp;
|
||||
while (<$errcodes>)
|
||||
{
|
||||
chomp;
|
||||
|
||||
# Skip comments
|
||||
next if /^#/;
|
||||
next if /^\s*$/;
|
||||
# Skip comments
|
||||
next if /^#/;
|
||||
next if /^\s*$/;
|
||||
|
||||
# Skip section headers
|
||||
next if /^Section:/;
|
||||
# Skip section headers
|
||||
next if /^Section:/;
|
||||
|
||||
die unless /^([^\s]{5})\s+([EWS])\s+([^\s]+)(?:\s+)?([^\s]+)?/;
|
||||
die unless /^([^\s]{5})\s+([EWS])\s+([^\s]+)(?:\s+)?([^\s]+)?/;
|
||||
|
||||
(my $sqlstate,
|
||||
my $type,
|
||||
my $errcode_macro,
|
||||
my $condition_name) = ($1, $2, $3, $4);
|
||||
(my $sqlstate, my $type, my $errcode_macro, my $condition_name) =
|
||||
($1, $2, $3, $4);
|
||||
|
||||
# Skip non-errors
|
||||
next unless $type eq 'E';
|
||||
# Skip non-errors
|
||||
next unless $type eq 'E';
|
||||
|
||||
# Skip lines without PL/pgSQL condition names
|
||||
next unless defined($condition_name);
|
||||
# Skip lines without PL/pgSQL condition names
|
||||
next unless defined($condition_name);
|
||||
|
||||
# Change some_error_condition to SomeErrorCondition
|
||||
$condition_name =~ s/([a-z])([^_]*)(?:_|$)/\u$1$2/g;
|
||||
# Change some_error_condition to SomeErrorCondition
|
||||
$condition_name =~ s/([a-z])([^_]*)(?:_|$)/\u$1$2/g;
|
||||
|
||||
print "{ \"spiexceptions.$condition_name\", " .
|
||||
"\"$condition_name\", $errcode_macro },\n";
|
||||
print "{ \"spiexceptions.$condition_name\", "
|
||||
. "\"$condition_name\", $errcode_macro },\n";
|
||||
}
|
||||
|
||||
close $errcodes;
|
||||
|
Reference in New Issue
Block a user