X-Git-Url: http://git.hcoop.net/clinton/parenscript.git/blobdiff_plain/5aa100057fa73a5c3121c81366d2d0062a3d1cfc..6a2ce72d8a5cfa7af9e940969ed3fbf083a87ef7:/src/package.lisp diff --git a/src/package.lisp b/src/package.lisp dissimilarity index 92% index 70b0e7d..80e607e 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -1,380 +1,242 @@ -(in-package :cl-user) - -(defpackage parenscript.javascript - (:use :common-lisp) - (:nicknames javascript ps-js) - (:export - - #:new - ;; literals - #:t - #:nil - #:this - #:false - #:undefined - - ;; keywords - #:break - #:continue - - ;; array literals - #:array - #:list - #:aref - #:make-array - - ;; operators - #:! #:not #:~ - #:* #:/ #:% - #:+ #:- - #:<< #:>> - #:>>> - #:< #:> #:<= #:>= - #:in - #:eql #:== #:!= #:= - #:=== #:!== - #:& - #:^ - #:\| - #:\&\& #:and - #:\|\| #:or - #:>>= #:<<= - #:*= #:/= #:%= #:+= #:\&= #:^= #:\|= #:~= - #:++ #:-- - #:1+ #:1- - #:incf #:decf - - ;; body forms - #:progn - - ;; function definition - #:defun - #:lambda - - ;; object literals - #:create - #:slot-value - #:with-slots - - ;; macros - #:macrolet - #:symbol-macrolet - - ;; if - #:if - #:when - #:unless - - ;; single argument statements - #:return - #:throw - - ;; single argument expressions - #:delete - #:void - #:typeof - #:instanceof - #:new - - ;; assignment - #:setf - - ;; variables - #:defvar - - ;; iteration - #:for - #:doeach - #:while - - ;; with - #:with - - ;; case - #:switch - #:case - #:default - - ;; try throw catch - #:try - - ;; regex literals - #:regex - - ;; conditional compilation (IE) - #:cc-if - - ;; translate - #:js-to-strings - #:js-to-statement-strings - ) - (:documentation "The package used to define Javascript special forms. Most of Parenscript -is defined as macros on top of Javascript special forms")) - -(defpackage :parenscript - (:use :common-lisp :parenscript.javascript) - (:nicknames :js :ps) - (:export - ;; addition js symbols - #:new - - ;; literals - #:t - #:nil - #:this - #:false - #:undefined - - ;; keywords - #:break - #:continue - - ;; array literals - #:array - #:list - #:aref - #:make-array - - ;; operators - #:! #:not #:~ - #:* #:/ #:% - #:+ #:- - #:<< #:>> - #:>>> - #:< #:> #:<= #:>= - #:in - #:eql #:== #:!= #:= - #:=== #:!== - #:& - #:^ - #:\| - #:\&\& #:and - #:\|\| #:or - #:>>= #:<<= - #:*= #:/= #:%= #:+= #:\&= #:^= #:\|= #:~= - #:++ #:-- - #:1+ #:1- - #:incf #:decf - - ;; body forms - #:progn - - ;; function definition - #:defun - #:lambda - - ;; object literals - #:create - #:slot-value - #:with-slots - - ;; macros - #:macrolet - #:symbol-macrolet - - ;; lisp eval - #:lisp - - ;; if - #:if - #:when - #:unless - - ;; single argument statements - #:return - #:throw - - ;; single argument expressions - #:delete - #:void - #:typeof - #:instanceof - #:new - - ;; assignment - #:setf - - ;; variables - #:defvar - #:let - - ;; iteration - #:do - #:dotimes - #:dolist - #:doeach - #:while - - ;; with - #:with - - ;; case - #:switch - #:case - #:default - - ;; try throw catch - #:try - - ;; regex literals - #:regex - - ;; conditional compilation (IE) - #:cc-if - - ;; math library - #:floor - #:random - - ;; html generator for javascript - #:html - - ;; compiler - #:compile-script - #:compile-parenscript-file - #:compile-parenscript-file-to-string - #:script - #:with-new-compilation-environment ; tentative - #:with-compilation-environment ; tentative - #:*compilation-environment* - - ;; package system - #:find-script-package - #:script-intern - #:script-export - #:find-script-symbol - #:comp-env-current-package - #:symbol-script-package - #:script-package-name - - ;; for parenscript macro definition within lisp - #:defscriptmacro #:defpsmacro ; should we use one or the other of these? - #:defmacro/js - #:defmacro+js - #:import-macros-from-lisp - - ;; util - #:with-unique-js-names - #:gen-js-name - #:gen-js-name-string - - ;; CSS - #:css - #:css-to-string - #:css-inline - #:css-file - - ;; deprecated interface - #:defjsmacro - #:js-compile - #:js ; replaced by #:script - #:js* - #:js-inline - #:js-inline* - #:js-file - #:js-script - #:js-to-strings - #:js-to-statement-strings - #:js-to-string - #:js-to-line - ) - (:intern - #:define-script-special-form - #:defscriptclass - #:symbol-to-js - #:script-quote - #:*package-prefix-style* - #:*script-macro-env* - #:compile-to-statement - #:compile-to-block - #:compile-to-symbol - #:compile-to-expression - #:list-join - #:list-to-string - #:append-to-last - #:prepend-to-first - #:string-join - #:val-to-string - #:string-split - #:script-special-form-p - #:make-macro-env-dictionary - #:compile-script-form - ) - ) - -(in-package :parenscript) - -(import - '(defscriptclass - define-script-special-form - defscriptmacro - symbol-to-js - script-quote - *package-prefix-style* - *script-macro-env* - compile-to-statement - compile-to-block - compile-to-symbol - compile-to-expression - symbol-script-package - script-package-name - list-join - list-to-string - append-to-last - prepend-to-first - string-join - val-to-string - string-split - script-special-form-p - make-macro-env-dictionary - js-equal - compile-script-form - ) - :parenscript.javascript) - -(defpackage parenscript.reader - (:nicknames parenscript-reader) - (:use :common-lisp :parenscript) - (:shadow readtablep - readtable-case - copy-readtable - get-macro-character - get-dispatch-macro-character - set-macro-character - set-dispatch-macro-character - make-dispatch-macro-character - set-syntax-from-char - read-preserving-whitespace - read - read-from-string - read-delimited-list - backquote-comma-dot - backquote - backquote-comma - backquote-comma-at - - *read-eval* - *read-base* - *read-default-float-format* - *read-suppress* - *readtable* - *read-suppress* - *reader-error* - *read-suppress* - - readtable - backquote - reader-error) - (:export - read - read-from-string - read-delimited-list)) - -(defpackage parenscript.global - (:nicknames global) - (:documentation "Symbols interned in the global package are serialized in Javascript -as non-prefixed identifiers.")) - -(defpackage parenscript.user - (:nicknames ps-user paren-user parenscript-user) - (:documentation "The default package a user is inside of when compiling code.")) \ No newline at end of file +(in-package :cl-user) + +(eval-when (:compile-toplevel :load-toplevel :execute) + (defparameter *parenscript-lang-exports* + '( + ;; literals + #:t + #:f + #:true + #.(symbol-name 'nil) ;; for case-sensitive Lisps like some versions of Allegro + #:this + #:false + #:undefined + + ;; keywords + #:break + #:continue + + ;; array literals + #:array + #:list + #:aref + #:make-array + + ;; operators + #:! #:not #:~ + #:* #:/ #:% + #:+ #:- + #:<< #:>> + #:>>> + #:< #:> #:<= #:>= + #:in + #:eql #:== #:!= #:= + #:=== #:!== + #:& + #:^ + #:\| + #:\&\& #:and + #:\|\| #:or + #:>>= #:<<= + #:*= #:/= #:%= #:+= #:\&= #:^= #:\|= #:~= + #:1+ #:1- + #:incf #:decf + + ;; body forms + #:progn + + ;; object literals + #:create + #:with-slots + + ;; macros + #:macrolet + #:symbol-macrolet + + ;; if + #:if + #:when + #:unless + + ;; single argument statements + #:return + #:throw + + ;; single argument expressions + #:delete + #:void + #:typeof + #:instanceof + #:new + + ;; assignment and binding + #:setf + #:defsetf + #:psetf + #:setq + #:psetq + #:simple-let* + #:simple-let + #:let* + #:lexical-let* + #:lexical-let + + ;; variables + #:var + #:defvar + + ;; iteration + #:labeled-for + #:for + #:for-in + #:doeach + #:while + + ;; with + #:with + + ;; case + #:switch + #:case + #:default + + ;; try throw catch + #:try + + ;; regex literals + #:regex + + ;; conditional compilation (IE) + #:cc-if + + ;; function definition + #:defun + #:lambda + + ;; lambda lists + #:&key + #:&rest + #:&body + #:&optional + #:&aux + #:&environment + #:&key-object + + ;; slot access + #:with-slots + #:slot-value + + ;; macros + #:macrolet + #:symbol-macrolet + #:define-symbol-macro + #:define-script-symbol-macro + #:defmacro + + ;; lisp eval + #:lisp + + ;; iteration + #:do + #:do* + #:dotimes + #:dolist + #:doeach + #:while + + ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v + + ;; html generator for javascript + #:ps-html + + ;; utils + #:do-set-timeout + #:min + #:max + #:ceiling + #:abs + #:sin + #:cos + #:tan + #:acos + #:asin + #:atan + #:exp + #:floor + #:expt + #:round + #:random + #:oddp + #:evenp + #:ignore-errors + #:concatenate + #:length + #:null + #:@ + + ;; js runtime utils + #:*ps-lisp-library* + #:mapcar + #:map-into + #:map + #:map-until + #:member + #:append + #:set-difference + )) + "All symbols considered part of the Parenscript language.") + +(defpackage :parenscript + (:use :common-lisp) + (:nicknames :js :ps) + #.(cons :export *parenscript-lang-exports*) + + ;;; symbols that form the interface to the Parenscript compiler + (:export + ;; compiler + #:compile-script + #:ps + #:ps* + #:ps-inline + #:ps-inline* + + ;; for parenscript macro definition within lisp + #:defpsmacro + #:defmacro/ps + #:defmacro+ps + #:import-macros-from-lisp + + ;; gensym + #:ps-gensym + #:with-ps-gensyms + #:*ps-gensym-counter* + + ;; naming and namespaces + #:ps-package-prefix + #:obfuscate-package + #:unobfuscate-package + + ;; printer + #:*js-string-delimiter* + #:*js-inline-string-delimiter* + #:*ps-print-pretty* + #:*indent-num-spaces* + + ;; deprecated interface + #:gen-js-name + #:gen-js-name-string + #:with-unique-js-names + #:defjsmacro + #:js-compile + #:js-inline + #:js-inline* + #:js-file + #:js-script + #:js-to-statement-strings + #:js + #:js* + #:let + )) + +(defpackage :parenscript-special-forms + (:use))