Removed deprecated exports that are no longer implemented.
[clinton/parenscript.git] / src / compilation-interface.lisp
index 3c17258..4817370 100644 (file)
@@ -2,16 +2,27 @@
 
 (defun compile-script (script-form &key (output-stream nil))
   "Compiles the Parenscript form SCRIPT-FORM into Javascript.
-Non-null PRETTY-PRINT values result in a pretty-printed output code.
 If OUTPUT-STREAM is NIL, then the result is a string; otherwise code
 is output to the OUTPUT-STREAM stream."
-  (parenscript-print (compile-parenscript-form script-form) output-stream))
+  (parenscript-print (compile-parenscript-form script-form :expecting :statement) output-stream))
 
 (defmacro ps (&body body)
-  "A macro that returns a Javascript string of the supplied Parenscript forms."
+  "Given Parenscript forms (an implicit progn), expands to code which
+compiles those forms to a JavaScript string."
   `(ps* '(progn ,@body)))
 
 (defun ps* (&rest body)
-  "Return the javascript string representing BODY.
+  "Compiles BODY to a JavaScript string.
 Body is evaluated."
   (compile-script `(progn ,@body)))
+
+(defvar *js-inline-string-delimiter* #\"
+  "Controls the string delimiter char used when compiling Parenscript in ps-inline.")
+
+(defun ps-inline* (form &optional (*js-string-delimiter* *js-inline-string-delimiter*))
+  (concatenate 'string
+               "javascript:"
+               (parenscript-print (compile-parenscript-form form :expecting :statement))))
+
+(defmacro ps-inline (form &optional (string-delimiter '*js-inline-string-delimiter*))
+  `(ps-inline* ',form ,string-delimiter))