# HG changeset patch # User wenzelm # Date 876411903 -7200 # Node ID 9fdde15e321579a36a40bd16852b2159d48bbf97 # Parent 071c87125cea4f0b3ef8e66f036e1fdc5b7266e5 ensure that dots in formulas are followed by non-idents; diff -r 071c87125cea -r 9fdde15e3215 lib/Tools/fixdots --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/Tools/fixdots Thu Oct 09 17:45:03 1997 +0200 @@ -0,0 +1,39 @@ +#!/bin/bash +# +# $Id$ +# +# DESCRIPTION: ensure that dots in formulas are followed by non-idents + + +## diagnostics + +PRG=$(basename $0) + +function usage() +{ + echo + echo "Usage: $PRG [FILES|DIRS...]" + echo + echo " Recursively find .thy/.ML files, patching them to ensure that" + echo " dots in formulas are followed by non-idents." + echo + exit 1 +} + + +## process command line + +[ $# -eq 0 -o "$1" = "-?" ] && usage + +SPECS="$@"; shift $# + + +## main + +PERL=$(type -path perl) +if [ -z $PERL ]; then + echo "$PRG fatal error: no perl!?" +else + find $SPECS \( -name \*.thy -o -name \*.ML \) -print | \ + xargs $PERL $ISABELLE_HOME/lib/scripts/fixdots.pl +fi \ No newline at end of file diff -r 071c87125cea -r 9fdde15e3215 lib/scripts/fixdots.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/scripts/fixdots.pl Thu Oct 09 17:45:03 1997 +0200 @@ -0,0 +1,42 @@ +# +# $Id$ +# +# fixdots.pl - ensure that dots in formulas are followed by non-idents +# + +foreach $file (@ARGV) { + + if (open (FILE, $file)) { + undef $/; + $text = ; + close FILE; + + $result = ""; + $rest = $text; + + while (1) { + $_ = $rest; + ($pre, $str, $rest) = m/^([^"]*)"((?:[^"\\]|\\.)*)"(.*)$/s; + if ($str) { + $_ = $str; + if (!m/^[a-zA-Z0-9_\/\.]*$/s && !m/\.ML$/s && !m/\.thy/) { # Exclude filenames! + s/([a-zA-Z][a-zA-Z0-9_']*)\.([a-zA-Z])/$1\. $2/g; + } + $result = $result . $pre . '"' . $_ . '"'; + } else { + $result = $result . $_; + last; + } + } + + if ($text ne $result) { + print STDERR "fixing $file\n"; + open (FILE, "> $file") || die $!; + print FILE $result; + close FILE || die $!; + } + + } else { + print STDERR "Can't open file $file: $!\n"; + } +}