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 | |
a14fb2cb | 35 | #:== #:!= #:= |
171bbab3 RD |
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 | |
faa26a99 | 80 | #:letrec |
d3c4afa2 | 81 | |
171bbab3 | 82 | ;; variables |
58c4ef4f | 83 | #:var |
171bbab3 | 84 | #:defvar |
d3c4afa2 | 85 | |
171bbab3 | 86 | ;; iteration |
6a2ce72d | 87 | #:labeled-for |
171bbab3 | 88 | #:for |
6a2ce72d | 89 | #:for-in |
171bbab3 | 90 | #:while |
613457a0 TC |
91 | #:do |
92 | #:do* | |
93 | #:dotimes | |
94 | #:dolist | |
618fb209 | 95 | #:loop |
d3c4afa2 | 96 | |
171bbab3 RD |
97 | ;; with |
98 | #:with | |
d3c4afa2 | 99 | |
171bbab3 RD |
100 | ;; case |
101 | #:switch | |
102 | #:case | |
103 | #:default | |
d3c4afa2 | 104 | |
171bbab3 RD |
105 | ;; try throw catch |
106 | #:try | |
d3c4afa2 | 107 | |
171bbab3 RD |
108 | ;; regex literals |
109 | #:regex | |
d3c4afa2 | 110 | |
171bbab3 | 111 | ;; conditional compilation (IE) |
d31d0bc7 | 112 | #:cc-if |
d3c4afa2 | 113 | |
d31d0bc7 VS |
114 | ;; function definition |
115 | #:defun | |
116 | #:lambda | |
d3c4afa2 | 117 | |
d31d0bc7 VS |
118 | ;; lambda lists |
119 | #:&key | |
120 | #:&rest | |
121 | #:&body | |
122 | #:&optional | |
123 | #:&aux | |
124 | #:&environment | |
125 | #:&key-object | |
46f794a4 | 126 | |
d31d0bc7 VS |
127 | ;; slot access |
128 | #:with-slots | |
129 | #:slot-value | |
46f794a4 | 130 | |
d31d0bc7 VS |
131 | ;; macros |
132 | #:macrolet | |
133 | #:symbol-macrolet | |
134 | #:define-symbol-macro | |
386ecd2f | 135 | #:define-ps-symbol-macro |
d31d0bc7 | 136 | #:defmacro |
d3c4afa2 | 137 | |
d31d0bc7 VS |
138 | ;; lisp eval |
139 | #:lisp | |
d3c4afa2 | 140 | |
d31d0bc7 | 141 | ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v |
171bbab3 | 142 | |
d31d0bc7 | 143 | ;; html generator for javascript |
6c9687e9 VS |
144 | #:*ps-html-empty-tag-aware-p* |
145 | #:*ps-html-mode* | |
d31d0bc7 | 146 | #:ps-html |
1937c30a | 147 | #:who-ps-html |
dbb7017b | 148 | |
d31d0bc7 VS |
149 | ;; utils |
150 | #:do-set-timeout | |
c72e87d8 | 151 | #:max |
4b6e50d2 TC |
152 | #:min |
153 | #:floor | |
c72e87d8 | 154 | #:ceiling |
4b6e50d2 | 155 | #:round |
c72e87d8 VS |
156 | #:sin |
157 | #:cos | |
158 | #:tan | |
c72e87d8 | 159 | #:asin |
4b6e50d2 | 160 | #:acos |
c72e87d8 | 161 | #:atan |
58f3113d | 162 | #:pi |
7a5c62dc TC |
163 | #:sinh |
164 | #:cosh | |
165 | #:tanh | |
166 | #:asinh | |
167 | #:acosh | |
168 | #:atanh | |
4b6e50d2 TC |
169 | #:1+ |
170 | #:1- | |
171 | #:abs | |
172 | #:evenp | |
173 | #:oddp | |
c72e87d8 | 174 | #:exp |
c72e87d8 | 175 | #:expt |
4b6e50d2 | 176 | #:log |
a7b7afae | 177 | #:sqrt |
c72e87d8 | 178 | #:random |
c72e87d8 | 179 | #:ignore-errors |
d5c9059a | 180 | #:concatenate |
bb8ba95a | 181 | #:concat-string |
c72e87d8 | 182 | #:length |
83a26b36 DG |
183 | #:defined |
184 | #:undefined | |
c72e87d8 | 185 | #:@ |
90f33220 | 186 | #:chain |
f61db7bb | 187 | #:with-lambda |
83a26b36 DG |
188 | #:stringp |
189 | #:numberp | |
190 | #:functionp | |
191 | #:objectp | |
192 | #:memoize | |
193 | #:append | |
194 | #:apply | |
195 | #:destructuring-bind | |
c72e87d8 | 196 | |
170ee9ab DG |
197 | ;; DOM accessing utils |
198 | #:inner-html | |
199 | #:uri-encode | |
200 | #:attribute | |
201 | #:offset | |
202 | #:scroll | |
203 | #:inner | |
204 | #:client | |
205 | ||
352621e1 | 206 | ;; js runtime utils |
c72e87d8 VS |
207 | #:*ps-lisp-library* |
208 | #:mapcar | |
352621e1 VS |
209 | #:map-into |
210 | #:map | |
211 | #:map-until | |
212 | #:member | |
213 | #:append | |
214 | #:set-difference | |
b73376a5 TC |
215 | )) |
216 | (defparameter *parenscript-interface-exports* | |
217 | '(;; compiler | |
4525e3cd | 218 | #:*js-target-version* |
b73376a5 TC |
219 | #:compile-script |
220 | #:ps | |
d434e1d5 | 221 | #:ps-to-stream |
b73376a5 | 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 | |
4e6c3ba1 | 333 | #:null |
fdfa77fc VS |
334 | |
335 | ||
336 | ;; statements | |
0ce67a33 | 337 | #:block |
0ce67a33 VS |
338 | #:break |
339 | #:continue | |
fdfa77fc VS |
340 | #:do-while |
341 | #:for | |
342 | #:for-in | |
343 | #:if | |
344 | #:label | |
0ce67a33 | 345 | #:return |
fdfa77fc | 346 | #:switch |
0ce67a33 | 347 | #:throw |
fdfa77fc VS |
348 | #:try |
349 | #:var | |
350 | #:while | |
351 | #:with | |
352 | ||
353 | ||
354 | #:unary-operator | |
355 | #:literal | |
0ce67a33 VS |
356 | #:array |
357 | #:aref | |
0ce67a33 | 358 | #:operator |
0ce67a33 VS |
359 | #:cond |
360 | #:lambda | |
361 | #:object | |
362 | #:variable | |
363 | #:slot-value | |
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 |