Commit | Line | Data |
---|---|---|
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 | |
b5cf9e71 | 78 | #:simple-let* |
ca25a40e | 79 | #:simple-let |
58c4ef4f | 80 | #:lexical-let* |
3530f5e1 | 81 | #:lexical-let |
613457a0 TC |
82 | #:let* |
83 | #:let | |
d3c4afa2 | 84 | |
171bbab3 | 85 | ;; variables |
58c4ef4f | 86 | #:var |
171bbab3 | 87 | #:defvar |
d3c4afa2 | 88 | |
171bbab3 | 89 | ;; iteration |
6a2ce72d | 90 | #:labeled-for |
171bbab3 | 91 | #:for |
6a2ce72d | 92 | #:for-in |
171bbab3 | 93 | #:while |
613457a0 TC |
94 | #:do |
95 | #:do* | |
96 | #:dotimes | |
97 | #:dolist | |
618fb209 | 98 | #:loop |
d3c4afa2 | 99 | |
171bbab3 RD |
100 | ;; with |
101 | #:with | |
d3c4afa2 | 102 | |
171bbab3 RD |
103 | ;; case |
104 | #:switch | |
105 | #:case | |
106 | #:default | |
d3c4afa2 | 107 | |
171bbab3 RD |
108 | ;; try throw catch |
109 | #:try | |
d3c4afa2 | 110 | |
171bbab3 RD |
111 | ;; regex literals |
112 | #:regex | |
d3c4afa2 | 113 | |
171bbab3 | 114 | ;; conditional compilation (IE) |
d31d0bc7 | 115 | #:cc-if |
d3c4afa2 | 116 | |
d31d0bc7 VS |
117 | ;; function definition |
118 | #:defun | |
119 | #:lambda | |
ef3be63e VS |
120 | #:flet |
121 | #:labels | |
d3c4afa2 | 122 | |
d31d0bc7 VS |
123 | ;; lambda lists |
124 | #:&key | |
125 | #:&rest | |
126 | #:&body | |
127 | #:&optional | |
128 | #:&aux | |
129 | #:&environment | |
130 | #:&key-object | |
46f794a4 | 131 | |
d31d0bc7 VS |
132 | ;; slot access |
133 | #:with-slots | |
134 | #:slot-value | |
46f794a4 | 135 | |
d31d0bc7 VS |
136 | ;; macros |
137 | #:macrolet | |
138 | #:symbol-macrolet | |
139 | #:define-symbol-macro | |
386ecd2f | 140 | #:define-ps-symbol-macro |
d31d0bc7 | 141 | #:defmacro |
d3c4afa2 | 142 | |
d31d0bc7 VS |
143 | ;; lisp eval |
144 | #:lisp | |
d3c4afa2 | 145 | |
d31d0bc7 | 146 | ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v |
171bbab3 | 147 | |
d31d0bc7 | 148 | ;; html generator for javascript |
6c9687e9 VS |
149 | #:*ps-html-empty-tag-aware-p* |
150 | #:*ps-html-mode* | |
d31d0bc7 | 151 | #:ps-html |
1937c30a | 152 | #:who-ps-html |
dbb7017b | 153 | |
d31d0bc7 VS |
154 | ;; utils |
155 | #:do-set-timeout | |
c72e87d8 | 156 | #:max |
4b6e50d2 TC |
157 | #:min |
158 | #:floor | |
c72e87d8 | 159 | #:ceiling |
4b6e50d2 | 160 | #:round |
c72e87d8 VS |
161 | #:sin |
162 | #:cos | |
163 | #:tan | |
c72e87d8 | 164 | #:asin |
4b6e50d2 | 165 | #:acos |
c72e87d8 | 166 | #:atan |
58f3113d | 167 | #:pi |
7a5c62dc TC |
168 | #:sinh |
169 | #:cosh | |
170 | #:tanh | |
171 | #:asinh | |
172 | #:acosh | |
173 | #:atanh | |
4b6e50d2 TC |
174 | #:1+ |
175 | #:1- | |
176 | #:abs | |
177 | #:evenp | |
178 | #:oddp | |
c72e87d8 | 179 | #:exp |
c72e87d8 | 180 | #:expt |
4b6e50d2 | 181 | #:log |
a7b7afae | 182 | #:sqrt |
c72e87d8 | 183 | #:random |
c72e87d8 | 184 | #:ignore-errors |
d5c9059a | 185 | #:concatenate |
bb8ba95a | 186 | #:concat-string |
c72e87d8 VS |
187 | #:length |
188 | #:null | |
83a26b36 DG |
189 | #:defined |
190 | #:undefined | |
c72e87d8 | 191 | #:@ |
f61db7bb | 192 | #:with-lambda |
83a26b36 DG |
193 | #:stringp |
194 | #:numberp | |
195 | #:functionp | |
196 | #:objectp | |
197 | #:memoize | |
198 | #:append | |
199 | #:apply | |
200 | #:destructuring-bind | |
c72e87d8 | 201 | |
170ee9ab DG |
202 | ;; DOM accessing utils |
203 | #:inner-html | |
204 | #:uri-encode | |
205 | #:attribute | |
206 | #:offset | |
207 | #:scroll | |
208 | #:inner | |
209 | #:client | |
210 | ||
352621e1 | 211 | ;; js runtime utils |
c72e87d8 VS |
212 | #:*ps-lisp-library* |
213 | #:mapcar | |
352621e1 VS |
214 | #:map-into |
215 | #:map | |
216 | #:map-until | |
217 | #:member | |
218 | #:append | |
219 | #:set-difference | |
b73376a5 TC |
220 | )) |
221 | (defparameter *parenscript-interface-exports* | |
222 | '(;; compiler | |
4525e3cd | 223 | #:*js-target-version* |
b73376a5 TC |
224 | #:compile-script |
225 | #:ps | |
226 | #:ps-doc | |
157cb2d6 | 227 | #:ps-doc* |
b73376a5 | 228 | #:ps* |
cb8f8e58 | 229 | #:ps1* |
b73376a5 TC |
230 | #:ps-inline |
231 | #:ps-inline* | |
8877a380 VS |
232 | #:ps-compile-file |
233 | #:ps-compile-stream | |
b73376a5 TC |
234 | ;; for parenscript macro definition within lisp |
235 | #:defpsmacro | |
236 | #:defmacro/ps | |
237 | #:defmacro+ps | |
238 | #:import-macros-from-lisp | |
239 | ||
240 | ;; gensym | |
241 | #:ps-gensym | |
242 | #:with-ps-gensyms | |
243 | #:ps-once-only | |
244 | #:*ps-gensym-counter* | |
245 | ||
246 | ;; naming and namespaces | |
247 | #:ps-package-prefix | |
248 | #:obfuscate-package | |
249 | #:unobfuscate-package | |
250 | ||
251 | ;; printer | |
6274a448 | 252 | #:symbol-to-js-string |
b73376a5 TC |
253 | #:*js-string-delimiter* |
254 | #:*js-inline-string-delimiter* | |
255 | #:*ps-print-pretty* | |
256 | #:*indent-num-spaces* | |
257 | )) | |
258 | (defparameter *parenscript-interface-deprecated-exports* | |
259 | '(;; deprecated interface | |
b65b21c2 | 260 | #:define-script-symbol-macro |
b73376a5 TC |
261 | #:gen-js-name |
262 | #:with-unique-js-names | |
263 | #:defjsmacro | |
264 | #:js-compile | |
265 | #:js-inline | |
266 | #:js-inline* | |
267 | #:js | |
268 | #:js* | |
ffb6d061 | 269 | #:symbol-to-js |
b73376a5 | 270 | )) |
e8fdcce7 VS |
271 | |
272 | (defparameter *javascript-exports* | |
fdfa77fc VS |
273 | '(;;; for representing js code as s-expressions |
274 | ||
275 | ;; operators | |
276 | ; arithmetic | |
277 | #:+ | |
278 | #:- | |
279 | #:* | |
280 | #:/ | |
281 | #:% | |
282 | ||
283 | ; bitwise | |
284 | #:& | |
285 | #:|\|| | |
286 | #:^ | |
287 | #:~ | |
288 | #:>> | |
289 | #:<< | |
290 | #:>>> | |
291 | ||
292 | ; assignment | |
293 | #:= | |
294 | #:+= | |
295 | #:-= | |
296 | #:*= | |
297 | #:/= | |
298 | #:%= | |
299 | #:&= | |
300 | #:\|= | |
301 | #:^+ | |
302 | #:>>= | |
303 | #:<<= | |
304 | #:>>>= | |
305 | ||
306 | ; increment/decrement | |
307 | #:++ | |
e8fdcce7 | 308 | #:-- |
fdfa77fc VS |
309 | |
310 | ; comparison | |
311 | #:== | |
312 | #:=== | |
313 | #:!= | |
314 | #:!== | |
315 | #:> | |
316 | #:>= | |
317 | #:< | |
318 | #:<= | |
319 | ||
320 | ; logical | |
321 | #:&& | |
322 | #:|||| | |
0ce67a33 | 323 | #:! |
fdfa77fc VS |
324 | |
325 | ; misc | |
326 | #:? ; ternary | |
327 | #:|,| | |
328 | #:delete | |
329 | #:function | |
330 | #:get | |
331 | #:in | |
332 | #:instanceof | |
333 | #:new | |
334 | #:this | |
335 | #:typeof | |
336 | #:void | |
337 | ||
338 | ||
339 | ;; statements | |
0ce67a33 | 340 | #:block |
0ce67a33 VS |
341 | #:break |
342 | #:continue | |
fdfa77fc VS |
343 | #:do-while |
344 | #:for | |
345 | #:for-in | |
346 | #:if | |
347 | #:label | |
0ce67a33 | 348 | #:return |
fdfa77fc | 349 | #:switch |
0ce67a33 | 350 | #:throw |
fdfa77fc VS |
351 | #:try |
352 | #:var | |
353 | #:while | |
354 | #:with | |
355 | ||
356 | ||
357 | #:unary-operator | |
358 | #:literal | |
0ce67a33 VS |
359 | #:array |
360 | #:aref | |
0ce67a33 | 361 | #:operator |
0ce67a33 VS |
362 | #:cond |
363 | #:lambda | |
364 | #:object | |
365 | #:variable | |
366 | #:slot-value | |
0ce67a33 | 367 | #:funcall |
0ce67a33 | 368 | #:escape |
e8fdcce7 | 369 | )) |
b73376a5 | 370 | ) |
171bbab3 | 371 | |
e8fdcce7 VS |
372 | (defpackage "PARENSCRIPT" |
373 | (:use "COMMON-LISP") | |
374 | (:nicknames "JS" "PS") | |
171bbab3 | 375 | #.(cons :export *parenscript-lang-exports*) |
b73376a5 TC |
376 | #.(cons :export *parenscript-interface-exports*) |
377 | #.(cons :export *parenscript-interface-deprecated-exports*) | |
e8fdcce7 | 378 | #.(cons :export *javascript-exports*) |
b73376a5 | 379 | ) |
f326f929 | 380 |