turmali 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/tml +17 -9
- data/lib/turmali/runtime/class.rb +10 -3
- data/lib/turmali/runtime/object.rb +1 -0
- data/lib/turmali/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eb7aee973033aa6925875937fdca4a3f21e2902
|
4
|
+
data.tar.gz: aad52d9f7be8d0ddadd844e2ce76ada0d4101ce1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58d829d8755dbe10338c329b3279792b2171c062617d7b4d0b0ba61f76116eabe1663aa8d62371a24e4df581b0bf1cfbb46a09af85ed0fc00c8abdc15dbc799d
|
7
|
+
data.tar.gz: c38c4b0fc63a18e38df086a312c0eecba03785527ce04d5fa3445becf933dcc548638c2b8492c013ff1da45f971c574aefdbec4708120ee4782de8e321424c32
|
data/bin/tml
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
require "bundler/setup"
|
4
4
|
require "turmali"
|
5
5
|
require "readline"
|
6
|
+
require "racc/parser"
|
7
|
+
|
8
|
+
stty_save = %x`stty -g`.chomp
|
9
|
+
trap("INT") { system "stty", stty_save; exit }
|
6
10
|
|
7
11
|
interpreter = Interpreter.new
|
8
12
|
|
@@ -10,12 +14,16 @@ if file = ARGV.first
|
|
10
14
|
interpreter.eval File.read(file)
|
11
15
|
else
|
12
16
|
puts "Turmali (#{Turmali::VERSION}) REPL, Type 'quit' or 'exit' to exit"
|
13
|
-
|
14
|
-
line = Readline::readline(">> ")
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
begin
|
18
|
+
while line = Readline::readline("tml >> ")
|
19
|
+
exit if line == 'quit'
|
20
|
+
exit if line == 'exit'
|
21
|
+
Readline::HISTORY.push(line)
|
22
|
+
value = interpreter.eval(line)
|
23
|
+
puts "=> #{value.ruby_value.inspect}"
|
24
|
+
end
|
25
|
+
rescue Racc::ParseError => e
|
26
|
+
puts e.inspect
|
27
|
+
retry
|
28
|
+
end
|
29
|
+
end
|
@@ -5,14 +5,20 @@ class TurmaliClass < TurmaliObject
|
|
5
5
|
|
6
6
|
attr_reader :runtime_methods
|
7
7
|
|
8
|
-
def initialize
|
8
|
+
def initialize(superclass=Constants["Class"])
|
9
9
|
@runtime_methods = {}
|
10
|
-
@runtime_class =
|
10
|
+
@runtime_class = superclass
|
11
11
|
end
|
12
12
|
|
13
13
|
def lookup(method_name)
|
14
14
|
method = @runtime_methods[method_name]
|
15
|
-
|
15
|
+
unless method
|
16
|
+
puts "superclass #{@runtime_superclass}"
|
17
|
+
if @runtime_superclass
|
18
|
+
return @runtime_superclass.lookup(method_name)
|
19
|
+
else
|
20
|
+
raise "Method not found: #{method_name}"
|
21
|
+
end end
|
16
22
|
method
|
17
23
|
end
|
18
24
|
|
@@ -27,4 +33,5 @@ class TurmaliClass < TurmaliObject
|
|
27
33
|
def new_with_value(value)
|
28
34
|
TurmaliObject.new(self, value)
|
29
35
|
end
|
36
|
+
|
30
37
|
end
|
data/lib/turmali/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turmali
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eiffel Qiu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|