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 | |
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 | #:@ |
90f33220 | 188 | #:chain |
f61db7bb | 189 | #:with-lambda |
83a26b36 DG |
190 | #:stringp |
191 | #:numberp | |
192 | #:functionp | |
193 | #:objectp | |
194 | #:memoize | |
195 | #:append | |
196 | #:apply | |
197 | #:destructuring-bind | |
c72e87d8 | 198 | |
170ee9ab DG |
199 | ;; DOM accessing utils |
200 | #:inner-html | |
201 | #:uri-encode | |
202 | #:attribute | |
203 | #:offset | |
204 | #:scroll | |
205 | #:inner | |
206 | #:client | |
207 | ||
352621e1 | 208 | ;; js runtime utils |
c72e87d8 VS |
209 | #:*ps-lisp-library* |
210 | #:mapcar | |
352621e1 VS |
211 | #:map-into |
212 | #:map | |
213 | #:map-until | |
214 | #:member | |
215 | #:append | |
216 | #:set-difference | |
b73376a5 TC |
217 | )) |
218 | (defparameter *parenscript-interface-exports* | |
219 | '(;; compiler | |
4525e3cd | 220 | #:*js-target-version* |
b73376a5 TC |
221 | #:compile-script |
222 | #:ps | |
223 | #:ps-doc | |
157cb2d6 | 224 | #:ps-doc* |
b73376a5 TC |
225 | #:ps* |
226 | #:ps-inline | |
227 | #:ps-inline* | |
5a69278c | 228 | #:*ps-read-function* |
8877a380 VS |
229 | #:ps-compile-file |
230 | #:ps-compile-stream | |
b73376a5 TC |
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 | |
6274a448 | 249 | #:symbol-to-js-string |
b73376a5 TC |
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 | |
b65b21c2 | 257 | #:define-script-symbol-macro |
b73376a5 TC |
258 | #:gen-js-name |
259 | #:with-unique-js-names | |
260 | #:defjsmacro | |
261 | #:js-compile | |
262 | #:js-inline | |
263 | #:js-inline* | |
264 | #:js | |
265 | #:js* | |
ffb6d061 | 266 | #:symbol-to-js |
b73376a5 | 267 | )) |
e8fdcce7 VS |
268 | |
269 | (defparameter *javascript-exports* | |
fdfa77fc VS |
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 | #:++ | |
e8fdcce7 | 305 | #:-- |
fdfa77fc VS |
306 | |
307 | ; comparison | |
308 | #:== | |
309 | #:=== | |
310 | #:!= | |
311 | #:!== | |
312 | #:> | |
313 | #:>= | |
314 | #:< | |
315 | #:<= | |
316 | ||
317 | ; logical | |
318 | #:&& | |
319 | #:|||| | |
0ce67a33 | 320 | #:! |
fdfa77fc VS |
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 | |
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 | #:funcall |
0ce67a33 | 365 | #:escape |
e8fdcce7 | 366 | )) |
b73376a5 | 367 | ) |
171bbab3 | 368 | |
e8fdcce7 | 369 | (defpackage "PARENSCRIPT" |
5a69278c | 370 | (:use "COMMON-LISP" "ANAPHORA") |
e8fdcce7 | 371 | (:nicknames "JS" "PS") |
171bbab3 | 372 | #.(cons :export *parenscript-lang-exports*) |
b73376a5 TC |
373 | #.(cons :export *parenscript-interface-exports*) |
374 | #.(cons :export *parenscript-interface-deprecated-exports*) | |
e8fdcce7 | 375 | #.(cons :export *javascript-exports*) |
b73376a5 | 376 | ) |
f326f929 | 377 |