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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91f051c87797239230bd7e561316a7038a84a3be2af363978456546a9bb015d5
4
- data.tar.gz: 87f978d2895c52e130095932e0812bb38676cc9d5b2e475c0f111d4ebc20e85b
3
+ metadata.gz: beb92a73844dc910e25060e880ee2f4c7b65f99feaea4b7cf9afdeb6f5fe8b59
4
+ data.tar.gz: 9d7e6cee290d77b29485b8757d3c1b1c6baee08dc09ca0060a717dfca83f5b40
5
5
  SHA512:
6
- metadata.gz: fd0af43454321d2feb44c0791f8b180225c688916ef2e65fbb209dae4fc736fb26a0c1a0c5432c9c0bb8306f89d9ab6a424a191e0a6fa96d518547b8dd437f34
7
- data.tar.gz: 8034320d399b43fa2bfb9845f20f90415f4335b7cce1be440dace3808d10325289197c060e35ab0783b22b232c31f274ceb8a227b56bda1188e5603a0419cb17
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
- mu_method :EqualMethod, process_all(args), process(body)
123
+ mu_primitive_method :Equal, process_all(args), process(body)
124
124
  when :hash
125
- mu_method :HashMethod, process_all(args), process(body)
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, simple_send(ms(:Reference, id), message, [process(value)])
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 + [simple_send(
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
- if message == :==
278
- message = {tag: :Equal}
279
- elsif message == :!=
280
- message = {tag: :NotEqual}
281
- else
282
- message = {tag: :Reference, contents: message}
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
@@ -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 mu_method(tag, args, body)
35
+ def mu_primitive_method(type, args, body)
36
36
  {
37
- tag: 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, {tag: :Reference, contents: message}, args)
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
@@ -1,5 +1,5 @@
1
1
  module Mulang
2
2
  module Ruby
3
- VERSION = "4.1.0"
3
+ VERSION = "5.0.0"
4
4
  end
5
5
  end
@@ -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", "~> 1.14"
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", ">= 4.0", '< 6'
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.1.0
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-26 00:00:00.000000000 Z
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: '1.14'
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: '1.14'
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: '0'
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: '0'
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: '0'
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: '0'
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: '6'
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: '6'
130
+ version: '5.0'
131
131
  description: Ruby - Mulang Parser
132
132
  email:
133
133
  - franco@mumuki.org