halunke 0.5.2 → 0.5.3

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
  SHA1:
3
- metadata.gz: 150c5430c572082097018606197faec2c0de858e
4
- data.tar.gz: 8255a00970c4e932d7e37d47ceefa7ab0a454b2e
3
+ metadata.gz: e392834f93d1e8a31556b550cd9a85f8746fbb1c
4
+ data.tar.gz: e9d9a8aed17f7c861bfc987df05d72a5e5dcd4b6
5
5
  SHA512:
6
- metadata.gz: e151c639862bfde2a262edd5854aff16e092562679210ca7bd9fe309b8e58d328676f6a97b78ded6ade6688ecaf448aebcbfbe9d533a9f5691f4aab710ef8eee
7
- data.tar.gz: bc6b0cd941a258c18dc75b4a6ffb2c16f6ac3eb66ac7296eabb759d009fbb265d0ca02e3fcbb27082f379462b591241d415aa9eadd72dab7f0e7357ae7cb4085
6
+ metadata.gz: b29f8e9324a0d33a245fd8ce6ee2b7c47d0ee0550bcc86cdd4f22610c596dd112aaf80f4f37b64bd8bf376faf5aaa657afec10c6a7cf89b4415369dcc7af4ced
7
+ data.tar.gz: 6ca3d129843dd9d774160f57fa4807677c2c3e84e08669fddc37bd749e99c60240b8ec68aa394071dafadd9e52e17546680e51b8f3c00a7f51d66ecd6530508d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- halunke (0.5.2)
4
+ halunke (0.5.3)
5
5
  rack (~> 2.0.4)
6
6
 
7
7
  GEM
@@ -13,7 +13,7 @@ if ARGV.length == 0
13
13
  while (line = Readline.readline(">> ", true))
14
14
  begin
15
15
  value = interpreter.eval(line)
16
- puts "=> #{value}"
16
+ puts "=> #{value}" if value
17
17
  rescue Exception => e
18
18
  puts "An Error Occurred: #{e.message}"
19
19
  end
@@ -28,7 +28,8 @@ module Halunke
28
28
 
29
29
  def eval(str)
30
30
  nodes = @parser.parse(str)
31
- nodes.eval(root_context).inspect(root_context)
31
+ result = nodes.eval(root_context)
32
+ result.nil? ? nil : result.inspect(root_context)
32
33
  end
33
34
 
34
35
  def preludes
@@ -4,6 +4,10 @@ module Halunke
4
4
  nodes.map { |node| node.eval(context) }.last
5
5
  end
6
6
 
7
+ def empty?
8
+ nodes.empty?
9
+ end
10
+
7
11
  def to_message
8
12
  MessageNode.new(nodes)
9
13
  end
@@ -43,6 +47,7 @@ module Halunke
43
47
 
44
48
  FunctionNode = Struct.new(:params, :body) do
45
49
  def eval(context)
50
+ raise "This function would not return anything. That's forbidden." if body.empty?
46
51
  signature = params.nodes.map(&:node).map(&:value)
47
52
 
48
53
  context["Function"].new(signature, lambda { |call_context|
@@ -1,3 +1,3 @@
1
1
  module Halunke
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: halunke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Dohmen