Fixed (?) quoting mechanism
authorAttila Lendvai <attila.lendvai@gmail.com>
Mon, 16 Apr 2007 13:11:33 +0000 (13:11 +0000)
committerAttila Lendvai <attila.lendvai@gmail.com>
Mon, 16 Apr 2007 13:11:33 +0000 (13:11 +0000)
(js:js (+ 42 '"FoooFFFOFOFooo")) => "42 + FoooFFFOFOFooo;"

IOW, quote inside a parenscript form means to simply print the quoted
value as-is.  Among other things, this is useful for inserting literal
javascript into parenscript.  I hope it will not break anything.

src/js.lisp

index a8489c4..be0a54b 100644 (file)
@@ -486,6 +486,11 @@ vice-versa.")
   (declare (ignore start-form))
   (list (symbol-to-js (value v))))
 
+;;; quote
+
+(defjsclass js-quote (expression)
+  ())
+
 ;;; arithmetic operators
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
@@ -1408,7 +1413,7 @@ vice-versa.")
               (make-instance 'js-variable :value form))))
        ((and (consp form)
              (eql (first form) 'quote))
-        (second form))
+        (make-instance 'js-quote :value (second form)))
        ((consp form)
         (js-compile-list form))
        (t (error "Unknown atomar expression ~S" form))))