-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.yaml
135 lines (135 loc) · 3.25 KB
/
source.yaml
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
function_header:
regex: func <func>\((.*)\):<i1>4<i2>$
tokens: [func_name,args,statements,tab]
function:
regex: "<func>\\((.*)\\)"
tokens: [func_name,argument]
argument:
replace: [["^(.+?)$"," \\1"]]
const_var:
regex: const <var>\s*=\s*(?!\s)(.+)$
tokens: [var_name,value]
equality:
regex: <varof>==<varof>
tokens: [value1,value2]
equality_not:
regex: <varof>!=<varof>
tokens: [value1,value2]
gl:
regex: <varof>([<>]=*)([^:]+)(:*)
tokens: [value1,operator,value2,end]
loop:
regex: loop\(((?:(?:\n\t+?.*)+\n*)+)\)
tokens: [statements]
inc:
regex: <var>\+=<var>
tokens: [var,num]
dec:
regex: <var>-=<var>
tokens: [var,num]
assignment:
regex: <var>\s*=\s*(?!\s)(?!~)(.+)$
tokens: [var_name,value]
arithematic:
regex: \(<varof> (<op>) <varof>\)
tokens: [num1,operator,num2]
_1arithematic:
regex: (<opn>) (<op>) <varof>
_2arithematic:
regex: <varof> (<op>) (<opn>)
_3arithematic:
regex: (<opn>) (<op>) (<opn>)
_4arithematic:
regex: \((<opn>) (<op>) <varof>\)
_5arithematic:
regex: \(<varof> (<op>) (<opn>)\)
_6arithematic:
regex: \((<opn>) (<op>) (<opn>)\)
arithematic1:
regex: \(\((.+)\)\)
tokens: [inside]
_7arithematic:
regex: <varof> (<op>) <varof>
andor:
regex: <varof> (and|or) <varof>
tokens: [value1,operator,value2]
not:
regex: not <varof>
tokens: [value1]
cond_else:
regex: cond (.+):<i1>3<i2>\nelse:<i1>5<i2>
tokens: [bool,statements,tab,estatements,etab]
cond:
regex: cond (.+):<i1>3<i2>
tokens: [bool,statements,etab]
if_else:
regex: if (.+):<i1>3<i2>\n\t*else:<i1>5<i2>
tokens: [bool,statements,tab,estatements,etab]
if:
regex: if (.+):<i1>3<i2>
tokens: [bool,statements,etab]
when:
regex: when (.+):<i1>3<i2>
tokens: [bool,statements,etab]
case:
regex: chance (.+):<i1>3<i2>$
tokens: [value,statements,etab]
statements:
replace: [["\n\t"],["\t\n"]]
switch:
regex: switch (.+):<i1>3<i2>$
tokens: [exp,statements,etab]
statements:
replace: [["\t"],["\n\n","\n"]]
for_loop:
regex: for <var> in (.+):<i1>4<i2>$
tokens: [var_name,list,statements,etab]
statements:
replace: [["^\n\t"]]
for_range:
#(\\d+|\\(.+\\))\\.\\.(\\d+|\\(.+\\))
regex: "for <var> <var>\\.\\.<var>:<i1>5<i2>$"
tokens: [var_name,start,end,statements,tab]
#statements:
#replace: [["^\n\t"]]
do:
regex: upto (.+) rtn (.+):(.*)<i1>5<i2>$
tokens: [bool,return,exp,statements,etab]
statements:
replace: [["^\n\t"],["\n$"]]
dotimes:
regex: "(\\d+) times for <var>:<i1>4<i2>$"
tokens: [value,var_name,statements,etab]
statements:
replace: [["\n\t$","\n"]]
do_list:
regex: do <var> in (.+):<i1>4<i2>$
tokens: [var_name,list,statements,etab]
restval:
regex: "\\*<var>\\)"
tokens: [val]
opval:
regex: "&op (.+)\\)"
tokens: [val]
lambda:
regex: "lambda (.+):(.+)(?:$|\\))"
tokens: [args,statement]
arg:
regex: "\\((?:\n*.+,\n*)+(?:.|\n)+\\)"
tokens: [args]
args:
replace: [[","," "]]
mod:
regex: <var>%<var>
tokens: [val1,val2]
settings:
loop: True
looplimit: 5
variables:
opn: \(<op> .+ .+\)
var: (\w+)
varof: ([A-Za-z0-9_%+\-]+)
i1: "(\n(\t+?).*(?:(?:\n\\"
i2: .*)*\n*)*)
func: "([A-Ba-z_\\-]+)"
op: "[+-/*]"