Fixed bug with incorrectly parenthesized if expressions.
[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 ;; body forms
47 #:progn
48
49 ;; object literals
50 #:create
51 #:with-slots
52
53 ;; if
54 #:if
55 #:when
56 #:unless
57
58 ;; single argument statements
59 #:return
60 #:throw
61
62 ;; single argument expressions
63 #:delete
64 #:void
65 #:typeof
66 #:instanceof
67 #:new
68
69 ;; assignment and binding
70 #:setf
71 #:defsetf
72 #:psetf
73 #:setq
74 #:psetq
75 #:simple-let*
76 #:simple-let
77 #:lexical-let*
78 #:lexical-let
79 #:let*
80 #:let
81
82 ;; variables
83 #:var
84 #:defvar
85
86 ;; iteration
87 #:labeled-for
88 #:for
89 #:for-in
90 #:while
91 #:do
92 #:do*
93 #:dotimes
94 #:dolist
95 #:loop
96
97 ;; with
98 #:with
99
100 ;; case
101 #:switch
102 #:case
103 #:default
104
105 ;; try throw catch
106 #:try
107
108 ;; regex literals
109 #:regex
110
111 ;; conditional compilation (IE)
112 #:cc-if
113
114 ;; function definition
115 #:defun
116 #:lambda
117 #:flet
118 #:labels
119
120 ;; lambda lists
121 #:&key
122 #:&rest
123 #:&body
124 #:&optional
125 #:&aux
126 #:&environment
127 #:&key-object
128
129 ;; slot access
130 #:with-slots
131 #:slot-value
132
133 ;; macros
134 #:macrolet
135 #:symbol-macrolet
136 #:define-symbol-macro
137 #:define-ps-symbol-macro
138 #:defmacro
139
140 ;; lisp eval
141 #:lisp
142
143 ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v
144
145 ;; html generator for javascript
146 #:*ps-html-empty-tag-aware-p*
147 #:*ps-html-mode*
148 #:ps-html
149 #:who-ps-html
150
151 ;; utils
152 #:do-set-timeout
153 #:max
154 #:min
155 #:floor
156 #:ceiling
157 #:round
158 #:sin
159 #:cos
160 #:tan
161 #:asin
162 #:acos
163 #:atan
164 #:pi
165 #:sinh
166 #:cosh
167 #:tanh
168 #:asinh
169 #:acosh
170 #:atanh
171 #:1+
172 #:1-
173 #:abs
174 #:evenp
175 #:oddp
176 #:exp
177 #:expt
178 #:log
179 #:sqrt
180 #:random
181 #:ignore-errors
182 #:concatenate
183 #:concat-string
184 #:length
185 #:null
186 #:defined
187 #:undefined
188 #:@
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 #:ps1*
227 #:ps-inline
228 #:ps-inline*
229
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")
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