Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

using Syms for parse tree; sad

  • Loading branch information...
commit 18dad5cb5645a5b0583b5ef86a846c88372c8f5d 1 parent 16b33a5
Phil Hagelberg technomancy authored
5 lib/bus_scheme.rb
@@ -24,8 +24,9 @@ module BusScheme
24 24
25 25 # symbol special form predicate
26 26 def self.special_form?(form)
27   - form.is_a? Symbol or form.is_a? Node and
28   - SPECIAL_FORMS.has_key?(form)
  27 + form.is_a?(Sym) and
  28 + # TODO: hacky; has_key? has different equality semantics from ==
  29 + SPECIAL_FORMS.keys.any?{ |k| k == form }
29 30 end
30 31
31 32 # Read-Eval-Print-Loop
6 lib/eval.rb
@@ -10,8 +10,10 @@ def eval(form)
10 10 # puts "evaling #{form.inspect}"
11 11 if (form.is_a?(Cons) or form.is_a?(Array)) and form.first
12 12 apply(form.first, form.rest)
13   - elsif form.is_a? Symbol or form.is_a? Node
14   - raise EvalError.new("Undefined symbol: #{form}") unless Lambda.scope.has_key?(form)
  13 + # TODO: should we still allow symbols?
  14 + elsif form.is_a? Sym or form.is_a? Symbol
  15 + form = form.sym if form.is_a? Symbol
  16 + raise EvalError.new("Undefined symbol: #{form.inspect}") unless Lambda.in_scope?(form)
15 17 Lambda[form]
16 18 else # well it must be a literal then
17 19 form
14 lib/hash_extensions.rb
... ... @@ -1,17 +1,3 @@
1 1 class Hash
2 2 alias_method :call, :[]
3   - alias_method :old_lookup, :[]
4   - alias_method :old_has_key, :has_key?
5   -
6   - def has_key?(key)
7   - old_has_key(key) or old_has_key(key.to_sym) or old_has_key(key.node)
8   - end
9   -
10   - def [](key)
11   - if old_has_key(key)
12   - old_lookup(key)
13   - else
14   - old_lookup(key.to_sym)
15   - end
16   - end
17 3 end
14 lib/lambda.rb
@@ -43,7 +43,7 @@ def initialize(formals, body)
43 43
44 44 # execute Lambda with given arg_values
45 45 def call(*args)
46   - locals = if @formals.is_a? Symbol # rest args
  46 + locals = if @formals.is_a? Sym # rest args
47 47 { @formals => args.to_list }
48 48 else # regular arg list
49 49 raise BusScheme::ArgumentError if @formals.length != args.length
@@ -52,7 +52,7 @@ def call(*args)
52 52
53 53 @scope = RecursiveHash.new(locals, @enclosing_scope)
54 54 @@stack << self
55   - BusScheme.eval(@body.unshift(:begin)).affect { @@stack.pop }
  55 + BusScheme.eval(@body.unshift(:begin.sym)).affect { @@stack.pop }
56 56 end
57 57
58 58 # What's the current scope?
@@ -60,19 +60,21 @@ def self.scope
60 60 @@stack.empty? ? SYMBOL_TABLE : @@stack.last.scope
61 61 end
62 62
  63 + # is the symbol in scope?
  64 + def self.in_scope?(symbol)
  65 + self.scope.has_key?(symbol) or SYMBOL_TABLE.has_key?(symbol)
  66 + end
  67 +
63 68 # shorthand for lookup in the currently relevant scope
64 69 def self.[](symbol)
65 70 return self.scope[symbol] if self.scope.has_key?(symbol)
66   - return self.scope[symbol.to_sym] if self.scope.has_key?(symbol.to_sym)
67   - return self.scope[symbol.node] if self.scope.has_key?(symbol.node)
68 71 end
69 72
70 73 # shorthand for assignment in the currently relevant scope
71 74 def self.[]=(symbol, val)
72   - puts "#{symbol.inspect} = #{val.inspect}"
73 75 val.file = symbol.file if val.respond_to?(:file)
74 76 val.line = symbol.line if val.respond_to?(:line)
75   - self.scope[symbol.node] = val
  77 + self.scope[symbol] = val
76 78 end
77 79 end
78 80 end
16 lib/object_extensions.rb
@@ -12,14 +12,14 @@ def sexp
12 12 end
13 13
14 14 class String
15   - def node
16   - Node.new(self)
  15 + def sym
  16 + Sym.new(self)
17 17 end
18 18 end
19 19
20 20 class Symbol
21   - def node
22   - Node.new(self.to_s)
  21 + def sym
  22 + Sym.new(self.to_s)
23 23 end
24 24
25 25 def file
@@ -47,12 +47,12 @@ def line
47 47 end
48 48 end
49 49
50   -class Node < String
  50 +class Sym < String
51 51 attr_accessor :file, :line
52 52
53   - def eql?(other)
54   - self.intern.eql?(other)
55   - end
  53 +# def eql?(other)
  54 +# self.intern.eql?(other)
  55 +# end
56 56
57 57 def inspect
58 58 ";#{self}"
8 lib/parser.rb
@@ -57,10 +57,10 @@ def pop_token(input)
57 57 Regexp.last_match[1].intern
58 58 when /\A#\(/ # vector
59 59 input[0 ... 2] = ''
60   - return [:'(', :vector, tokenize(input)]
  60 + return [:'(', :vector.sym, tokenize(input)]
61 61 when /\A'/ # single-quote
62 62 input[0 ... 1] = ''
63   - return [:'(', :quote,
  63 + return [:'(', :quote.sym,
64 64 if input[0 ... 1] == '('
65 65 tokenize(input)
66 66 else
@@ -75,9 +75,7 @@ def pop_token(input)
75 75 Regexp.last_match[2]
76 76 when /\A(#{IDENTIFIER_BEGIN}+#{IDENTIFIER_CHARS}*)/ # symbol
77 77 # puts "#{Regexp.last_match[1]} - #{@@lines}"
78   - # bugger--this is *not* going to work. every reference to the symbol
79   - # resets the defined_in properties. ick! i don't want a ParseNode class!
80   - Regexp.last_match[1].node.affect{ |sym| sym.file, sym.line = [BusScheme.loaded_files.last, @@lines] }
  78 + Regexp.last_match[1].sym.affect{ |sym| sym.file, sym.line = [BusScheme.loaded_files.last, @@lines] }
81 79 end
82 80
83 81 # Remove the matched part from the string
52 lib/primitives.rb
@@ -9,42 +9,42 @@ class AssertionFailed < BusSchemeError; end
9 9 # right now I believe there are as few things implemented primitively as possible
10 10 # except for functions that require splat args. do we need something like &rest?
11 11
12   - '#t'.intern => true, # :'#t' screws up emacs' ruby parser
13   - '#f'.intern => false,
  12 + '#t'.sym => true, # :'#t' screws up emacs' ruby parser
  13 + '#f'.sym => false,
14 14
15   - :+ => lambda { |*args| args.inject { |sum, i| sum + i } },
16   - :- => lambda { |x, y| x - y },
17   - :* => lambda { |*args| args.inject { |product, i| product * i } },
18   - '/'.intern => lambda { |x, y| x / y },
  15 + :+.sym => lambda { |*args| args.inject { |sum, i| sum + i } },
  16 + :-.sym => lambda { |x, y| x - y },
  17 + :*.sym => lambda { |*args| args.inject { |product, i| product * i } },
  18 + '/'.sym => lambda { |x, y| x / y },
19 19
20   - :concat => lambda { |*args| args.join('') },
21   - :cons => lambda { |car, cdr| Cons.new(car, cdr) },
22   - :list => lambda { |*members| members.to_list },
23   - :vector => lambda { |*members| members },
  20 + :concat.sym => lambda { |*args| args.join('') },
  21 + :cons.sym => lambda { |car, cdr| Cons.new(car, cdr) },
  22 + :list.sym => lambda { |*members| members.to_list },
  23 + :vector.sym => lambda { |*members| members },
24 24
25   - :ruby => lambda { |*code| Kernel.eval code.join('') },
26   - :eval => lambda { |code| eval(code) },
27   - :send => lambda { |obj, *message| obj.send(*message) },
28   - :assert => lambda { |cond| raise AssertionFailed unless cond },
29   - :load => lambda { |filename| BusScheme.load filename },
30   - :exit => lambda { exit }, :quit => lambda { exit },
  25 + :ruby.sym => lambda { |*code| Kernel.eval code.join('') },
  26 + :eval.sym => lambda { |code| eval(code) },
  27 + :send.sym => lambda { |obj, *message| obj.send(*message) },
  28 + :assert.sym => lambda { |cond| raise AssertionFailed unless cond },
  29 + :load.sym => lambda { |filename| BusScheme.load filename },
  30 + :exit.sym => lambda { exit }, :quit.sym => lambda { exit },
31 31 }
32 32
33 33 # if we add in macros, can some of these be defined in scheme?
34 34 SPECIAL_FORMS = {
35 35 # TODO: hacky to coerce everything to sexps... won't work once we start using vectors
36   - :quote => lambda { |arg| arg.sexp },
37   - :if => lambda { |q, yes, *no| eval(q) ? eval(yes) : eval([:begin] + no) },
38   - :begin => lambda { |*args| args.map{ |arg| eval(arg) }.last },
39   - :set! => lambda { |sym, value| raise EvalError.new unless Lambda.scope.has_key?(sym) or Lambda.scope.has_key?(sym.intern) and
  36 + :quote.sym => lambda { |arg| arg.sexp },
  37 + :if.sym => lambda { |q, yes, *no| eval(q) ? eval(yes) : eval([:begin] + no) },
  38 + :begin.sym => lambda { |*args| args.map{ |arg| eval(arg) }.last },
  39 + :set!.sym => lambda { |sym, value| raise EvalError.new unless Lambda.in_scope?(sym)
40 40 Lambda[sym] = eval(value); sym },
41   - :lambda => lambda { |args, *form| Lambda.new(args, form) },
42   - :define => lambda { |sym, definition| Lambda[sym] = eval(definition); sym },
  41 + :lambda.sym => lambda { |args, *form| Lambda.new(args, form) },
  42 + :define.sym => lambda { |sym, definition| Lambda[sym] = eval(definition); sym },
43 43
44 44 # once we have macros, this can be defined in scheme
45   - :and => lambda { |*args| args.all? { |x| eval(x) } },
46   - :or => lambda { |*args| args.any? { |x| eval(x) } },
47   - :let => lambda { |defs, *body| Lambda.new(defs.map{ |d| d.car }, body).call(*defs.map{ |d| eval d.last }) },
48   - :hash => lambda { |*args| args.to_hash }, # accepts an alist
  45 + :and.sym => lambda { |*args| args.all? { |x| eval(x) } },
  46 + :or.sym => lambda { |*args| args.any? { |x| eval(x) } },
  47 + :let.sym => lambda { |defs, *body| Lambda.new(defs.map{ |d| d.car }, body).call(*defs.map{ |d| eval d.last }) },
  48 + :hash.sym => lambda { |*args| args.to_hash }, # accepts an alist
49 49 }
50 50 end
2  lib/scheme/core.scm
... ... @@ -1,4 +1,4 @@
1   -(define intern
  1 +(define string->symbol
2 2 (lambda (sym) (send sym 'intern)))
3 3
4 4 (define substring
14 test/test_core.rb
@@ -14,18 +14,18 @@ def test_comparison
14 14 end
15 15
16 16 def test_string_functions
17   - assert_evals_to :hi, [:intern, 'hi']
18   - assert_evals_to 'lo', [:substring, 'hello', 3, 5]
  17 + assert_evals_to :hi, ['string->symbol'.sym, 'hi']
  18 + assert_evals_to 'lo', [:substring.sym, 'hello', 3, 5]
19 19 end
20 20
21 21 def test_list_functions
22   - assert_evals_to :foo, "(car (cons (quote foo) (quote bar)))"
23   - assert_evals_to :bar, "(cdr (cons (quote foo) (quote bar)))"
24   - assert_equal(Cons.new(:foo, Cons.new(:bar, nil)),
25   - [:foo, :bar].to_list)
  22 + assert_evals_to :foo.sym, "(car (cons (quote foo) (quote bar)))"
  23 + assert_evals_to :bar.sym, "(cdr (cons (quote foo) (quote bar)))"
  24 + assert_equal(Cons.new(:foo.sym, Cons.new(:bar.sym, nil)),
  25 + [:foo.sym, :bar.sym].to_list)
26 26 assert_evals_to(Cons.new(2, Cons.new(3, nil)),
27 27 "(list 2 3)")
28 28 assert_evals_to "bar", "(cadr (list \"foo\" \"bar\"))"
29   - assert_evals_to [1, :foo].to_list, "(list 1 'foo)"
  29 + assert_evals_to [1, :foo.sym].to_list, "(list 1 'foo)"
30 30 end
31 31 end
19 test/test_eval.rb
@@ -17,8 +17,8 @@ def test_set_symbol
17 17 end
18 18
19 19 def test_eval_symbol
20   - Lambda.scope[:hi] = 13
21   - assert_evals_to 13, :hi
  20 + Lambda.scope[:hi.sym] = 13
  21 + assert_evals_to 13, :hi.sym
22 22 end
23 23
24 24 def test_eval_string
@@ -39,18 +39,19 @@ def test_blows_up_with_undefined_symbol
39 39
40 40 def test_variable_substitution
41 41 eval "(define foo 7)"
42   - assert_evals_to 7, :foo.node
43   - assert_evals_to 21, [:*, 3, :foo.node]
  42 + assert_evals_to 7, :foo.sym
  43 + assert_evals_to 21, [:*.sym, 3, :foo.sym]
44 44 end
45 45
46 46 def test_single_quote
47   - assert_evals_to :foo.node, "'foo"
48   - assert_evals_to [:foo.node, :biz.node, :bbb.node].to_list, "'(foo biz bbb)"
  47 + assert BusScheme.special_form?(:quote.sym)
  48 + assert_evals_to :foo.sym, "'foo"
  49 + assert_evals_to [:foo.sym, :biz.sym, :bbb.sym].to_list, "'(foo biz bbb)"
49 50 end
50 51
51 52 def test_array_of_args_or_list_of_args
52   - assert_evals_to 5, cons(:+, cons(2, cons(3)))
53   - assert_evals_to 5, cons(:+, cons(2, cons(3)).to_a)
  53 + assert_evals_to 5, cons(:+.sym, cons(2, cons(3)))
  54 + assert_evals_to 5, cons(:+.sym, cons(2, cons(3)).to_a)
54 55 end
55 56
56 57 def test_eval_multiple_forms
@@ -62,7 +63,7 @@ def test_eval_multiple_forms
62 63 def test_define_after_load
63 64 BusScheme.eval_string "(load \"#{File.dirname(__FILE__)}/../examples/fib.scm\")
64 65 (define greeting \"hi\")"
65   - assert Lambda[:greeting]
  66 + assert Lambda.in_scope?(:greeting.sym)
66 67 end
67 68
68 69 def test_funcall_list_means_nth
24 test/test_lambda.rb
@@ -9,12 +9,12 @@ class BusSchemeLambdaTest < Test::Unit::TestCase
9 9 def test_simple_lambda
10 10 l = eval("(lambda () (+ 1 1))")
11 11 assert l.is_a?(Lambda)
12   - assert_equal [[:+, 1, 1]], l.body
  12 + assert_equal [[:+.sym, 1, 1]], l.body
13 13 assert_equal [], l.formals
14 14
15 15 eval("(define foo (lambda () (+ 1 1)))")
16   - assert Lambda[:foo].is_a?(Lambda)
17   - assert_evals_to 2, [:foo]
  16 + assert Lambda[:foo.sym].is_a?(Lambda)
  17 + assert_evals_to 2, [:foo.sym]
18 18 end
19 19
20 20 def test_lambda_with_arg
@@ -57,11 +57,11 @@ def test_changes_to_enclosed_variables_are_in_effect_after_lambda_execution
57 57 end
58 58
59 59 def test_implicit_begin
60   - assert_evals_to 3, "((lambda () (intern \"hi\") (+ 2 2) (* 1 3)))"
  60 + assert_evals_to 3, "((lambda () (string->symbol \"hi\") (+ 2 2) (* 1 3)))"
61 61 end
62 62
63 63 def test_shadowed_vars_dont_stay_in_scope
64   - assert_evals_to Cons.new(:a, :b), "(let ((f (let ((x (quote a)))
  64 + assert_evals_to Cons.new(:a.sym, :b.sym), "(let ((f (let ((x (quote a)))
65 65 (lambda (y) (cons x y)))))
66 66 (let ((x (quote not-a)))
67 67 (f (quote b))))"
@@ -69,18 +69,18 @@ def test_shadowed_vars_dont_stay_in_scope
69 69
70 70 def test_lambda_rest_args
71 71 eval "(define rest (lambda args args))"
72   - assert_evals_to [:a, :b, :c].to_list, "(rest 'a 'b 'c)"
  72 + assert_evals_to [:a.sym, :b.sym, :c.sym].to_list, "(rest 'a 'b 'c)"
73 73 end
74 74
75 75 def test_lambdas_know_what_file_they_were_defined_in
76   - assert_equal "(primitive)", Lambda[:if].file
  76 + assert_equal "(primitive)", Lambda[:if.sym].file
77 77
78 78 eval "(define fab (lambda () \"warble\"))"
79   - assert_equal "(eval)", Lambda[:fab.node].file
  79 + assert_equal "(eval)", Lambda[:fab.sym].file
80 80
81 81 filename = File.expand_path("#{File.dirname(__FILE__)}/../examples/fib.scm")
82 82 eval "(load \"#{filename}\")"
83   - assert_equal filename, Lambda[:fib.node].file
  83 + assert_equal filename, Lambda[:fib.sym].file
84 84 end
85 85
86 86 # def test_lambdas_know_what_line_they_were_defined_in
@@ -88,10 +88,10 @@ def test_lambdas_know_what_file_they_were_defined_in
88 88
89 89 # filename = File.expand_path("#{File.dirname(__FILE__)}/../examples/fib.scm")
90 90 # eval "(load \"#{filename}\")"
91   -# assert Lambda.scope[:fib.node].is_a?(Lambda)
92   -# assert_equal 1, Lambda.scope[:fib.node].line
  91 +# assert Lambda.scope[:fib.sym].is_a?(Lambda)
  92 +# assert_equal 1, Lambda.scope[:fib.sym].line
93 93
94 94 # eval "#{"\n" * 7} (define fab 'warble)"
95   -# assert_equal 7, Lambda[:fab.node].line
  95 +# assert_equal 7, Lambda[:fab.sym].line
96 96 # end
97 97 end
48 test/test_parser.rb
@@ -6,7 +6,7 @@ def test_pop_token
6 6 string = "(+ 2 2)"
7 7 assert_equal :'(', BusScheme.pop_token(string)
8 8
9   - assert_equal :'+'.node, BusScheme.pop_token(string)
  9 + assert_equal :'+'.sym, BusScheme.pop_token(string)
10 10 assert_equal 2, BusScheme.pop_token(string)
11 11 assert_equal 2, BusScheme.pop_token(string)
12 12 assert_equal :")", BusScheme.pop_token(string)
@@ -17,9 +17,9 @@ def test_pop_token
17 17 end
18 18
19 19 def test_tokenize
20   - assert_equal [:'(', :'+'.node, 2, 2, :')'], BusScheme.tokenize("(+ 2 2)")
21   - assert_equal [:'(', :'+'.node, 2, :'(', :'+'.node, 22, 2, :')', :')'], BusScheme.tokenize("(+ 2 (+ 22 2))")
22   - assert_equal [:'(', :plus.node, 2, 2, :')'], BusScheme.tokenize('(plus 2 2)')
  20 + assert_equal [:'(', :'+'.sym, 2, 2, :')'], BusScheme.tokenize("(+ 2 2)")
  21 + assert_equal [:'(', :'+'.sym, 2, :'(', :'+'.sym, 22, 2, :')', :')'], BusScheme.tokenize("(+ 2 (+ 22 2))")
  22 + assert_equal [:'(', :plus.sym, 2, 2, :')'], BusScheme.tokenize('(plus 2 2)')
23 23 end
24 24
25 25 def test_parse_numbers
@@ -31,7 +31,7 @@ def test_parses_strings
31 31 end
32 32
33 33 def test_parses_two_strings
34   - assert_parses_to "(concat \"hello\" \"world\")", [:concat.node, "hello", "world"]
  34 + assert_parses_to "(concat \"hello\" \"world\")", [:concat.sym, "hello", "world"]
35 35 end
36 36
37 37 def test_parse_list_of_numbers
@@ -39,27 +39,27 @@ def test_parse_list_of_numbers
39 39 end
40 40
41 41 def test_parse_list_of_atoms
42   - assert_parses_to "(+ 2 2)", [:+.node, 2, 2]
  42 + assert_parses_to "(+ 2 2)", [:+.sym, 2, 2]
43 43 end
44 44
45 45 def test_parse_list_of_atoms_with_string
46   - assert_parses_to "(+ 2 \"two\")", [:+.node, 2, "two"]
  46 + assert_parses_to "(+ 2 \"two\")", [:+.sym, 2, "two"]
47 47 end
48 48
49 49 def test_parse_list_of_nested_sexprs
50   - assert_parses_to "(+ 2 (+ 2))", [:+.node, 2, [:+.node, 2]]
  50 + assert_parses_to "(+ 2 (+ 2))", [:+.sym, 2, [:+.sym, 2]]
51 51 end
52 52
53 53 def test_parse_list_of_deeply_nested_sexprs
54   - assert_parses_to "(+ 2 (+ 2 (+ 2 2)))", [:+.node, 2, [:+.node, 2, [:+.node, 2, 2]]]
  54 + assert_parses_to "(+ 2 (+ 2 (+ 2 2)))", [:+.sym, 2, [:+.sym, 2, [:+.sym, 2, 2]]]
55 55 end
56 56
57 57 def test_parse_two_consecutive_parens_simple
58   - assert_parses_to "(let ((foo 2)))", [:let.node, [[:foo.node, 2]]]
  58 + assert_parses_to "(let ((foo 2)))", [:let.sym, [[:foo.sym, 2]]]
59 59 end
60 60
61 61 def test_parse_two_consecutive_parens
62   - assert_parses_to "(let ((foo 2)) (+ foo 2))", [:let.node, [[:foo.node, 2]], [:+.node, :foo.node, 2]]
  62 + assert_parses_to "(let ((foo 2)) (+ foo 2))", [:let.sym, [[:foo.sym, 2]], [:+.sym, :foo.sym, 2]]
63 63 end
64 64
65 65 def test_whitespace_indifferent
@@ -70,9 +70,9 @@ def test_whitespace_indifferent
70 70 end
71 71
72 72 def test_parses_vectors
73   - assert_equal [:'(', :vector, 1, 2, :')'], BusScheme::tokenize("#(1 2)").flatten
74   - assert_parses_to "#(1 2)", [:vector, 1, 2]
75   - assert_parses_to "#(1 (2 3 4))", [:vector, 1, [2, 3, 4]]
  73 + assert_equal [:'(', :vector.sym, 1, 2, :')'], BusScheme::tokenize("#(1 2)").flatten
  74 + assert_parses_to "#(1 2)", [:vector.sym, 1, 2]
  75 + assert_parses_to "#(1 (2 3 4))", [:vector.sym, 1, [2, 3, 4]]
76 76 end
77 77
78 78 # def test_parses_dotted_cons
@@ -105,10 +105,10 @@ def test_negative_floats
105 105 # end
106 106
107 107 def test_quote
108   - assert_parses_to "'foo", [:quote, :foo.node]
109   - assert_equal [:'(', :quote, :'(', :foo.node, :bar.node, :baz.node, :')', :')'], BusScheme::tokenize("'(foo bar baz)").flatten
110   - assert_parses_to "'(foo bar baz)", [:quote, [:foo.node, :bar.node, :baz.node]]
111   - assert_parses_to "'(+ 20 3)", [:quote, [:+.node, 20, 3]]
  108 + assert_parses_to "'foo", [:quote.sym, :foo.sym]
  109 + assert_equal [:'(', :quote.sym, :'(', :foo.sym, :bar.sym, :baz.sym, :')', :')'], BusScheme::tokenize("'(foo bar baz)").flatten
  110 + assert_parses_to "'(foo bar baz)", [:quote.sym, [:foo.sym, :bar.sym, :baz.sym]]
  111 + assert_parses_to "'(+ 20 3)", [:quote.sym, [:+.sym, 20, 3]]
112 112 end
113 113
114 114 # have to change normalize_whitespace to not turn newlines into spaces for this to work
@@ -116,7 +116,7 @@ def test_ignore_comments
116 116 assert_parses_to ";; hello", nil
117 117 assert_parses_to "12 ;; comment", 12
118 118 assert_parses_to "(+ 2;; this is a mid-sexp comment
119   -2)", [:+.node, 2, 2]
  119 +2)", [:+.sym, 2, 2]
120 120 end
121 121
122 122 def test_requires_closed_lists
@@ -145,11 +145,11 @@ def test_parse_random_elisp_form_from_my_dot_emacs
145 145 (if (file-exists-p system-specific-config)
146 146 (load system-specific-config)))"
147 147 assert_parses_to(lisp,
148   - [:let.node, [[:'system-specific-config'.node,
149   - [:concat.node, "~/.emacs.d/",
150   - [:'shell-command-to-string'.node, "hostname"]]]],
151   - [:if.node, [:'file-exists-p'.node, :'system-specific-config'.node],
152   - [:load.node, :'system-specific-config'.node]]])
  148 + [:let.sym, [[:'system-specific-config'.sym,
  149 + [:concat.sym, "~/.emacs.d/",
  150 + [:'shell-command-to-string'.sym, "hostname"]]]],
  151 + [:if.sym, [:'file-exists-p'.sym, :'system-specific-config'.sym],
  152 + [:load.sym, :'system-specific-config'.sym]]])
153 153 end
154 154
155 155 def test_parser_saves_file_info
1  test/test_primitives.rb
@@ -37,6 +37,7 @@ def test_message_passing
37 37
38 38 def test_load_file
39 39 eval "(load \"#{File.dirname(__FILE__)}/../examples/fib.scm\")"
  40 + assert Lambda.scope.has_key?(:fib.node)
40 41 assert_evals_to 5, "(fib 5)"
41 42 end
42 43

0 comments on commit 18dad5c

Please sign in to comment.
Something went wrong with that request. Please try again.