-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircus2CSP.sh
executable file
·146 lines (112 loc) · 2.26 KB
/
Circus2CSP.sh
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
#Author: Matt Luckcuck
#Script to help with converting Circus to CSP. It helps, but by no means automates the whole the process!
#Original Date 3rd of October 2014
#Last Update 11th of January 2015
FILE=$1
echo 'Converting...'
################
###SUBSTITUTE###
################
#Bool
sed -i 's/\\boolean/Bool/g' $1
#True
sed -i 's/\\true/True/g' $1
#False
sed -i 's/\\false/False/g' $1
#Then
sed -i 's/\\then/->/g' $1
#{
sed -i 's/\\{/{/g' $1
#}
sed -i 's/\\}/}/g' $1
#t1
sed -i 's/\\t1//g' $1
#t2
sed -i 's/\\t2//g' $1
#t3
sed -i 's/\\t3//g' $1
#cross
sed -i 's/\\cross/./g' $1
#\_
sed -i 's/\\_/_/g' $1
#\circchannel
sed -i 's/\\circchannel/channel/g' $1
#channelset
sed -i 's/\\channelset/nametype/g' $1
#rchanset
sed -i 's/\\rchanset/|}/g' $1
#lchanset
sed -i 's/\\lchanset/{|/g' $1
#if
sed -i 's/\\circif/if/g' $1
#then
sed -i 's/\\circthen/then/g' $1
#else
sed -i 's/\\circelse/else/g' $1
#fi
sed -i 's/\\circfi//g' $1
#circdef
sed -i 's/\\circdef/=/g' $1
#~?~
sed -i 's/\~?~/?/g' $1
#~!~
sed -i 's/\~!~/!/g' $1
#~.~
sed -i 's/\~.~/./g' $1
#\Skip
sed -i 's/\\Skip/SKIP/g' $1
#\prefixcolon
sed -i 's/\\prefixcolon/:/g' $1
#\neq
sed -i 's/\\neq/!=/g' $1
#\circseq
sed -i 's/\\circseq/;/g' $1
#\extchoice
sed -i 's/\\extchoice/[]/g' $1
#\interleave
sed -i 's/\\interleave/|||/g' $1
#\Interleave
sed -i 's/\\Interleave/|||/g' $1
#\Chaos
sed -i 's/\\Chaos/Chaos(Events)/g' $1
############
###REMOVE###
############
#\begin{parser}
sed -i 's/\\begin{parser}//g' $1
#\end{parser}
sed -i 's/\\end{parser}//g' $1
#\begin{schema}
sed -i 's/\\begin{schema}//g' $1
#\end{schema}
sed -i 's/\\end{schema}//g' $1
#\begin{zsection}
sed -i 's/\\begin{zsection}//g' $1
#\end{zsection}
sed -i 's/\\end{zsection}//g' $1
#\begin{circus}
sed -i 's/\\begin{circus}//g' $1
#\end{circus}
sed -i 's/\\end{circus}//g' $1
#end{circusaction}
sed -i 's/\\begin{circusaction}//g' $1
#begin{circusaction}
sed -i 's/\\end{circusaction}//g' $1
#\lschexpract
sed -i 's/\\lschexpract//g' $1
#\rschexpract
sed -i 's/\\rschexpract//g' $1
# \circend
sed -i 's/\\circend//g' $1
#%
sed -i 's/\%//g' $1
#\\
sed -i 's/\\\\//g' $1
#~
sed -i 's/~//g' $1
#\also
sed -i 's/\\also//g' $1
# sed "s/$OLD/$NEW/g" "$f" > $TFILE && mv $TFILE "$f"
echo 'Done'
#The Road Goes Ever On and On