-
Notifications
You must be signed in to change notification settings - Fork 19
/
gensedscriptforbackticks.nim
64 lines (57 loc) · 1.02 KB
/
gensedscriptforbackticks.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# sed 's/\(\[\.var\]#[^#]\+#\)/`\1`/'
# sed 's/\({[^}]\+}\)/`\1`/'
import strutils
const
Tps = """
var
op
proc
term
code
func
const
lit
key
type
mod
str
obj
tup
mac
array"""
const
Keywords = """
addr and as asm
bind block break
case cast concept const continue converter
defer discard distinct div do
elif else end enum except export
finally for from func
if import in include interface is isnot iterator
let
macro macros method methods mixin mod
nil not notin
object objects of or out
proc procs ptr
raise ref return
shl shr static
template templates try tuple tuples type types
using
var
when while
xor
yield"""
#[
stdout.write "sed -i '"
for k in Keywords.split:
#echo """sed -i 's/\({$1}\)/`\1`/'""" % k, " ?.adoc"
stdout.write """s/\({$1}\)/\\`\1`/g;""" % k
#echo """s/@/@/'""", " nimprogramming.adoc"
echo """'""", " nimprog.adoc"
#echo """sed -i 's/\({[^}]\+}\)/`\1`/'""", " ?.adoc"
echo ""
]#
stdout.write "sed -i '"
for k in Tps.split:
stdout.write """s/\(\[\.$1\]#[^#]\+#\)/\\`\1`/g;""" % k
echo """'""", " nimprog.adoc"