Substantially modified the way Parenscript compilation and
[clinton/parenscript.git] / src / package.lisp
1 (in-package "CL-USER")
2
3 (eval-when (:compile-toplevel :load-toplevel :execute)
4 (defparameter *parenscript-lang-exports*
5 '(;; literals
6 #:t
7 #:f
8 #:true
9 #.(symbol-name 'nil) ; for case-sensitive Lisps like some versions of Allegro
10 #:this
11 #:false
12 #:undefined
13 #:{}
14
15 ;; keywords
16 #:break
17 #:continue
18
19 ;; array literals
20 #:array
21 #:list
22 #:aref
23 #:elt
24 #:make-array
25 #:[]
26
27 ;; operators
28 #:! #:not #:~
29 #:* #:/ #:%
30 #:+ #:-
31 #:<< #:>>
32 #:>>>
33 #:< #:> #:<= #:>=
34 #:in
35 #:eql #:== #:!= #:=
36 #:=== #:!==
37 #:&
38 #:^
39 #:\|
40 #:\&\& #:and
41 #:\|\| #:or
42 #:>>= #:<<=
43 #:*= #:/= #:%= #:+= #:\&= #:^= #:\|= #:~=
44 #:incf #:decf
45
46 ;; compile-time stuff
47 #:eval-when
48
49 ;; body forms
50 #:progn
51
52 ;; object literals
53 #:create
54 #:with-slots
55
56 ;; if
57 #:if
58 #:when
59 #:unless
60
61 ;; single argument statements
62 #:return
63 #:throw
64
65 ;; single argument expressions
66 #:delete
67 #:void
68 #:typeof
69 #:instanceof
70 #:new
71
72 ;; assignment and binding
73 #:setf
74 #:defsetf
75 #:psetf
76 #:setq
77 #:psetq
78 #:let*
79 #:let
80
81 ;; variables
82 #:var
83 #:defvar
84
85 ;; iteration
86 #:labeled-for
87 #:for
88 #:for-in
89 #:while
90 #:do
91 #:do*
92 #:dotimes
93 #:dolist
94 #:loop
95
96 ;; with
97 #:with
98
99 ;; case
100 #:switch
101 #:case
102 #:default
103
104 ;; try throw catch
105 #:try
106
107 ;; regex literals
108 #:regex
109
110 ;; conditional compilation (IE)
111 #:cc-if
112
113 ;; function definition
114 #:defun
115 #:lambda
116 #:flet
117 #:labels
118
119 ;; lambda lists
120 #:&key
121 #:&rest
122 #:&body
123 #:&optional
124 #:&aux
125 #:&environment
126 #:&key-object
127
128 ;; slot access
129 #:with-slots
130 #:slot-value
131
132 ;; macros
133 #:macrolet
134 #:symbol-macrolet
135 #:define-symbol-macro
136 #:define-ps-symbol-macro
137 #:defmacro
138
139 ;; lisp eval
140 #:lisp
141
142 ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v
143
144 ;; html generator for javascript
145 #:*ps-html-empty-tag-aware-p*
146 #:*ps-html-mode*
147 #:ps-html
148 #:who-ps-html
149
150 ;; utils
151 #:do-set-timeout
152 #:max
153 #:min
154 #:floor
155 #:ceiling
156 #:round
157 #:sin
158 #:cos
159 #:tan
160 #:asin
161 #:acos
162 #:atan
163 #:pi
164 #:sinh
165 #:cosh
166 #:tanh
167 #:asinh
168 #:acosh
169 #:atanh
170 #:1+
171 #:1-
172 #:abs
173 #:evenp
174 #:oddp
175 #:exp
176 #:expt
177 #:log
178 #:sqrt
179 #:random
180 #:ignore-errors
181 #:concatenate
182 #:concat-string
183 #:length
184 #:null
185 #:defined
186 #:undefined
187 #:@
188 #:with-lambda
189 #:stringp
190 #:numberp
191 #:functionp
192 #:objectp
193 #:memoize
194 #:append
195 #:apply
196 #:destructuring-bind
197
198 ;; DOM accessing utils
199 #:inner-html
200 #:uri-encode
201 #:attribute
202 #:offset
203 #:scroll
204 #:inner
205 #:client
206
207 ;; js runtime utils
208 #:*ps-lisp-library*
209 #:mapcar
210 #:map-into
211 #:map
212 #:map-until
213 #:member
214 #:append
215 #:set-difference
216 ))
217 (defparameter *parenscript-interface-exports*
218 '(;; compiler
219 #:*js-target-version*
220 #:compile-script
221 #:ps
222 #:ps-doc
223 #:ps-doc*
224 #:ps*
225 #:ps-inline
226 #:ps-inline*
227 #:*ps-read-function*
228 #:ps-compile-file
229 #:ps-compile-stream
230 ;; for parenscript macro definition within lisp
231 #:defpsmacro
232 #:defmacro/ps
233 #:defmacro+ps
234 #:import-macros-from-lisp
235
236 ;; gensym
237 #:ps-gensym
238 #:with-ps-gensyms
239 #:ps-once-only
240 #:*ps-gensym-counter*
241
242 ;; naming and namespaces
243 #:ps-package-prefix
244 #:obfuscate-package
245 #:unobfuscate-package
246
247 ;; printer
248 #:symbol-to-js-string
249 #:*js-string-delimiter*
250 #:*js-inline-string-delimiter*
251 #:*ps-print-pretty*
252 #:*indent-num-spaces*
253 ))
254 (defparameter *parenscript-interface-deprecated-exports*
255 '(;; deprecated interface
256 #:define-script-symbol-macro
257 #:gen-js-name
258 #:with-unique-js-names
259 #:defjsmacro
260 #:js-compile
261 #:js-inline
262 #:js-inline*
263 #:js
264 #:js*
265 #:symbol-to-js
266 ))
267
268 (defparameter *javascript-exports*
269 '(;;; for representing js code as s-expressions
270
271 ;; operators
272 ; arithmetic
273 #:+
274 #:-
275 #:*
276 #:/
277 #:%
278
279 ; bitwise
280 #:&
281 #:|\||
282 #:^
283 #:~
284 #:>>
285 #:<<
286 #:>>>
287
288 ; assignment
289 #:=
290 #:+=
291 #:-=
292 #:*=
293 #:/=
294 #:%=
295 #:&=
296 #:\|=
297 #:^+
298 #:>>=
299 #:<<=
300 #:>>>=
301
302 ; increment/decrement
303 #:++
304 #:--
305
306 ; comparison
307 #:==
308 #:===
309 #:!=
310 #:!==
311 #:>
312 #:>=
313 #:<
314 #:<=
315
316 ; logical
317 #:&&
318 #:||||
319 #:!
320
321 ; misc
322 #:? ; ternary
323 #:|,|
324 #:delete
325 #:function
326 #:get
327 #:in
328 #:instanceof
329 #:new
330 #:this
331 #:typeof
332 #:void
333
334
335 ;; statements
336 #:block
337 #:break
338 #:continue
339 #:do-while
340 #:for
341 #:for-in
342 #:if
343 #:label
344 #:return
345 #:switch
346 #:throw
347 #:try
348 #:var
349 #:while
350 #:with
351
352
353 #:unary-operator
354 #:literal
355 #:array
356 #:aref
357 #:operator
358 #:cond
359 #:lambda
360 #:object
361 #:variable
362 #:slot-value
363 #:funcall
364 #:escape
365 ))
366 )
367
368 (defpackage "PARENSCRIPT"
369 (:use "COMMON-LISP" "ANAPHORA")
370 (:nicknames "JS" "PS")
371 #.(cons :export *parenscript-lang-exports*)
372 #.(cons :export *parenscript-interface-exports*)
373 #.(cons :export *parenscript-interface-deprecated-exports*)
374 #.(cons :export *javascript-exports*)
375 )
376