nydp 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,7 +49,11 @@ class Nydp::Symbol
49
49
  other.is_a?(Nydp::Symbol) && (self.name == other.name)
50
50
  end
51
51
 
52
- def assign value, context=nil
52
+ def execute vm
53
+ vm.push_arg self.value
54
+ end
55
+
56
+ def assign value, _=nil
53
57
  @value = value
54
58
  end
55
59
  end
@@ -4,41 +4,19 @@ module Nydp
4
4
  class SymbolLookup
5
5
  extend Helper
6
6
 
7
- attr_reader :expression
8
-
9
- def initialize expression
10
- @expression = expression
11
- end
12
-
13
- def execute vm
14
- vm.push_arg expression.value vm.current_context
15
- end
16
-
17
- def assign value, context=nil
18
- @expression.assign value, context
19
- end
20
-
21
7
  def self.build name, bindings
22
8
  depth = 0
23
9
  while Nydp::NIL.isnt? bindings
24
10
  here = bindings.car
25
11
  if here.key? name
26
12
  binding_index = here[name]
27
- return new ContextSymbol.new(depth, name, binding_index)
13
+ return ContextSymbol.build(depth, name, binding_index)
28
14
  else
29
15
  depth += 1
30
16
  bindings = bindings.cdr
31
17
  end
32
18
  end
33
- new name
34
- end
35
-
36
- def to_s
37
- "#lookup:#{expression}:"
38
- end
39
-
40
- def inspect
41
- "#lookup_symbol:#{@expression.inspect}"
19
+ name
42
20
  end
43
21
  end
44
22
  end
@@ -1,3 +1,3 @@
1
1
  module Nydp
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nydp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conan Dalton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-05 00:00:00.000000000 Z
11
+ date: 2016-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -124,6 +124,7 @@ files:
124
124
  - lib/lisp/tests/group-by-examples.nydp
125
125
  - lib/lisp/tests/hash-examples.nydp
126
126
  - lib/lisp/tests/include-examples.nydp
127
+ - lib/lisp/tests/intersperse-examples.nydp
127
128
  - lib/lisp/tests/invocation-tests.nydp
128
129
  - lib/lisp/tests/isa-examples.nydp
129
130
  - lib/lisp/tests/len-examples.nydp