2012-01-19 19:50:02 -06:00
|
|
|
#!/usr/bin/perl -w
|
2014-02-13 10:42:52 -06:00
|
|
|
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
2012-01-19 19:50:02 -06:00
|
|
|
|
|
|
|
my $file = $ARGV[0];
|
|
|
|
|
|
|
|
my @lines = <>;
|
|
|
|
|
|
|
|
my $anchors = {};
|
|
|
|
|
|
|
|
my $i = 0;
|
2013-08-03 11:45:23 -05:00
|
|
|
for $line (@lines) {
|
2012-01-19 19:50:02 -06:00
|
|
|
$i++;
|
2013-05-03 18:25:04 -05:00
|
|
|
if ($line =~ m/id="([^"]+)"/) {
|
2012-01-19 19:50:02 -06:00
|
|
|
$anchors->{$1} = $i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$i = 0;
|
2013-08-03 11:45:23 -05:00
|
|
|
for $line (@lines) {
|
2012-01-19 19:50:02 -06:00
|
|
|
$i++;
|
2013-05-03 18:25:04 -05:00
|
|
|
while ($line =~ m/href="#([^"]+)"/g) {
|
2012-01-19 19:50:02 -06:00
|
|
|
if (! exists($anchors->{$1})) {
|
|
|
|
print "$file:$i: $1 referenced\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|