Restored special-form getting and setting by symbol-na.
[clinton/parenscript.git] / src / package.lisp
CommitLineData
8e198a08 1(in-package :cl-user)
171bbab3
RD
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
bbea4c83 13 "NIL"
171bbab3
RD
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
171bbab3
RD
52 ;; object literals
53 #:create
171bbab3
RD
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
104that are also valid as Parenscript symbols for the corresponding script packages."))
105
106
8e198a08 107
5aa10005 108(defpackage parenscript.javascript
83cb67fd 109 (:use :common-lisp)
5aa10005 110 (:nicknames javascript ps-js)
171bbab3 111 #.(cons :export *shared-symbols-ps-js*)
5aa10005 112 (:export
46f794a4
RD
113 ;; function definition
114 #:%js-defun
115 #:%js-lambda
bbea4c83 116 #:%js-slot-value
5aa10005
RD
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
122is defined as macros on top of Javascript special forms"))
123
171bbab3
RD
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
46f794a4
RD
133 ;; function definition
134 #:defun
135 #:lambda
136
46f794a4
RD
137 ;; lambda lists
138 #:&key
139 #:&rest
140 #:&body
141 #:&optional
142 #:&aux
143 #:&environment
bbea4c83
RD
144 #:&key-object
145 #:options
46f794a4 146
bbea4c83
RD
147 ;; slot access
148 #:with-slots
149 #:slot-value
46f794a4 150
171bbab3
RD
151 ;; eval-when
152 #:eval-when
153 ;; macros
154 #:macrolet
155 #:symbol-macrolet
46f794a4
RD
156 #:define-symbol-macro
157 #:define-script-symbol-macro
158 #:defmacro
171bbab3
RD
159
160 ;; lisp eval
161 #:lisp
162
163 ;; assignment
164 #:setf
46f794a4
RD
165 #:defaultf
166
171bbab3
RD
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
171bbab3
RD
184 ;; html generator for javascript
185 #:html
186 ))
187 "List of (uninterned) symbols. Contains all symbols considerred
188part of the Parenscript language. These should be exported within
189both the Lisp package and the script package for Parenscript."))
190
5aa10005
RD
191(defpackage :parenscript
192 (:use :common-lisp :parenscript.javascript)
9da682ca 193 (:nicknames :js :ps)
171bbab3
RD
194 #.(cons :export *shared-symbols-ps-js*)
195 #.(cons :export *parenscript-lang-exports*)
8e198a08 196 (:export
8e198a08 197 ;; compiler
9da682ca 198 #:compile-script
171bbab3 199 #:compile-script-file
3199f8b6 200 #:compile-script-system
5aa10005
RD
201 #:compile-parenscript-file
202 #:compile-parenscript-file-to-string
9da682ca 203 #:script
7590646c
VS
204 #:script*
205 #:ps
206 #:ps*
b5be3f57
VS
207 #:js
208 #:js*
9da682ca
RD
209 #:with-new-compilation-environment ; tentative
210 #:with-compilation-environment ; tentative
5aa10005
RD
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
9da682ca
RD
221
222 ;; for parenscript macro definition within lisp
171bbab3
RD
223 #:defscriptmacro
224 #:defpsmacro ; should we use one or the other of these?
a19d2bde
VS
225 #:defmacro/ps
226 #:defmacro+ps
ca493d55 227 #:import-macros-from-lisp
0b7a1d2f 228
7590646c
VS
229 ;; gensym
230 #:with-unique-ps-names
231 #:gen-script-name
232 #:gen-script-name-string
233 #:gen-ps-name
551080b7 234
9da682ca 235 ;; deprecated interface
7590646c
VS
236 #:gen-js-name
237 #:gen-js-name-string
238 #:with-unique-js-names
9da682ca
RD
239 #:defjsmacro
240 #:js-compile
9da682ca
RD
241 #:js-inline
242 #:js-inline*
243 #:js-file
244 #:js-script
9da682ca 245 #:js-to-statement-strings
171bbab3 246 ))
5aa10005
RD
247
248(in-package :parenscript)
5aa10005
RD
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
7590646c 272 script-equal
5aa10005
RD
273 compile-script-form
274 )
275 :parenscript.javascript)
276
277(defpackage parenscript.reader
278 (:nicknames parenscript-reader)
279 (:use :common-lisp :parenscript)
171bbab3
RD
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
5aa10005 297
171bbab3
RD
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*
5aa10005 306
171bbab3
RD
307 #:readtable
308 #:backquote
309 #:reader-error)
5aa10005 310 (:export
171bbab3
RD
311 #:read
312 #:read-from-string
313 #:read-delimited-list)
314 (:documentation "The Parenscript reader. Used for reading Parenscript
315forms."))
5aa10005
RD
316
317(defpackage parenscript.global
171bbab3 318 (:nicknames "GLOBAL")
5aa10005
RD
319 (:documentation "Symbols interned in the global package are serialized in Javascript
320as non-prefixed identifiers."))
321
322(defpackage parenscript.user
171bbab3 323 (:use :parenscript)
a9fce0a7
RD
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)
905f534e
VS
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)