lib/scripts/fixdots.pl
changeset 3824 9fdde15e3215
child 3826 0caedb36900d
--- /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 = <FILE>;
+	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";
+    }
+}