author | paulson |
Wed, 24 Dec 1997 10:42:27 +0100 | |
changeset 4478 | 9c5a0eef74ff |
parent 4417 | 44ff59be6031 |
child 4592 | ff0c5c57fdfb |
permissions | -rw-r--r-- |
4417 | 1 |
# |
2 |
# $Id$ |
|
3 |
# |
|
4 |
# expandshort.pl - expand shorthand goal commands |
|
5 |
# |
|
4478
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
6 |
# in "be ... i;" -> "by (etac ... i);" the "..." phrase is not allowed to |
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
7 |
# contain punctuation. Otherwise, comments can be affected! |
4417 | 8 |
|
9 |
sub expandshort { |
|
10 |
my ($file) = @_; |
|
11 |
||
12 |
open (FILE, $file) || die $!; |
|
13 |
undef $/; $text = <FILE>; $/ = "\n"; # slurp whole file |
|
14 |
close FILE || die $!; |
|
15 |
||
16 |
$_ = $text; |
|
17 |
||
18 |
s/\bsafe_tac *\(claset *\( *\) *\)/Safe_tac/sg; |
|
19 |
s/ *\(Safe_tac\) *([0-9]+)/ Safe_tac \1/sg; |
|
20 |
s/ *\(Safe_tac\)/ Safe_tac/sg; |
|
21 |
s/\bby\(/by (/sg; |
|
22 |
s/\bba\b *(\d+);/by (assume_tac \1);/sg; |
|
4478
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
23 |
s/\bbr\b *([^;.*!]*) (\d+);/by (rtac \1 \2);/sg; |
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
24 |
s/\bbrs\b *([^;.*!]*) (\d+);/by (resolve_tac \1 \2);/sg; |
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
25 |
s/\bbd\b *([^;.*!]*) (\d+);/by (dtac \1 \2);/sg; |
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
26 |
s/\bbds\b *([^;.*!]*) (\d+);/by (dresolve_tac \1 \2);/sg; |
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
27 |
s/\bbe\b *([^;.*!]*) (\d+);/by (etac \1 \2);/sg; |
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
28 |
s/\bbes\b *([^;.*!]*) (\d+);/by (eresolve_tac \1 \2);/sg; |
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
29 |
s/\bbw\b *([^;.*!]*);/by (rewtac \1);/sg; |
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
30 |
s/\bbws\b *([^;.*!]*);/by (rewrite_goals_tac \1);/sg; |
9c5a0eef74ff
More restrictive patterns to prevent changing comments
paulson
parents:
4417
diff
changeset
|
31 |
s/\bauto *\(\)/by Auto_tac/sg; |
4417 | 32 |
s/dresolve_tac *\[(\w+)\] */dtac \1 /sg; |
33 |
s/eresolve_tac *\[(\w+)\] */etac \1 /sg; |
|
34 |
s/resolve_tac *\[(\w+)\] */rtac \1 /sg; |
|
35 |
s/rewrite_goals_tac *\[(\w+)\]( *)/rewtac \1\2/sg; |
|
36 |
s/rtac *\((\w+)\s+RS\s+ssubst\)\s+/stac \1 /sg; |
|
37 |
||
38 |
$result = $_; |
|
39 |
||
40 |
if ($text ne $result) { |
|
41 |
print STDERR "expanding $file\n"; |
|
42 |
if (! -f "$file~~") { |
|
43 |
rename $file, "$file~~" || die $!; |
|
44 |
} |
|
45 |
open (FILE, "> $file") || die $!; |
|
46 |
print FILE $result; |
|
47 |
close FILE || die $!; |
|
48 |
} |
|
49 |
} |
|
50 |
||
51 |
||
52 |
## main |
|
53 |
||
54 |
foreach $file (@ARGV) { |
|
55 |
eval { &expandshort($file); }; |
|
56 |
if ($@) { print STDERR "*** expandshort $file: ", $@, "\n"; } |
|
57 |
} |