49205388b6ede903785be5c290d6984f0309d6c0
[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 #:== #:!= #:=
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 #:chain
189 #:with-lambda
190 #:stringp
191 #:numberp
192 #:functionp
193 #:objectp
194 #:memoize
195 #:append
196 #:apply
197 #:destructuring-bind
198
199 ;; DOM accessing utils
200 #:inner-html
201 #:uri-encode
202 #:attribute
203 #:offset
204 #:scroll
205 #:inner
206 #:client
207
208 ;; js runtime utils
209 #:*ps-lisp-library*
210 #:mapcar
211 #:map-into
212 #:map
213 #:map-until
214 #:member
215 #:append
216 #:set-difference
217 ))
218 (defparameter *parenscript-interface-exports*
219 '(;; compiler
220 #:*js-target-version*
221 #:compile-script
222 #:ps
223 #:ps-doc
224 #:ps-doc*
225 #:ps*
226 #:ps-inline
227 #:ps-inline*
228 #:*ps-read-function*
229 #:ps-compile-file
230 #:ps-compile-stream
231 ;; for parenscript macro definition within lisp
232 #:defpsmacro
233 #:defmacro/ps
234 #:defmacro+ps
235 #:import-macros-from-lisp
236
237 ;; gensym
238 #:ps-gensym
239 #:with-ps-gensyms
240 #:ps-once-only
241 #:*ps-gensym-counter*
242
243 ;; naming and namespaces
244 #:ps-package-prefix
245 #:obfuscate-package
246 #:unobfuscate-package
247
248 ;; printer
249 #:symbol-to-js-string
250 #:*js-string-delimiter*
251 #:*js-inline-string-delimiter*
252 #:*ps-print-pretty*
253 #:*indent-num-spaces*
254 ))
255 (defparameter *parenscript-interface-deprecated-exports*
256 '(;; deprecated interface
257 #:define-script-symbol-macro
258 #:gen-js-name
259 #:with-unique-js-names
260 #:defjsmacro
261 #:js-compile
262 #:js-inline
263 #:js-inline*
264 #:js
265 #:js*
266 #:symbol-to-js
267 ))
268
269 (defparameter *javascript-exports*
270 '(;;; for representing js code as s-expressions
271
272 ;; operators
273 ; arithmetic
274 #:+
275 #:-
276 #:*
277 #:/
278 #:%
279
280 ; bitwise
281 #:&
282 #:|\||
283 #:^
284 #:~
285 #:>>
286 #:<<
287 #:>>>
288
289 ; assignment
290 #:=
291 #:+=
292 #:-=
293 #:*=
294 #:/=
295 #:%=
296 #:&=
297 #:\|=
298 #:^+
299 #:>>=
300 #:<<=
301 #:>>>=
302
303 ; increment/decrement
304 #:++
305 #:--
306
307 ; comparison
308 #:==
309 #:===
310 #:!=
311 #:!==
312 #:>
313 #:>=
314 #:<
315 #:<=
316
317 ; logical
318 #:&&
319 #:||||
320 #:!
321
322 ; misc
323 #:? ; ternary
324 #:|,|
325 #:delete
326 #:function
327 #:get
328 #:in
329 #:instanceof
330 #:new
331 #:this
332 #:typeof
333 #:void
334
335
336 ;; statements
337 #:block
338 #:break
339 #:continue
340 #:do-while
341 #:for
342 #:for-in
343 #:if
344 #:label
345 #:return
346 #:switch
347 #:throw
348 #:try
349 #:var
350 #:while
351 #:with
352
353
354 #:unary-operator
355 #:literal
356 #:array
357 #:aref
358 #:operator
359 #:cond
360 #:lambda
361 #:object
362 #:variable
363 #:slot-value
364 #:funcall
365 #:escape
366 ))
367 )
368
369 (defpackage "PARENSCRIPT"
370 (:use "COMMON-LISP" "ANAPHORA")
371 (:nicknames "JS" "PS")
372 #.(cons :export *parenscript-lang-exports*)
373 #.(cons :export *parenscript-interface-exports*)
374 #.(cons :export *parenscript-interface-deprecated-exports*)
375 #.(cons :export *javascript-exports*)
376 )
377