rouge-lang 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rouge/compiler.rb +4 -0
- data/lib/rouge/repl.rb +3 -1
- data/lib/rouge/version.rb +1 -1
- data/spec/compiler_spec.rb +9 -0
- metadata +4 -4
data/lib/rouge/compiler.rb
CHANGED
@@ -12,6 +12,10 @@ module Rouge::Compiler
|
|
12
12
|
|
13
13
|
def self.compile(ns, lexicals, form)
|
14
14
|
case form
|
15
|
+
when Set
|
16
|
+
Rouge::Seq::Cons[
|
17
|
+
Set.method(:new),
|
18
|
+
form.map {|f| compile(ns, lexicals, f)}]
|
15
19
|
when Rouge::Symbol
|
16
20
|
name = form.name
|
17
21
|
is_new = (name[-1] == ?. and name.length > 1)
|
data/lib/rouge/repl.rb
CHANGED
@@ -19,7 +19,7 @@ module Rouge::REPL
|
|
19
19
|
chaining = false
|
20
20
|
|
21
21
|
while true
|
22
|
-
if
|
22
|
+
if !chaining
|
23
23
|
prompt = "#{context.ns.name}=> "
|
24
24
|
input = Readline.readline(prompt, true)
|
25
25
|
else
|
@@ -34,6 +34,8 @@ module Rouge::REPL
|
|
34
34
|
|
35
35
|
begin
|
36
36
|
form = context.ns.read(input)
|
37
|
+
rescue Rouge::Reader::EOFError
|
38
|
+
next
|
37
39
|
rescue Rouge::Reader::EndOfDataError
|
38
40
|
chaining = true
|
39
41
|
next
|
data/lib/rouge/version.rb
CHANGED
data/spec/compiler_spec.rb
CHANGED
@@ -111,10 +111,19 @@ describe Rouge::Compiler do
|
|
111
111
|
it { expect { compile.("[a]")
|
112
112
|
}.to raise_exception(Rouge::Namespace::VarNotFoundError) }
|
113
113
|
|
114
|
+
it { expect { compile.("\#{a}")
|
115
|
+
}.to raise_exception(Rouge::Namespace::VarNotFoundError) }
|
116
|
+
|
117
|
+
it { expect { compile.("(let [a 1] \#{a})")
|
118
|
+
}.to_not raise_exception }
|
119
|
+
|
114
120
|
context do
|
115
121
|
before { ns.set_here(:a, :a) }
|
116
122
|
it { expect { compile.("[a]")
|
117
123
|
}.to_not raise_exception }
|
124
|
+
|
125
|
+
it { expect { compile.("\#{a}")
|
126
|
+
}.to_not raise_exception }
|
118
127
|
end
|
119
128
|
|
120
129
|
it { expect { compile.("{b c}")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rouge-lang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -188,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
188
|
version: '0'
|
189
189
|
segments:
|
190
190
|
- 0
|
191
|
-
hash:
|
191
|
+
hash: -574578803
|
192
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
193
|
none: false
|
194
194
|
requirements:
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
version: '0'
|
198
198
|
segments:
|
199
199
|
- 0
|
200
|
-
hash:
|
200
|
+
hash: -574578803
|
201
201
|
requirements: []
|
202
202
|
rubyforge_project:
|
203
203
|
rubygems_version: 1.8.24
|