Permalink
Browse files

Fix(?) some dequoting behaviour.

  • Loading branch information...
Arlen Christian Mart Cuss
Arlen Christian Mart Cuss committed Dec 3, 2012
1 parent 191794b commit a046d71c1f8a07b3cff294a644fec32c4738bbae
Showing with 10 additions and 4 deletions.
  1. +3 −3 lib/rouge/reader.rb
  2. +7 −1 spec/reader_spec.rb
View
@@ -164,7 +164,7 @@ def quotation
def syntaxquotation
consume
@gensyms.unshift(@@gensym_counter += 1)
- r = dequote lex
+ r = dequote(lex)
@gensyms.shift
r
end
@@ -181,7 +181,7 @@ def dequotation
def dequote form
case form
- when Rouge::Seq::Cons, Array
+ when Rouge::Seq::ISeq, Array
rest = []
group = []
form.each do |f|
@@ -233,7 +233,7 @@ def dequote form
begin
var = @ns[form.name]
Rouge::Seq::Cons[Rouge::Symbol[:quote],
- Rouge::Symbol[var.name]]
+ Rouge::Symbol[:"#{var.ns}/#{var.name}"]]
rescue Rouge::Namespace::VarNotFoundError
Rouge::Seq::Cons[Rouge::Symbol[:quote],
Rouge::Symbol[:"#{@ns.name}/#{form.name}"]]
View
@@ -289,12 +289,18 @@
context "dequoting within cons lists" do
it { @ns.read('`(a ~b)').should eq @ns.read("(list 'user.spec/a b)") }
+
it { @ns.read('`(a ~(b `(c ~d)))').
should eq @ns.read("(list 'user.spec/a (b " \
"(list 'user.spec/c d)))") }
+
+ # Should the below include 'rouge.builtin/quote as it does?
+ # Or should that be 'quote? Clojure reads it so.
it { @ns.read('`(a `(b ~c))').
should eq @ns.read("(list 'user.spec/a (list 'user.spec/list " \
- "(list 'quote 'user.spec/b) 'user.spec/c))") }
+ "(list 'rouge.builtin/quote 'user.spec/b) " \
+ "'user.spec/c))") }
+
it { @ns.read('`~`(x)').should eq @ns.read("(list 'user.spec/x)") }
end

0 comments on commit a046d71

Please sign in to comment.