mulang 5.3.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/console +2 -2
- data/bin/mulang +0 -0
- data/lib/locales/en.yml +36 -56
- data/lib/locales/es.yml +35 -55
- data/lib/locales/operators.yml +96 -0
- data/lib/locales/pt.yml +33 -53
- data/lib/mulang.rb +53 -4
- data/lib/mulang/code.rb +36 -6
- data/lib/mulang/expectation.rb +44 -24
- data/lib/mulang/expectation/i18n.rb +11 -45
- data/lib/mulang/language.rb +43 -10
- data/lib/mulang/sexp.rb +80 -0
- data/lib/mulang/tokens.rb +275 -0
- data/lib/mulang/version.rb +2 -2
- metadata +22 -6
@@ -0,0 +1,275 @@
|
|
1
|
+
module Mulang
|
2
|
+
module Tokens
|
3
|
+
TOKENS = {
|
4
|
+
Common: {
|
5
|
+
keyword_False: 'false',
|
6
|
+
keyword_Null: 'null',
|
7
|
+
keyword_True: 'true',
|
8
|
+
keyword_For: 'for',
|
9
|
+
keyword_If: 'if',
|
10
|
+
keyword_Return: 'return',
|
11
|
+
keyword_While: 'while',
|
12
|
+
operator_And: '&&',
|
13
|
+
operator_Divide: '/',
|
14
|
+
operator_Equal: '==',
|
15
|
+
operator_GreatherOrEqualThan: '>=',
|
16
|
+
operator_GreatherThan: '>',
|
17
|
+
operator_LessOrEqualThan: '<=',
|
18
|
+
operator_LessThan: '<',
|
19
|
+
operator_Minus: '-',
|
20
|
+
operator_Multiply: '*',
|
21
|
+
operator_Negation: '!',
|
22
|
+
operator_NotEqual: '!=',
|
23
|
+
operator_Or: '||',
|
24
|
+
operator_Plus: '+',
|
25
|
+
operator_Modulo: '%',
|
26
|
+
operator_BitwiseOr: '|',
|
27
|
+
operator_BitwiseAnd: '&',
|
28
|
+
operator_BitwiseXor: '^',
|
29
|
+
operator_BitwiseLeftShift: '<<',
|
30
|
+
operator_BitwiseRightShift: '>>'
|
31
|
+
},
|
32
|
+
C: {
|
33
|
+
keyword_False: 'FALSE',
|
34
|
+
keyword_Null: 'NULL',
|
35
|
+
keyword_True: 'TRUE',
|
36
|
+
keyword_For: 'for',
|
37
|
+
keyword_If: 'if',
|
38
|
+
keyword_Return: 'return',
|
39
|
+
keyword_While: 'while',
|
40
|
+
keyword_Switch: 'switch',
|
41
|
+
operator_And: '&&',
|
42
|
+
operator_Divide: '/',
|
43
|
+
operator_Equal: '==',
|
44
|
+
operator_GreatherOrEqualThan: '>=',
|
45
|
+
operator_GreatherThan: '>',
|
46
|
+
operator_LessOrEqualThan: '<=',
|
47
|
+
operator_LessThan: '<',
|
48
|
+
operator_Minus: '-',
|
49
|
+
operator_Multiply: '*',
|
50
|
+
operator_Negation: '!',
|
51
|
+
operator_NotEqual: '!=',
|
52
|
+
operator_Or: '||',
|
53
|
+
operator_Plus: '+',
|
54
|
+
operator_Modulo: '%',
|
55
|
+
operator_BitwiseOr: '|',
|
56
|
+
operator_BitwiseAnd: '&',
|
57
|
+
operator_BitwiseXor: '^',
|
58
|
+
operator_BitwiseLeftShift: '<<',
|
59
|
+
operator_BitwiseRightShift: '>>'
|
60
|
+
},
|
61
|
+
Haskell: {
|
62
|
+
keyword_False: 'False',
|
63
|
+
keyword_True: 'True',
|
64
|
+
keyword_If: 'if',
|
65
|
+
keyword_TypeAlias: 'type',
|
66
|
+
operator_And: '&&',
|
67
|
+
operator_Divide: '/',
|
68
|
+
operator_Equal: '==',
|
69
|
+
operator_GreatherOrEqualThan: '>=',
|
70
|
+
operator_GreatherThan: '>',
|
71
|
+
operator_LessOrEqualThan: '<=',
|
72
|
+
operator_LessThan: '<',
|
73
|
+
operator_Minus: '-',
|
74
|
+
operator_Multiply: '*',
|
75
|
+
operator_Negation: 'not',
|
76
|
+
operator_NotEqual: '/=',
|
77
|
+
operator_Or: '||',
|
78
|
+
operator_Plus: '+',
|
79
|
+
operator_Modulo: 'mod',
|
80
|
+
operator_Otherwise: 'otherwise',
|
81
|
+
operator_BackwardComposition: '.'
|
82
|
+
},
|
83
|
+
Java: {
|
84
|
+
keyword_False: 'false',
|
85
|
+
keyword_Null: 'null',
|
86
|
+
keyword_True: 'true',
|
87
|
+
keyword_For: 'for',
|
88
|
+
keyword_If: 'if',
|
89
|
+
keyword_Return: 'return',
|
90
|
+
keyword_While: 'while',
|
91
|
+
keyword_Class: 'class',
|
92
|
+
keyword_ForEach: 'for',
|
93
|
+
keyword_Interface: 'interface',
|
94
|
+
keyword_Switch: 'switch',
|
95
|
+
operator_And: '&&',
|
96
|
+
operator_Divide: '/',
|
97
|
+
operator_Equal: 'equal',
|
98
|
+
operator_GreatherOrEqualThan: '>=',
|
99
|
+
operator_GreatherThan: '>',
|
100
|
+
operator_LessOrEqualThan: '<=',
|
101
|
+
operator_LessThan: '<',
|
102
|
+
operator_Minus: '-',
|
103
|
+
operator_Multiply: '*',
|
104
|
+
operator_Negation: '!',
|
105
|
+
operator_NotEqual: '!=',
|
106
|
+
operator_Or: '||',
|
107
|
+
operator_Plus: '+',
|
108
|
+
operator_Modulo: '%',
|
109
|
+
operator_BitwiseOr: '|',
|
110
|
+
operator_BitwiseAnd: '&',
|
111
|
+
operator_BitwiseXor: '^',
|
112
|
+
operator_BitwiseLeftShift: '<<',
|
113
|
+
operator_BitwiseRightShift: '>>',
|
114
|
+
operator_Hash: 'hashCode',
|
115
|
+
operator_Same: '==',
|
116
|
+
operator_NotSame: '!='
|
117
|
+
},
|
118
|
+
JavaScript: {
|
119
|
+
keyword_False: 'false',
|
120
|
+
keyword_Null: 'null',
|
121
|
+
keyword_True: 'true',
|
122
|
+
keyword_For: 'for',
|
123
|
+
keyword_If: 'if',
|
124
|
+
keyword_Return: 'return',
|
125
|
+
keyword_While: 'while',
|
126
|
+
operator_And: '&&',
|
127
|
+
operator_Divide: '/',
|
128
|
+
operator_Equal: '===',
|
129
|
+
operator_GreatherOrEqualThan: '>=',
|
130
|
+
operator_GreatherThan: '>',
|
131
|
+
operator_LessOrEqualThan: '<=',
|
132
|
+
operator_LessThan: '<',
|
133
|
+
operator_Minus: '-',
|
134
|
+
operator_Multiply: '*',
|
135
|
+
operator_Negation: '!',
|
136
|
+
operator_NotEqual: '!==',
|
137
|
+
operator_Or: '||',
|
138
|
+
operator_Plus: '+',
|
139
|
+
operator_Modulo: '%',
|
140
|
+
operator_BitwiseOr: '|',
|
141
|
+
operator_BitwiseAnd: '&',
|
142
|
+
operator_BitwiseXor: '^',
|
143
|
+
operator_BitwiseLeftShift: '<<',
|
144
|
+
operator_BitwiseRightShift: '>>',
|
145
|
+
operator_Size: 'length',
|
146
|
+
operator_Similar: '==',
|
147
|
+
operator_NotSimilar: '!=',
|
148
|
+
operator_Push: 'push'
|
149
|
+
},
|
150
|
+
Python: {
|
151
|
+
keyword_False: 'False',
|
152
|
+
keyword_Null: 'None',
|
153
|
+
keyword_True: 'True',
|
154
|
+
keyword_For: 'for',
|
155
|
+
keyword_If: 'if',
|
156
|
+
keyword_Return: 'return',
|
157
|
+
keyword_While: 'while',
|
158
|
+
operator_And: 'and',
|
159
|
+
operator_Divide: '/',
|
160
|
+
operator_Equal: '==',
|
161
|
+
operator_GreatherOrEqualThan: '>=',
|
162
|
+
operator_GreatherThan: '>',
|
163
|
+
operator_LessOrEqualThan: '<=',
|
164
|
+
operator_LessThan: '<',
|
165
|
+
operator_Minus: '-',
|
166
|
+
operator_Multiply: '*',
|
167
|
+
operator_Negation: 'not',
|
168
|
+
operator_NotEqual: '!=',
|
169
|
+
operator_Or: 'or',
|
170
|
+
operator_Plus: '+',
|
171
|
+
operator_Modulo: '%',
|
172
|
+
operator_BitwiseOr: '|',
|
173
|
+
operator_BitwiseAnd: '&',
|
174
|
+
operator_BitwiseXor: '^',
|
175
|
+
operator_BitwiseLeftShift: '<<',
|
176
|
+
operator_BitwiseRightShift: '>>',
|
177
|
+
operator_Hash: 'hash'
|
178
|
+
},
|
179
|
+
Ruby: {
|
180
|
+
keyword_False: 'false',
|
181
|
+
keyword_Null: 'null',
|
182
|
+
keyword_True: 'true',
|
183
|
+
keyword_For: 'for',
|
184
|
+
keyword_If: 'if',
|
185
|
+
keyword_Return: 'return',
|
186
|
+
keyword_While: 'while',
|
187
|
+
keyword_Class: 'class',
|
188
|
+
keyword_ForEach: 'for',
|
189
|
+
keyword_Include: 'include',
|
190
|
+
keyword_Switch: 'case',
|
191
|
+
operator_And: '&&',
|
192
|
+
operator_Divide: '/',
|
193
|
+
operator_Equal: '==',
|
194
|
+
operator_GreatherOrEqualThan: '>=',
|
195
|
+
operator_GreatherThan: '>',
|
196
|
+
operator_LessOrEqualThan: '<=',
|
197
|
+
operator_LessThan: '<',
|
198
|
+
operator_Minus: '-',
|
199
|
+
operator_Multiply: '*',
|
200
|
+
operator_Negation: '!',
|
201
|
+
operator_NotEqual: '!=',
|
202
|
+
operator_Or: '||',
|
203
|
+
operator_Plus: '+',
|
204
|
+
operator_Modulo: '%',
|
205
|
+
operator_BitwiseOr: '|',
|
206
|
+
operator_BitwiseAnd: '&',
|
207
|
+
operator_BitwiseXor: '^',
|
208
|
+
operator_BitwiseLeftShift: '<<',
|
209
|
+
operator_BitwiseRightShift: '>>',
|
210
|
+
operator_Hash: 'hash',
|
211
|
+
operator_ForwardComposition: '>>',
|
212
|
+
operator_BackwardComposition: '<<'
|
213
|
+
},
|
214
|
+
Php: {
|
215
|
+
keyword_False: 'false',
|
216
|
+
keyword_Null: 'null',
|
217
|
+
keyword_True: 'true',
|
218
|
+
keyword_For: 'for',
|
219
|
+
keyword_If: 'if',
|
220
|
+
keyword_Return: 'return',
|
221
|
+
keyword_While: 'while',
|
222
|
+
operator_And: '&&',
|
223
|
+
operator_Divide: '/',
|
224
|
+
operator_Equal: '==',
|
225
|
+
operator_GreatherOrEqualThan: '>=',
|
226
|
+
operator_GreatherThan: '>',
|
227
|
+
operator_LessOrEqualThan: '<=',
|
228
|
+
operator_LessThan: '<',
|
229
|
+
operator_Minus: '-',
|
230
|
+
operator_Multiply: '*',
|
231
|
+
operator_Negation: '!',
|
232
|
+
operator_NotEqual: '!=',
|
233
|
+
operator_Or: '||',
|
234
|
+
operator_Plus: '+',
|
235
|
+
operator_Modulo: '%',
|
236
|
+
operator_BitwiseOr: '|',
|
237
|
+
operator_BitwiseAnd: '&',
|
238
|
+
operator_BitwiseXor: '^',
|
239
|
+
operator_BitwiseLeftShift: '<<',
|
240
|
+
operator_BitwiseRightShift: '>>'
|
241
|
+
},
|
242
|
+
Prolog: {
|
243
|
+
keyword_Fail: 'fail',
|
244
|
+
keyword_Findall: 'findall',
|
245
|
+
keyword_Forall: 'forall',
|
246
|
+
keyword_Not: 'not',
|
247
|
+
keyword_Is: 'is',
|
248
|
+
operator_Divide: '/',
|
249
|
+
operator_GreatherOrEqualThan: '>=',
|
250
|
+
operator_GreatherThan: '>',
|
251
|
+
operator_LessOrEqualThan: '=<',
|
252
|
+
operator_LessThan: '<',
|
253
|
+
operator_Minus: '-',
|
254
|
+
operator_Multiply: '*',
|
255
|
+
operator_NotEqual: '/=',
|
256
|
+
operator_Plus: '+'
|
257
|
+
}
|
258
|
+
}.freeze
|
259
|
+
|
260
|
+
POLYFILLS = {
|
261
|
+
Common: {
|
262
|
+
keyword_EntryPoint: 'program',
|
263
|
+
keyword_ForEach: 'foreach',
|
264
|
+
keyword_Repeat: 'repeat',
|
265
|
+
keyword_Switch: 'switch',
|
266
|
+
keyword_Yield: 'yield',
|
267
|
+
operator_Hash: 'hash',
|
268
|
+
operator_BackwardComposition: '.',
|
269
|
+
operator_ForwardComposition: '>>'
|
270
|
+
}
|
271
|
+
}.freeze
|
272
|
+
|
273
|
+
DEFAULT_TOKENS = TOKENS[:Common].merge(POLYFILLS[:Common]).freeze
|
274
|
+
end
|
275
|
+
end
|
data/lib/mulang/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mulang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit-core
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '12.3'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '12.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
83
97
|
description: Gem wrapper for mulang tool
|
84
98
|
email:
|
85
99
|
- franco@mumuki.org
|
@@ -92,6 +106,7 @@ files:
|
|
92
106
|
- bin/setup
|
93
107
|
- lib/locales/en.yml
|
94
108
|
- lib/locales/es.yml
|
109
|
+
- lib/locales/operators.yml
|
95
110
|
- lib/locales/pt.yml
|
96
111
|
- lib/mulang.rb
|
97
112
|
- lib/mulang/code.rb
|
@@ -103,6 +118,8 @@ files:
|
|
103
118
|
- lib/mulang/inspection/matcher.rb
|
104
119
|
- lib/mulang/inspection/target.rb
|
105
120
|
- lib/mulang/language.rb
|
121
|
+
- lib/mulang/sexp.rb
|
122
|
+
- lib/mulang/tokens.rb
|
106
123
|
- lib/mulang/version.rb
|
107
124
|
homepage: https://github.com/mumuki/mulang
|
108
125
|
licenses:
|
@@ -124,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
141
|
- !ruby/object:Gem::Version
|
125
142
|
version: '0'
|
126
143
|
requirements: []
|
127
|
-
|
128
|
-
rubygems_version: 2.7.7
|
144
|
+
rubygems_version: 3.0.3
|
129
145
|
signing_key:
|
130
146
|
specification_version: 4
|
131
147
|
summary: Gem wrapper for mulang tool
|