Stopped abuse of set-difference implementation-dependent ordering in defsetf.
[clinton/parenscript.git] / src / package.lisp
1 (in-package :cl-user)
2 ;;;; Package definitions for the Parenscript
3 ;; #:
4
5 (eval-when (:compile-toplevel :load-toplevel)
6 ;; exports shared between PARENSCRIPT and PARENSCRIPT.JAVASCRIPT
7 (defparameter *shared-symbols-ps-js*
8 '(
9 ;; literals
10 #:t
11 #:f
12 #:true
13 "NIL"
14 #:this
15 #:false
16 #:undefined
17
18 ;; keywords
19 #:break
20 #:continue
21
22 ;; array literals
23 #:array
24 #:list
25 #:aref
26 #:make-array
27
28 ;; operators
29 #:! #:not #:~
30 #:* #:/ #:%
31 #:+ #:-
32 #:<< #:>>
33 #:>>>
34 #:< #:> #:<= #:>=
35 #:in
36 #:eql #:== #:!= #:=
37 #:=== #:!==
38 #:&
39 #:^
40 #:\|
41 #:\&\& #:and
42 #:\|\| #:or
43 #:>>= #:<<=
44 #:*= #:/= #:%= #:+= #:\&= #:^= #:\|= #:~=
45 #:++ #:--
46 #:1+ #:1-
47 #:incf #:decf
48
49 ;; body forms
50 #:progn
51
52 ;; object literals
53 #:create
54 #:with-slots
55
56 ;; macros
57 #:macrolet
58 #:symbol-macrolet
59
60 ;; if
61 #:if
62 #:when
63 #:unless
64
65 ;; single argument statements
66 #:return
67 #:throw
68
69 ;; single argument expressions
70 #:delete
71 #:void
72 #:typeof
73 #:instanceof
74 #:new
75
76 ;; assignment
77 #:setf
78
79 ;; variables
80 #:defvar
81
82 ;; iteration
83 #:for
84 #:doeach
85 #:while
86
87 ;; with
88 #:with
89
90 ;; case
91 #:switch
92 #:case
93 #:default
94
95 ;; try throw catch
96 #:try
97
98 ;; regex literals
99 #:regex
100
101 ;; conditional compilation (IE)
102 #:cc-if)
103 "Symbols exported from both the Parenscript and Javascript packages
104 that are also valid as Parenscript symbols for the corresponding script packages."))
105
106
107
108 (defpackage parenscript.javascript
109 (:use :common-lisp)
110 (:nicknames javascript ps-js)
111 #.(cons :export *shared-symbols-ps-js*)
112 (:export
113 ;; function definition
114 #:%js-defun
115 #:%js-lambda
116 #:%js-slot-value
117 ;; translate
118 #:js-to-strings
119 #:js-to-statement-strings
120 )
121 (:documentation "The package used to define Javascript special forms. Most of Parenscript
122 is defined as macros on top of Javascript special forms"))
123
124 (eval-when (:compile-toplevel :load-toplevel :execute)
125 (defparameter *parenscript-lang-exports*
126 (append
127 *shared-symbols-ps-js*
128 '(
129 ;; package system
130 #:defpackage
131 #:in-package
132
133 ;; function definition
134 #:defun
135 #:lambda
136
137 ;; lambda lists
138 #:&key
139 #:&rest
140 #:&body
141 #:&optional
142 #:&aux
143 #:&environment
144 #:&key-object
145 #:optional-args
146
147 ;; slot access
148 #:with-slots
149 #:slot-value
150
151 ;; eval-when
152 #:eval-when
153 ;; macros
154 #:macrolet
155 #:symbol-macrolet
156 #:define-symbol-macro
157 #:define-script-symbol-macro
158 #:defmacro
159
160 ;; lisp eval
161 #:lisp
162
163 ;; assignment
164 #:setf
165 #:defaultf
166
167 #:let
168
169 ;; iteration
170 #:do
171 #:dotimes
172 #:dolist
173 #:doeach
174 #:while
175
176 ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v
177
178 ;; CSS
179 #:css
180 #:css-to-string
181 #:css-inline
182 #:css-file
183
184 ;; html generator for javascript
185 #:html
186 ))
187 "List of (uninterned) symbols. Contains all symbols considerred
188 part of the Parenscript language. These should be exported within
189 both the Lisp package and the script package for Parenscript."))
190
191 (defpackage :parenscript
192 (:use :common-lisp :parenscript.javascript)
193 (:nicknames :js :ps)
194 #.(cons :export *shared-symbols-ps-js*)
195 #.(cons :export *parenscript-lang-exports*)
196 (:export
197 ;; compiler
198 #:compile-script
199 #:compile-script-file
200 #:compile-script-system
201 #:compile-parenscript-file
202 #:compile-parenscript-file-to-string
203 #:script
204 #:script*
205 #:ps
206 #:ps*
207 #:js
208 #:js*
209 #:with-new-compilation-environment ; tentative
210 #:with-compilation-environment ; tentative
211 #:*compilation-environment*
212
213 ;; package system
214 #:find-script-package
215 #:script-intern
216 #:script-export
217 #:find-script-symbol
218 #:comp-env-current-package
219 #:symbol-script-package
220 #:script-package-name
221
222 ;; for parenscript macro definition within lisp
223 #:defscriptmacro
224 #:defpsmacro ; should we use one or the other of these?
225 #:defmacro/ps
226 #:defmacro+ps
227 #:import-macros-from-lisp
228
229 ;; gensym
230 #:with-unique-ps-names
231 #:gen-script-name
232 #:gen-script-name-string
233 #:gen-ps-name
234
235 ;; deprecated interface
236 #:gen-js-name
237 #:gen-js-name-string
238 #:with-unique-js-names
239 #:defjsmacro
240 #:js-compile
241 #:js-inline
242 #:js-inline*
243 #:js-file
244 #:js-script
245 #:js-to-statement-strings
246 ))
247
248 (in-package :parenscript)
249 (import
250 '(defscriptclass
251 define-script-special-form
252 defscriptmacro
253 symbol-to-js
254 script-quote
255 *package-prefix-style*
256 *script-macro-env*
257 compile-to-statement
258 compile-to-block
259 compile-to-symbol
260 compile-to-expression
261 symbol-script-package
262 script-package-name
263 list-join
264 list-to-string
265 append-to-last
266 prepend-to-first
267 string-join
268 val-to-string
269 string-split
270 script-special-form-p
271 make-macro-env-dictionary
272 script-equal
273 compile-script-form
274 )
275 :parenscript.javascript)
276
277 (defpackage parenscript.reader
278 (:nicknames parenscript-reader)
279 (:use :common-lisp :parenscript)
280 (:shadow #:readtablep
281 #:readtable-case
282 #:copy-readtable
283 #:get-macro-character
284 #:get-dispatch-macro-character
285 #:set-macro-character
286 #:set-dispatch-macro-character
287 #:make-dispatch-macro-character
288 #:set-syntax-from-char
289 #:read-preserving-whitespace
290 #:read
291 #:read-from-string
292 #:read-delimited-list
293 #:backquote-comma-dot
294 #:backquote
295 #:backquote-comma
296 #:backquote-comma-at
297
298 #:*read-eval*
299 #:*read-base*
300 #:*read-default-float-format*
301 #:*read-suppress*
302 #:*readtable*
303 #:*read-suppress*
304 #:*reader-error*
305 #:*read-suppress*
306
307 #:readtable
308 #:backquote
309 #:reader-error)
310 (:export
311 #:read
312 #:read-from-string
313 #:read-delimited-list)
314 (:documentation "The Parenscript reader. Used for reading Parenscript
315 forms."))
316
317 (defpackage parenscript.global
318 (:nicknames "GLOBAL")
319 (:documentation "Symbols interned in the global package are serialized in Javascript
320 as non-prefixed identifiers."))
321
322 (defpackage parenscript.user
323 (:use :parenscript)
324 (:nicknames ps-user parenscript-user)
325 (:documentation "The default package a user is inside of when compiling code."))
326
327 (defpackage parenscript.asdf
328 (:use :parenscript :asdf :common-lisp)
329 (:documentation "ASDF extensions that help compile and use Parenscript systems."))
330
331 (defpackage parenscript.non-prefixed (:nicknames ps.non-prefixed))
332 (defpackage parenscript.ps-gensyms)