mulang-ruby 4.1.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mulang/ruby/ast_processor.rb +25 -13
- data/lib/mulang/ruby/sexp.rb +9 -4
- data/lib/mulang/ruby/version.rb +1 -1
- data/mulang-ruby.gemspec +4 -4
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beb92a73844dc910e25060e880ee2f4c7b65f99feaea4b7cf9afdeb6f5fe8b59
|
4
|
+
data.tar.gz: 9d7e6cee290d77b29485b8757d3c1b1c6baee08dc09ca0060a717dfca83f5b40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37317ff94e92ca730cb14523cb0d5fd4499ec0a70cd4f89af8a66050f4662fbb300c41d0ef439cb216f5e0dd01d8a1a5fbf0a8b9cf5769a16c5bdd76d6631bf6
|
7
|
+
data.tar.gz: fd5a5dd350e847cbb6aa916ba2ecafe8627091ed858039383cd3c15036d3617f5131ab6b6dfee4e5c5e40506a35896cc32e19522ac6b6be3aeab480a3db7e68c
|
@@ -120,9 +120,9 @@ module Mulang::Ruby
|
|
120
120
|
|
121
121
|
case id
|
122
122
|
when :equal?, :eql?, :==
|
123
|
-
|
123
|
+
mu_primitive_method :Equal, process_all(args), process(body)
|
124
124
|
when :hash
|
125
|
-
|
125
|
+
mu_primitive_method :Hash, process_all(args), process(body)
|
126
126
|
else
|
127
127
|
simple_method id, process_all(args), process(body)
|
128
128
|
end
|
@@ -217,7 +217,7 @@ module Mulang::Ruby
|
|
217
217
|
|
218
218
|
def var_assignment(assignee, message, value)
|
219
219
|
id = assignee.to_a.first
|
220
|
-
ms :Assignment, id,
|
220
|
+
ms :Assignment, id, ms(:Send, ms(:Reference, id), message_reference(message), [process(value)])
|
221
221
|
end
|
222
222
|
|
223
223
|
def property_assignment(assignee, message, value)
|
@@ -229,9 +229,9 @@ module Mulang::Ruby
|
|
229
229
|
def reasign(accessor, args, id, message, value)
|
230
230
|
simple_send id,
|
231
231
|
"#{accessor}=".to_sym,
|
232
|
-
args + [
|
232
|
+
args + [ms(:Send,
|
233
233
|
simple_send(id, accessor, args),
|
234
|
-
message,
|
234
|
+
message_reference(message),
|
235
235
|
[value])]
|
236
236
|
end
|
237
237
|
|
@@ -274,15 +274,27 @@ module Mulang::Ruby
|
|
274
274
|
receptor, message, *args = *node
|
275
275
|
receptor ||= s(:self)
|
276
276
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
277
|
+
ms :Send, process(receptor), message_reference(message), (process_all(args) + extra_args)
|
278
|
+
end
|
279
|
+
|
280
|
+
def message_reference(message)
|
281
|
+
case message
|
282
|
+
when :== then ms :Primitive, :Equal
|
283
|
+
when :!= then ms :Primitive, :NotEqual
|
284
|
+
when :! then ms :Primitive, :Negation
|
285
|
+
when :'&&' then ms :Primitive, :And
|
286
|
+
when :'||' then ms :Primitive, :Or
|
287
|
+
when :hash then ms :Primitive, :Hash
|
288
|
+
when :>= then ms :Primitive, :GreatherOrEqualThan
|
289
|
+
when :> then ms :Primitive, :GreatherThan
|
290
|
+
when :<= then ms :Primitive, :LessOrEqualThan
|
291
|
+
when :< then ms :Primitive, :LessThan
|
292
|
+
when :+ then ms :Primitive, :Plus
|
293
|
+
when :- then ms :Primitive, :Minus
|
294
|
+
when :* then ms :Primitive, :Multiply
|
295
|
+
when :/ then ms :Primitive, :Divide
|
296
|
+
else ms :Reference, message
|
283
297
|
end
|
284
|
-
|
285
|
-
ms :Send, process(receptor), message, (process_all(args) + extra_args)
|
286
298
|
end
|
287
299
|
|
288
300
|
end
|
data/lib/mulang/ruby/sexp.rb
CHANGED
@@ -24,7 +24,7 @@ module Mulang::Ruby
|
|
24
24
|
{
|
25
25
|
tag: :Method,
|
26
26
|
contents: [
|
27
|
-
name,
|
27
|
+
name,
|
28
28
|
[
|
29
29
|
[ args, {tag: :UnguardedBody, contents: body }]
|
30
30
|
]
|
@@ -32,17 +32,22 @@ module Mulang::Ruby
|
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def mu_primitive_method(type, args, body)
|
36
36
|
{
|
37
|
-
tag:
|
37
|
+
tag: :PrimitiveMethod,
|
38
38
|
contents: [
|
39
|
+
type,
|
39
40
|
[ args, {tag: :UnguardedBody, contents: body }]
|
40
41
|
]
|
41
42
|
}
|
42
43
|
end
|
43
44
|
|
44
45
|
def simple_send(sender, message, args)
|
45
|
-
ms(:Send, sender,
|
46
|
+
ms(:Send, sender, ms(:Reference, message), args)
|
47
|
+
end
|
48
|
+
|
49
|
+
def primitive_send(sender, op, args)
|
50
|
+
ms(:Send, sender, ms(:Primitive, op), args)
|
46
51
|
end
|
47
52
|
end
|
48
53
|
end
|
data/lib/mulang/ruby/version.rb
CHANGED
data/mulang-ruby.gemspec
CHANGED
@@ -21,13 +21,13 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler",
|
24
|
+
spec.add_development_dependency "bundler", '>= 1.1', '< 3'
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
27
|
spec.add_development_dependency "pry"
|
28
28
|
|
29
|
-
spec.add_dependency "parser"
|
30
|
-
spec.add_dependency "ast"
|
29
|
+
spec.add_dependency "parser", "~> 2.6"
|
30
|
+
spec.add_dependency "ast", "~> 2.4"
|
31
31
|
spec.add_dependency "mumukit-core", "~> 1.0"
|
32
|
-
spec.add_dependency "mulang", "
|
32
|
+
spec.add_dependency "mulang", "~> 5.0"
|
33
33
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mulang-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '3'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.1'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,30 +76,30 @@ dependencies:
|
|
70
76
|
name: parser
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
|
-
- - "
|
79
|
+
- - "~>"
|
74
80
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
81
|
+
version: '2.6'
|
76
82
|
type: :runtime
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
|
-
- - "
|
86
|
+
- - "~>"
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
88
|
+
version: '2.6'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
90
|
name: ast
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
|
-
- - "
|
93
|
+
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
95
|
+
version: '2.4'
|
90
96
|
type: :runtime
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
|
-
- - "
|
100
|
+
- - "~>"
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
102
|
+
version: '2.4'
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: mumukit-core
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,22 +118,16 @@ dependencies:
|
|
112
118
|
name: mulang
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
114
120
|
requirements:
|
115
|
-
- - "
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '4.0'
|
118
|
-
- - "<"
|
121
|
+
- - "~>"
|
119
122
|
- !ruby/object:Gem::Version
|
120
|
-
version: '
|
123
|
+
version: '5.0'
|
121
124
|
type: :runtime
|
122
125
|
prerelease: false
|
123
126
|
version_requirements: !ruby/object:Gem::Requirement
|
124
127
|
requirements:
|
125
|
-
- - "
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version: '4.0'
|
128
|
-
- - "<"
|
128
|
+
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
130
|
+
version: '5.0'
|
131
131
|
description: Ruby - Mulang Parser
|
132
132
|
email:
|
133
133
|
- franco@mumuki.org
|