mulang-ruby 1.0.0 → 1.1.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
- SHA1:
3
- metadata.gz: e7fe6b5d76688d1c0b24e65ff3a8ab6917ba2559
4
- data.tar.gz: 810c8beadea0e4bfb37ccfd1d3d7791cf899397a
2
+ SHA256:
3
+ metadata.gz: 7b7e1b03608d32ac99ba99a84ecb6c00a6db128491f7705616a5783cf1bffc22
4
+ data.tar.gz: c91a2299b7cdf95dcb2f834041dc5e39a0fcb229cbc044b05eeb5ad758573be0
5
5
  SHA512:
6
- metadata.gz: bd615f842c21206138c8de5206edf8f5b1afb55012846b7eadaf4f5ff6e0ee2f2d186034cfc4ee3e0f14f06b2bbdac0ec6fbe97348043600fe23916ad4dcdf94
7
- data.tar.gz: 6e79690be2c543c49807fff3575fae6b34a67ebe5a4f9b3d116e8d91231a1983e2a4340f37165a5b7865ab98e2c1d139b45d8ddf120498713ff39738e79efa7f
6
+ metadata.gz: a00c85cfcdcda31efcc10474c4b5f29e6390131470c7ae2ea7ee841f8cd0ab23b817dc02e40aa26dfc2bc3e821d2395b785db5469e781a2fce0b77f363c13c6e
7
+ data.tar.gz: df34437984268e50839c197585716353b7d52cbc9a0577fc433a432e8156f65691a204e96e8b85366f693f82d49d02c95ff3c9fb1b655fd1380fc2675c91655a
data/.travis.yml CHANGED
@@ -8,10 +8,6 @@ before_install:
8
8
  - export PATH=$HOME/.local/bin:$PATH
9
9
  # Install bundler
10
10
  - gem install bundler -v 1.14.6
11
- # Install mulang
12
- - wget https://github.com/mumuki/mulang/releases/download/v3.1.1/mulang
13
- - mv mulang ~/.local/bin/mulang
14
- - chmod +x ~/.local/bin/mulang
15
11
  deploy:
16
12
  provider: rubygems
17
13
  api_key:
data/lib/mulang/ruby.rb CHANGED
@@ -9,6 +9,10 @@ module Mulang
9
9
  def self.parse(ruby_code)
10
10
  Mulang::Ruby::AstProcessor.new.process Mulang::Ruby::SexpParser.parser(ruby_code)
11
11
  end
12
+
13
+ def self.language
14
+ Mumukit::Language::External.new { |it| parse(it) }
15
+ end
12
16
  end
13
17
  end
14
18
 
@@ -23,13 +23,42 @@ module Mulang::Ruby
23
23
  end
24
24
 
25
25
  def on_begin(node)
26
- {tag: :Sequence, contents: process_all(node)}
26
+ sequence(*process_all(node))
27
27
  end
28
28
 
29
29
  def on_irange(node)
30
30
  ms :Other
31
31
  end
32
32
 
33
+ def on_regexp(node)
34
+ value, _ops = *node
35
+
36
+ simple_send ms(:Reference, :Regexp), :new, [process(value)]
37
+ end
38
+
39
+ def on_dstr(node)
40
+ parts = *node
41
+
42
+ simple_send ms(:MuList, process_all(parts)), :join, []
43
+ end
44
+
45
+ def on_or(node)
46
+ value, other = *node
47
+ simple_send process(value), '||', [process(other)]
48
+ end
49
+
50
+ def on_and(node)
51
+ value, other = *node
52
+
53
+ simple_send process(value), '&&', [process(other)]
54
+ end
55
+
56
+ def on_return(node)
57
+ value = *node
58
+
59
+ ms(:Return, process(value.first))
60
+ end
61
+
33
62
  def on_defs(node)
34
63
  _target, id, args, body = *node
35
64
  body ||= s(:nil)
@@ -75,6 +104,11 @@ module Mulang::Ruby
75
104
  ms :MuString, value
76
105
  end
77
106
 
107
+ def on_sym(node)
108
+ value, _ = *node
109
+ ms :MuSymbol, value.to_s
110
+ end
111
+
78
112
  def on_float(node)
79
113
  value, _ = *node
80
114
  ms :MuNumber, value
@@ -100,6 +134,9 @@ module Mulang::Ruby
100
134
  ms :Assignment, id, process(value)
101
135
  end
102
136
 
137
+ alias on_ivar on_lvar
138
+ alias on_ivasgn on_lvasgn
139
+
103
140
  def on_const(node)
104
141
  _ns, value = *node
105
142
  ms :Reference, value
@@ -1,5 +1,15 @@
1
1
  module Mulang::Ruby
2
2
  module Sexp
3
+ def sequence(*contents)
4
+ if contents.empty?
5
+ ms(:MuNull)
6
+ elsif contents.size == 1
7
+ contents[0]
8
+ else
9
+ ms(:Sequence, *contents)
10
+ end
11
+ end
12
+
3
13
  def ms(tag, *contents)
4
14
  if contents.empty?
5
15
  {tag: tag}
@@ -1,5 +1,5 @@
1
1
  module Mulang
2
2
  module Ruby
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
data/mulang-ruby.gemspec CHANGED
@@ -27,5 +27,6 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_dependency "parser"
29
29
  spec.add_dependency "ast"
30
- spec.add_dependency "mumukit-core"
30
+ spec.add_dependency "mumukit-core", "~> 1.0"
31
+ spec.add_dependency "mulang", "~> 3.3"
31
32
  end
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.0.0
4
+ version: 1.1.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: 2017-10-11 00:00:00.000000000 Z
11
+ date: 2017-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,16 +84,30 @@ dependencies:
84
84
  name: mumukit-core
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '1.0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: mulang
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.3'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.3'
97
111
  description: Ruby - Mulang Parser
98
112
  email:
99
113
  - franco@mumuki.org
@@ -139,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
153
  version: '0'
140
154
  requirements: []
141
155
  rubyforge_project:
142
- rubygems_version: 2.6.14
156
+ rubygems_version: 2.7.2
143
157
  signing_key:
144
158
  specification_version: 4
145
159
  summary: Ruby integration for the Mulang Language Analyzer