doc-src/IsarImplementation/checkglossary
author wenzelm
Wed, 17 Sep 2008 21:27:08 +0200
changeset 28262 aa7ca36d67fd
parent 18537 2681f9e34390
permissions -rwxr-xr-x
back to dynamic the_context(), because static @{theory} is invalidated if ML environment changes within the same code block;

#!/usr/bin/env perl
# $Id$

use strict;

my %defs = ();
my %refs = ();

while (<ARGV>) {
    if (m,\\glossaryentry\{\w*\\bf *((\w|\s)+)@,) {
	$defs{lc $1} = 1;
    }
    while (m,\\seeglossary *\{((\w|\s)+)\},g) {
	$refs{lc $1} = 1;
    }
}

print "Glossary definitions:\n";
foreach (sort(keys(%defs))) {
    print "  \"$_\"\n";
}

foreach (keys(%refs)) {
    s,s$,,;
    if (!defined($defs{$_})) {
	print "### Undefined glossary reference: \"$_\"\n";
    }
}