annotate paper/replace_agda.rb @ 78:6f699b37dc55

Add original number count
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Wed, 18 Feb 2015 12:26:17 +0900 (2015-02-18)
parents 1181b4facaf9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #!/usr/bin/env ruby
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 replace_table = {
45
12c5e455fe55 Writing description proofs of monad-laws for delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 42
diff changeset
4 '->' => 'rightarrow',
41
8fc2ac1f901f Add delta definition in agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 39
diff changeset
5 '∙' => 'circ',
42
4cc65012412f Add proofs of functor-laws on delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
6 '≡' => 'equiv',
41
8fc2ac1f901f Add delta definition in agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 39
diff changeset
7 '×' => 'times',
8fc2ac1f901f Add delta definition in agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 39
diff changeset
8 '⟨' => 'langle',
8fc2ac1f901f Add delta definition in agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 39
diff changeset
9 '⟩' => 'rangle',
8fc2ac1f901f Add delta definition in agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 39
diff changeset
10 '∎' => 'blacksquare'
36
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 }
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 footer = '.replaced'
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 sources = Dir.glob('src/*.agda')
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 sources.each do |src|
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 code = File.read(src)
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 replace_table.each do |k, v|
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 code = code.gsub(k, "@$\\#{v}$@" )
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 end
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 File.write(src+footer , code)
2ff5acb0d2e9 Add escape script
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 end