comparison Paper/escape_agda.rb @ 5:339fb67b4375

INIT rbt.agda
author soto <soto@cr.ie.u-ryukyu.ac.jp>
date Sun, 07 Nov 2021 00:51:16 +0900
parents 9176dff8f38a
children
comparison
equal deleted inserted replaced
4:72667e8198e2 5:339fb67b4375
1 #!/usr/bin/env ruby 1 #!/usr/bin/env ruby
2 # coding: utf-8 2 # coding: utf-8
3 3
4 Suffix = '.agda.replaced' 4 Suffix = '.agda.replaced'
5 EscapeChar = '@' 5 EscapeChar = '!'
6 FileName = ARGV.first 6 FileName = ARGV.first
7 7
8 ReplaceTable = { 8 ReplaceTable = {
9 '→' => 'rightarrow', 9 '→' => 'rightarrow',
10 '->' => 'rightarrow', 10 '->' => 'rightarrow',
16 '⟨' => 'langle', 16 '⟨' => 'langle',
17 '⟩' => 'rangle', 17 '⟩' => 'rangle',
18 'ℕ' => 'mathbb{N}', 18 'ℕ' => 'mathbb{N}',
19 '₁' => '_{1}', 19 '₁' => '_{1}',
20 '₂' => '_{2}', 20 '₂' => '_{2}',
21 '₃' => '_{3}',
21 '∎' => 'blacksquare', 22 '∎' => 'blacksquare',
22 'λ' => 'lambda', 23 'λ' => 'lambda',
23 '∧' => 'wedge', 24 '∧' => 'wedge',
24 '/\\' => 'wedge', 25 '/\\' => 'wedge',
25 '⇒' => 'Rightarrow', 26 '⇒' => 'Rightarrow',
27 '≤' => 'leq', 28 '≤' => 'leq',
28 '⊥' => 'bot', 29 '⊥' => 'bot',
29 '∀' => 'forall', 30 '∀' => 'forall',
30 '#' => '\#', 31 '#' => '\#',
31 '⊤' => '\top', 32 '⊤' => '\top',
32 '\'' => '\prime' 33 '\'' => '\prime',
34 '≈' => '\approx'
33 } 35 }
34 36
35 code = File.read(FileName) 37 code = File.read(FileName)
36 ReplaceTable.each do |k, v| 38 ReplaceTable.each do |k, v|
37 escaped_str = EscapeChar + "$\\#{v}$" + EscapeChar 39 escaped_str = EscapeChar + "$\\#{v}$" + EscapeChar