summaryrefslogtreecommitdiff
path: root/libjava/classpath/scripts
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-09 10:53:40 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-09 10:53:40 +0000
commit371d44c80da86f126182832ce84884abb1c75a10 (patch)
treecb7614ee3e5f8afa22602ebe3a7fa2a14e47c75d /libjava/classpath/scripts
parent6a6618c00f9d8dc89bd3849b44d48178a6cec584 (diff)
downloadgcc-371d44c80da86f126182832ce84884abb1c75a10.tar.gz
PR 23566
* scripts/timezones.pl: Parse each file in 2 passes, in one parse just Rule lines, in the other everything else. Pass 0 instead of $savings as second argument to parseRule when parsing the start rule. * java/util/TimeZone.java (timezones): Regenerate from tzdata2007a. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121740 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/scripts')
-rwxr-xr-xlibjava/classpath/scripts/timezones.pl35
1 files changed, 34 insertions, 1 deletions
diff --git a/libjava/classpath/scripts/timezones.pl b/libjava/classpath/scripts/timezones.pl
index 142ea4b7582..a069dedf6bd 100755
--- a/libjava/classpath/scripts/timezones.pl
+++ b/libjava/classpath/scripts/timezones.pl
@@ -213,6 +213,10 @@ foreach $file (@TIMEZONEFILES) {
# print STDERR "$file\n";
open INPUT, "$TIMEZONEDIR/$file" or die "Can't open $TIMEZONEDIR/$file";
my $in_time_zone = 0;
+ # As Zone can reference even Rule which is defined after the
+ # current line, parse the file in 2 passes.
+
+ # First pass, parse just Rule lines:
while (<INPUT>) {
$_ = $1 if /^([^\#]*)\#/;
next if /^\s*$/;
@@ -239,6 +243,35 @@ foreach $file (@TIMEZONEFILES) {
} elsif ($entries[0] eq "Zone") {
$in_time_zone = 1;
shift @entries;
+ shift @entries;
+ } elsif (!(($entries[0] eq "Remove") || ($entries[0] eq "Link"))) {
+ die "Unknown command: $_";
+ }
+ }
+ if ($in_time_zone) {
+ die "early end of Zone: $_" if ($entries[0] =~ /^[A-Za-z]+/);
+ if (@entries <= 3) {
+ $in_time_zone = 0;
+ }
+ }
+ }
+ close INPUT;
+ open INPUT, "$TIMEZONEDIR/$file" or die "Can't open $TIMEZONEDIR/$file";
+ $in_time_zone = 0;
+
+ # Second pass, parse all but Rule lines.
+ while (<INPUT>) {
+ $_ = $1 if /^([^\#]*)\#/;
+ next if /^\s*$/;
+ my @entries = split;
+# $, = ","; print "'$_' -> [",@entries,"]\n";
+ if (!$in_time_zone) {
+ if ($entries[0] eq "Rule") {
+ # Do nothing, this was already handled in the
+ # first pass.
+ } elsif ($entries[0] eq "Zone") {
+ $in_time_zone = 1;
+ shift @entries;
$timezonename = shift @entries;
} elsif ($entries[0] eq "Remove") {
my $found = 0;
@@ -295,7 +328,7 @@ foreach $file (@TIMEZONEFILES) {
my $savings = $rule->[2];
my $endrule = parseRule($rawoffset, $savings,
$rule->[0]);
- my $startrule = parseRule($rawoffset, $savings,
+ my $startrule = parseRule($rawoffset, 0,
$rule->[1]);
$rule = [ $endrule, $startrule, $savings ];
# print "start",@{$rule->[1]}, "end", @{$rule->[0]},