Substantially modified the way Parenscript compilation and
[clinton/parenscript.git] / src / package.lisp
CommitLineData
e8fdcce7 1(in-package "CL-USER")
171bbab3 2
d31d0bc7
VS
3(eval-when (:compile-toplevel :load-toplevel :execute)
4 (defparameter *parenscript-lang-exports*
b73376a5 5 '(;; literals
171bbab3
RD
6 #:t
7 #:f
8 #:true
45c9f9c2 9 #.(symbol-name 'nil) ; for case-sensitive Lisps like some versions of Allegro
171bbab3
RD
10 #:this
11 #:false
12 #:undefined
72044f33 13 #:{}
d3c4afa2 14
171bbab3
RD
15 ;; keywords
16 #:break
17 #:continue
d3c4afa2 18
171bbab3
RD
19 ;; array literals
20 #:array
21 #:list
22 #:aref
ce44c98c 23 #:elt
171bbab3 24 #:make-array
06ed0d3a 25 #:[]
d3c4afa2 26
171bbab3
RD
27 ;; operators
28 #:! #:not #:~
29 #:* #:/ #:%
30 #:+ #:-
31 #:<< #:>>
32 #:>>>
33 #:< #:> #:<= #:>=
34 #:in
35 #:eql #:== #:!= #:=
36 #:=== #:!==
37 #:&
38 #:^
39 #:\|
40 #:\&\& #:and
41 #:\|\| #:or
42 #:>>= #:<<=
43 #:*= #:/= #:%= #:+= #:\&= #:^= #:\|= #:~=
171bbab3 44 #:incf #:decf
8877a380
VS
45
46 ;; compile-time stuff
47 #:eval-when
d3c4afa2 48
171bbab3
RD
49 ;; body forms
50 #:progn
d3c4afa2 51
171bbab3
RD
52 ;; object literals
53 #:create
171bbab3 54 #:with-slots
d3c4afa2 55
171bbab3
RD
56 ;; if
57 #:if
58 #:when
59 #:unless
d3c4afa2 60
171bbab3
RD
61 ;; single argument statements
62 #:return
63 #:throw
d3c4afa2 64
171bbab3
RD
65 ;; single argument expressions
66 #:delete
67 #:void
68 #:typeof
69 #:instanceof
70 #:new
d3c4afa2 71
d31d0bc7 72 ;; assignment and binding
171bbab3 73 #:setf
d31d0bc7 74 #:defsetf
1fe28ee1 75 #:psetf
ec227186
TC
76 #:setq
77 #:psetq
613457a0
TC
78 #:let*
79 #:let
d3c4afa2 80
171bbab3 81 ;; variables
58c4ef4f 82 #:var
171bbab3 83 #:defvar
d3c4afa2 84
171bbab3 85 ;; iteration
6a2ce72d 86 #:labeled-for
171bbab3 87 #:for
6a2ce72d 88 #:for-in
171bbab3 89 #:while
613457a0
TC
90 #:do
91 #:do*
92 #:dotimes
93 #:dolist
618fb209 94 #:loop
d3c4afa2 95
171bbab3
RD
96 ;; with
97 #:with
d3c4afa2 98
171bbab3
RD
99 ;; case
100 #:switch
101 #:case
102 #:default
d3c4afa2 103
171bbab3
RD
104 ;; try throw catch
105 #:try
d3c4afa2 106
171bbab3
RD
107 ;; regex literals
108 #:regex
d3c4afa2 109
171bbab3 110 ;; conditional compilation (IE)
d31d0bc7 111 #:cc-if
d3c4afa2 112
d31d0bc7
VS
113 ;; function definition
114 #:defun
115 #:lambda
ef3be63e
VS
116 #:flet
117 #:labels
d3c4afa2 118
d31d0bc7
VS
119 ;; lambda lists
120 #:&key
121 #:&rest
122 #:&body
123 #:&optional
124 #:&aux
125 #:&environment
126 #:&key-object
46f794a4 127
d31d0bc7
VS
128 ;; slot access
129 #:with-slots
130 #:slot-value
46f794a4 131
d31d0bc7
VS
132 ;; macros
133 #:macrolet
134 #:symbol-macrolet
135 #:define-symbol-macro
386ecd2f 136 #:define-ps-symbol-macro
d31d0bc7 137 #:defmacro
d3c4afa2 138
d31d0bc7
VS
139 ;; lisp eval
140 #:lisp
d3c4afa2 141
d31d0bc7 142 ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v
171bbab3 143
d31d0bc7 144 ;; html generator for javascript
6c9687e9
VS
145 #:*ps-html-empty-tag-aware-p*
146 #:*ps-html-mode*
d31d0bc7 147 #:ps-html
1937c30a 148 #:who-ps-html
dbb7017b 149
d31d0bc7
VS
150 ;; utils
151 #:do-set-timeout
c72e87d8 152 #:max
4b6e50d2
TC
153 #:min
154 #:floor
c72e87d8 155 #:ceiling
4b6e50d2 156 #:round
c72e87d8
VS
157 #:sin
158 #:cos
159 #:tan
c72e87d8 160 #:asin
4b6e50d2 161 #:acos
c72e87d8 162 #:atan
58f3113d 163 #:pi
7a5c62dc
TC
164 #:sinh
165 #:cosh
166 #:tanh
167 #:asinh
168 #:acosh
169 #:atanh
4b6e50d2
TC
170 #:1+
171 #:1-
172 #:abs
173 #:evenp
174 #:oddp
c72e87d8 175 #:exp
c72e87d8 176 #:expt
4b6e50d2 177 #:log
a7b7afae 178 #:sqrt
c72e87d8 179 #:random
c72e87d8 180 #:ignore-errors
d5c9059a 181 #:concatenate
bb8ba95a 182 #:concat-string
c72e87d8
VS
183 #:length
184 #:null
83a26b36
DG
185 #:defined
186 #:undefined
c72e87d8 187 #:@
f61db7bb 188 #:with-lambda
83a26b36
DG
189 #:stringp
190 #:numberp
191 #:functionp
192 #:objectp
193 #:memoize
194 #:append
195 #:apply
196 #:destructuring-bind
c72e87d8 197
170ee9ab
DG
198 ;; DOM accessing utils
199 #:inner-html
200 #:uri-encode
201 #:attribute
202 #:offset
203 #:scroll
204 #:inner
205 #:client
206
352621e1 207 ;; js runtime utils
c72e87d8
VS
208 #:*ps-lisp-library*
209 #:mapcar
352621e1
VS
210 #:map-into
211 #:map
212 #:map-until
213 #:member
214 #:append
215 #:set-difference
b73376a5
TC
216 ))
217 (defparameter *parenscript-interface-exports*
218 '(;; compiler
4525e3cd 219 #:*js-target-version*
b73376a5
TC
220 #:compile-script
221 #:ps
222 #:ps-doc
157cb2d6 223 #:ps-doc*
b73376a5
TC
224 #:ps*
225 #:ps-inline
226 #:ps-inline*
5a69278c 227 #:*ps-read-function*
8877a380
VS
228 #:ps-compile-file
229 #:ps-compile-stream
b73376a5
TC
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
6274a448 248 #:symbol-to-js-string
b73376a5
TC
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
b65b21c2 256 #:define-script-symbol-macro
b73376a5
TC
257 #:gen-js-name
258 #:with-unique-js-names
259 #:defjsmacro
260 #:js-compile
261 #:js-inline
262 #:js-inline*
263 #:js
264 #:js*
ffb6d061 265 #:symbol-to-js
b73376a5 266 ))
e8fdcce7
VS
267
268 (defparameter *javascript-exports*
fdfa77fc
VS
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 #:++
e8fdcce7 304 #:--
fdfa77fc
VS
305
306 ; comparison
307 #:==
308 #:===
309 #:!=
310 #:!==
311 #:>
312 #:>=
313 #:<
314 #:<=
315
316 ; logical
317 #:&&
318 #:||||
0ce67a33 319 #:!
fdfa77fc
VS
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
0ce67a33 336 #:block
0ce67a33
VS
337 #:break
338 #:continue
fdfa77fc
VS
339 #:do-while
340 #:for
341 #:for-in
342 #:if
343 #:label
0ce67a33 344 #:return
fdfa77fc 345 #:switch
0ce67a33 346 #:throw
fdfa77fc
VS
347 #:try
348 #:var
349 #:while
350 #:with
351
352
353 #:unary-operator
354 #:literal
0ce67a33
VS
355 #:array
356 #:aref
0ce67a33 357 #:operator
0ce67a33
VS
358 #:cond
359 #:lambda
360 #:object
361 #:variable
362 #:slot-value
0ce67a33 363 #:funcall
0ce67a33 364 #:escape
e8fdcce7 365 ))
b73376a5 366 )
171bbab3 367
e8fdcce7 368(defpackage "PARENSCRIPT"
5a69278c 369 (:use "COMMON-LISP" "ANAPHORA")
e8fdcce7 370 (:nicknames "JS" "PS")
171bbab3 371 #.(cons :export *parenscript-lang-exports*)
b73376a5
TC
372 #.(cons :export *parenscript-interface-exports*)
373 #.(cons :export *parenscript-interface-deprecated-exports*)
e8fdcce7 374 #.(cons :export *javascript-exports*)
b73376a5 375 )
f326f929 376