Commit 45c9f9c2 authored by Travis Cross's avatar Travis Cross
Browse files

Some minor comment and whitespace cleanup.

parent b508414b
......@@ -52,7 +52,7 @@ function foobar(a, b) {
((>= i 10))
(alert (+ "i is " i " and j is " j))))
; compiles to
;; compiles to
"
for (var i = 0, j = arr[i]; i < 10; i = ++i, j = arr[i]) {
alert('i is ' + i + ' and j is ' + j);
......@@ -74,7 +74,7 @@ for (var i = 0, j = arr[i]; i < 10; i = ++i, j = arr[i]) {
(create :foo "foo"
:bla "bla"))
; compiles to
;; compiles to
"
{ foo : 'foo',
bla : 'bla' }
......@@ -92,7 +92,7 @@ for (var i = 0, j = arr[i]; i < 10; i = ++i, j = arr[i]) {
"The link is: "
((:a :href href) link-text))))))
; compiles to
;; compiles to
"
function addDiv(name, href, linkText) {
document.write('<div id=\"' + name + '\">The link is: <a href=\"'
......@@ -117,7 +117,7 @@ function addDiv(name, href, linkText) {
(div.bl0rg :font-family "serif")
(("a:active" "a:hoover") :color "black" :size "200%"))))))
; which produces
;; which produces
<html><head><style type="text/css">
<!--
......
......@@ -177,7 +177,7 @@ whether any expansion was performed on the form or not."
(if (consp form)
(let ((op (car form))
(args (cdr form)))
(cond ((equal op 'quote) (values (if (equalp '(nil) args) nil form) ;; leave quotes alone, unless it's a quoted nil
(cond ((equal op 'quote) (values (if (equalp '(nil) args) nil form) ; leave quotes alone, unless it's a quoted nil
nil))
((script-macro-p op) (values (ps-macroexpand (funcall (lookup-macro-expansion-function op) form)) t))
(t (values form nil))))
......
......@@ -10,12 +10,12 @@
(defmacro defun-js (old-name new-name args &body body)
`(defun ,old-name ,args
,(when (and (stringp (car body)) (< 1 (length body))) ;; docstring
,(when (and (stringp (car body)) (< 1 (length body))) ; docstring
(car body))
(warn-deprecated ',old-name ',new-name)
,@body))
;;; DEPRECATED INTERFACE ;;;
;;; DEPRECATED INTERFACE
(defun js-equal (ps-form1 ps-form2)
(warn-deprecated 'js-equal)
......
(in-package :parenscript)
(defun process-html-forms (forms) ;; this needs a rewrite
(defun process-html-forms (forms) ; this needs a rewrite
(let ((res ()))
(labels ((handle-form (form)
(cond ((keywordp form)
......
......@@ -7,7 +7,7 @@
#:t
#:f
#:true
#.(symbol-name 'nil) ;; for case-sensitive Lisps like some versions of Allegro
#.(symbol-name 'nil) ; for case-sensitive Lisps like some versions of Allegro
#:this
#:false
#:undefined
......
......@@ -45,8 +45,8 @@
(let ((macros ())
(binds ()))
(dolist (spec collections)
; (unless (proper-list-of-length-p spec 1 3)
; (error "malformed collection specifier: ~S" spec))
;;(unless (proper-list-of-length-p spec 1 3)
;; (error "malformed collection specifier: ~S" spec))
(let* ((name (first spec))
(default (second spec))
(kind (or (third spec) 'collect))
......@@ -182,13 +182,11 @@
;;; even if they could conceivably be legal in not-quite-a-lambda-list
;;; weirdosities
(defun parse-lambda-list (lambda-list)
;; Classify parameters without checking their validity individually.
(multiple-value-bind (required optional restp rest keyp keys allowp auxp aux
morep more-context more-count beyond-requireds? key-object)
(parse-lambda-list-like-thing lambda-list)
(declare (ignore beyond-requireds?))
;; Check validity of parameters.
(flet ((need-symbol (x why)
(unless (symbolp x)
......@@ -222,7 +220,6 @@
(t
(format t "&KEY parameter is not a symbol or cons: ~S"
i))))))
;; Voila.
(values required optional restp rest keyp keys allowp auxp aux
morep more-context more-count key-object)))
......@@ -6,7 +6,7 @@
(defmethod parenscript-print (ps-form &optional *ps-output-stream*)
(setf *indent-level* 0)
(flet ((print-ps (form)
(if (and (listp form) (eql 'js-block (car form))) ;; ignore top-level block
(if (and (listp form) (eql 'js-block (car form))) ; ignore top-level block
(loop for (statement . remaining) on (third form) do
(ps-print statement) (psw ";") (when remaining (psw #\Newline)))
(ps-print form))))
......@@ -15,7 +15,7 @@
(with-output-to-string (*ps-output-stream*)
(print-ps ps-form)))))
(defun psw (obj) ;; parenscript-write
(defun psw (obj) ; parenscript-write
(princ obj *ps-output-stream*))
(defgeneric ps-print% (special-form-name special-form-args))
......@@ -33,7 +33,7 @@ arguments, defines a printer for that form using the given body."
(defgeneric ps-print (compiled-form))
(defmethod ps-print ((form null)) ;; don't print top-level nils (ex: result of defining macros, etc.)
(defmethod ps-print ((form null)) ; don't print top-level nils (ex: result of defining macros, etc.)
)
(defmethod ps-print ((compiled-form cons))
......
......@@ -314,8 +314,7 @@ the given lambda-list and body."
(declare (ignore x y))
(when specified? (cons var val))))
keys))))
(body-paren-forms (parse-function-body body)) ;remove documentation
;;
(body-paren-forms (parse-function-body body)) ; remove documentation
(initform-forms
(mapcar #'(lambda (default-pair)
`(defaultf ,(car default-pair) ,(cdr default-pair)))
......
......@@ -103,6 +103,6 @@ SOMEGLOBAL."
(coerce (nreverse res) 'string)))
(t (string-join (mapcar #'symbol-to-js symbols) "")))))
(defun ordered-set-difference (list1 list2 &key (test #'eql)) ;; because the CL set-difference may not preserve order
(defun ordered-set-difference (list1 list2 &key (test #'eql)) ; because the CL set-difference may not preserve order
(reduce (lambda (list el) (remove el list :test test))
(cons list1 list2)))
\ No newline at end of file
(cons list1 list2)))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment