mulang-ruby 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/console +4 -4
- data/lib/mulang/ruby/ast_processor.rb +40 -0
- data/lib/mulang/ruby/version.rb +1 -1
- data/mulang-ruby.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ea4e6ed3c03b9ae98533a9988de7f1ae322097c9578efcf2670f3103ad6e887
|
4
|
+
data.tar.gz: aa29c8290952938de0411210a29c0d18bb5bc28224d48bfb019bdf87528ebaf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f10f3670c8d259edbbb03621d9a324d747054714c36e223ffb9e84cce2c02fc9477fd5e349a19ecea432cc9d710d991a6a283ca3fe5a17890ccd5dff7a3455ef
|
7
|
+
data.tar.gz: dffada3fe94e6abfbd4612c1dda596b77e967216492cd201b7ccbe34d9c0ec3e4165bd10510fcc32d4618b2805b548f8e154ac96db3722385acb7a31c4d9869d
|
data/bin/console
CHANGED
@@ -7,8 +7,8 @@ require "mulang/ruby"
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
12
|
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
13
|
+
#require "irb"
|
14
|
+
#IRB.start(__FILE__)
|
@@ -189,6 +189,46 @@ module Mulang::Ruby
|
|
189
189
|
ms :Assignment, id, process(value)
|
190
190
|
end
|
191
191
|
|
192
|
+
def on_op_asgn(node)
|
193
|
+
assignee, message, value = *node
|
194
|
+
|
195
|
+
if assignee.type == :send
|
196
|
+
property_assignment assignee, message, value
|
197
|
+
else
|
198
|
+
var_assignment assignee, message, value
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def var_assignment(assignee, message, value)
|
203
|
+
id = assignee.to_a.first
|
204
|
+
ms :Assignment, id, simple_send(ms(:Reference, id), message, [process(value)])
|
205
|
+
end
|
206
|
+
|
207
|
+
def property_assignment(assignee, message, value)
|
208
|
+
receiver, accessor, *accessor_args = *assignee
|
209
|
+
|
210
|
+
reasign accessor, process_all(accessor_args), process(receiver), message, process(value)
|
211
|
+
end
|
212
|
+
|
213
|
+
def reasign(accessor, args, id, message, value)
|
214
|
+
simple_send id,
|
215
|
+
"#{accessor}=".to_sym,
|
216
|
+
args + [simple_send(
|
217
|
+
simple_send(id, accessor, args),
|
218
|
+
message,
|
219
|
+
[value])]
|
220
|
+
end
|
221
|
+
|
222
|
+
def on_or_asgn(node)
|
223
|
+
assignee, value = *node
|
224
|
+
on_op_asgn s :op_asgn, assignee, '||', value
|
225
|
+
end
|
226
|
+
|
227
|
+
def on_and_asgn(node)
|
228
|
+
assignee, value = *node
|
229
|
+
on_op_asgn s :op_asgn, assignee, '&&', value
|
230
|
+
end
|
231
|
+
|
192
232
|
alias on_ivar on_lvar
|
193
233
|
alias on_ivasgn on_lvasgn
|
194
234
|
|
data/lib/mulang/ruby/version.rb
CHANGED
data/mulang-ruby.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.14"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_development_dependency "pry"
|
27
28
|
|
28
29
|
spec.add_dependency "parser"
|
29
30
|
spec.add_dependency "ast"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mulang-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
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:
|
11
|
+
date: 2018-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: parser
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
167
|
version: '0'
|
154
168
|
requirements: []
|
155
169
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.7.
|
170
|
+
rubygems_version: 2.7.4
|
157
171
|
signing_key:
|
158
172
|
specification_version: 4
|
159
173
|
summary: Ruby integration for the Mulang Language Analyzer
|