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 |
d3c4afa2 | 45 | |
171bbab3 RD |
46 | ;; body forms |
47 | #:progn | |
d3c4afa2 | 48 | |
171bbab3 RD |
49 | ;; object literals |
50 | #:create | |
171bbab3 | 51 | #:with-slots |
d3c4afa2 | 52 | |
171bbab3 RD |
53 | ;; if |
54 | #:if | |
55 | #:when | |
56 | #:unless | |
d3c4afa2 | 57 | |
171bbab3 RD |
58 | ;; single argument statements |
59 | #:return | |
60 | #:throw | |
d3c4afa2 | 61 | |
171bbab3 RD |
62 | ;; single argument expressions |
63 | #:delete | |
64 | #:void | |
65 | #:typeof | |
66 | #:instanceof | |
67 | #:new | |
d3c4afa2 | 68 | |
d31d0bc7 | 69 | ;; assignment and binding |
171bbab3 | 70 | #:setf |
d31d0bc7 | 71 | #:defsetf |
1fe28ee1 | 72 | #:psetf |
ec227186 TC |
73 | #:setq |
74 | #:psetq | |
b5cf9e71 | 75 | #:simple-let* |
ca25a40e | 76 | #:simple-let |
58c4ef4f | 77 | #:lexical-let* |
3530f5e1 | 78 | #:lexical-let |
613457a0 TC |
79 | #:let* |
80 | #:let | |
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 | |
ef3be63e VS |
117 | #:flet |
118 | #:labels | |
d3c4afa2 | 119 | |
d31d0bc7 VS |
120 | ;; lambda lists |
121 | #:&key | |
122 | #:&rest | |
123 | #:&body | |
124 | #:&optional | |
125 | #:&aux | |
126 | #:&environment | |
127 | #:&key-object | |
46f794a4 | 128 | |
d31d0bc7 VS |
129 | ;; slot access |
130 | #:with-slots | |
131 | #:slot-value | |
46f794a4 | 132 | |
d31d0bc7 VS |
133 | ;; macros |
134 | #:macrolet | |
135 | #:symbol-macrolet | |
136 | #:define-symbol-macro | |
386ecd2f | 137 | #:define-ps-symbol-macro |
d31d0bc7 | 138 | #:defmacro |
d3c4afa2 | 139 | |
d31d0bc7 VS |
140 | ;; lisp eval |
141 | #:lisp | |
d3c4afa2 | 142 | |
d31d0bc7 | 143 | ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v |
171bbab3 | 144 | |
d31d0bc7 | 145 | ;; html generator for javascript |
6c9687e9 VS |
146 | #:*ps-html-empty-tag-aware-p* |
147 | #:*ps-html-mode* | |
d31d0bc7 | 148 | #:ps-html |
1937c30a | 149 | #:who-ps-html |
dbb7017b | 150 | |
d31d0bc7 VS |
151 | ;; utils |
152 | #:do-set-timeout | |
c72e87d8 | 153 | #:max |
4b6e50d2 TC |
154 | #:min |
155 | #:floor | |
c72e87d8 | 156 | #:ceiling |
4b6e50d2 | 157 | #:round |
c72e87d8 VS |
158 | #:sin |
159 | #:cos | |
160 | #:tan | |
c72e87d8 | 161 | #:asin |
4b6e50d2 | 162 | #:acos |
c72e87d8 | 163 | #:atan |
58f3113d | 164 | #:pi |
7a5c62dc TC |
165 | #:sinh |
166 | #:cosh | |
167 | #:tanh | |
168 | #:asinh | |
169 | #:acosh | |
170 | #:atanh | |
4b6e50d2 TC |
171 | #:1+ |
172 | #:1- | |
173 | #:abs | |
174 | #:evenp | |
175 | #:oddp | |
c72e87d8 | 176 | #:exp |
c72e87d8 | 177 | #:expt |
4b6e50d2 | 178 | #:log |
a7b7afae | 179 | #:sqrt |
c72e87d8 | 180 | #:random |
c72e87d8 | 181 | #:ignore-errors |
d5c9059a | 182 | #:concatenate |
bb8ba95a | 183 | #:concat-string |
c72e87d8 VS |
184 | #:length |
185 | #:null | |
83a26b36 DG |
186 | #:defined |
187 | #:undefined | |
c72e87d8 | 188 | #:@ |
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 | |
220 | #:compile-script | |
221 | #:ps | |
222 | #:ps-doc | |
157cb2d6 | 223 | #:ps-doc* |
b73376a5 | 224 | #:ps* |
cb8f8e58 | 225 | #:ps1* |
b73376a5 TC |
226 | #:ps-inline |
227 | #:ps-inline* | |
228 | ||
229 | ;; for parenscript macro definition within lisp | |
230 | #:defpsmacro | |
231 | #:defmacro/ps | |
232 | #:defmacro+ps | |
233 | #:import-macros-from-lisp | |
234 | ||
235 | ;; gensym | |
236 | #:ps-gensym | |
237 | #:with-ps-gensyms | |
238 | #:ps-once-only | |
239 | #:*ps-gensym-counter* | |
240 | ||
241 | ;; naming and namespaces | |
242 | #:ps-package-prefix | |
243 | #:obfuscate-package | |
244 | #:unobfuscate-package | |
245 | ||
246 | ;; printer | |
6274a448 | 247 | #:symbol-to-js-string |
b73376a5 TC |
248 | #:*js-string-delimiter* |
249 | #:*js-inline-string-delimiter* | |
250 | #:*ps-print-pretty* | |
251 | #:*indent-num-spaces* | |
252 | )) | |
253 | (defparameter *parenscript-interface-deprecated-exports* | |
254 | '(;; deprecated interface | |
b65b21c2 | 255 | #:define-script-symbol-macro |
b73376a5 TC |
256 | #:gen-js-name |
257 | #:with-unique-js-names | |
258 | #:defjsmacro | |
259 | #:js-compile | |
260 | #:js-inline | |
261 | #:js-inline* | |
262 | #:js | |
263 | #:js* | |
ffb6d061 | 264 | #:symbol-to-js |
b73376a5 | 265 | )) |
e8fdcce7 VS |
266 | |
267 | (defparameter *javascript-exports* | |
fdfa77fc VS |
268 | '(;;; for representing js code as s-expressions |
269 | ||
270 | ;; operators | |
271 | ; arithmetic | |
272 | #:+ | |
273 | #:- | |
274 | #:* | |
275 | #:/ | |
276 | #:% | |
277 | ||
278 | ; bitwise | |
279 | #:& | |
280 | #:|\|| | |
281 | #:^ | |
282 | #:~ | |
283 | #:>> | |
284 | #:<< | |
285 | #:>>> | |
286 | ||
287 | ; assignment | |
288 | #:= | |
289 | #:+= | |
290 | #:-= | |
291 | #:*= | |
292 | #:/= | |
293 | #:%= | |
294 | #:&= | |
295 | #:\|= | |
296 | #:^+ | |
297 | #:>>= | |
298 | #:<<= | |
299 | #:>>>= | |
300 | ||
301 | ; increment/decrement | |
302 | #:++ | |
e8fdcce7 | 303 | #:-- |
fdfa77fc VS |
304 | |
305 | ; comparison | |
306 | #:== | |
307 | #:=== | |
308 | #:!= | |
309 | #:!== | |
310 | #:> | |
311 | #:>= | |
312 | #:< | |
313 | #:<= | |
314 | ||
315 | ; logical | |
316 | #:&& | |
317 | #:|||| | |
0ce67a33 | 318 | #:! |
fdfa77fc VS |
319 | |
320 | ; misc | |
321 | #:? ; ternary | |
322 | #:|,| | |
323 | #:delete | |
324 | #:function | |
325 | #:get | |
326 | #:in | |
327 | #:instanceof | |
328 | #:new | |
329 | #:this | |
330 | #:typeof | |
331 | #:void | |
332 | ||
333 | ||
334 | ;; statements | |
0ce67a33 | 335 | #:block |
0ce67a33 VS |
336 | #:break |
337 | #:continue | |
fdfa77fc VS |
338 | #:do-while |
339 | #:for | |
340 | #:for-in | |
341 | #:if | |
342 | #:label | |
0ce67a33 | 343 | #:return |
fdfa77fc | 344 | #:switch |
0ce67a33 | 345 | #:throw |
fdfa77fc VS |
346 | #:try |
347 | #:var | |
348 | #:while | |
349 | #:with | |
350 | ||
351 | ||
352 | #:unary-operator | |
353 | #:literal | |
0ce67a33 VS |
354 | #:array |
355 | #:aref | |
0ce67a33 | 356 | #:operator |
0ce67a33 VS |
357 | #:cond |
358 | #:lambda | |
359 | #:object | |
360 | #:variable | |
361 | #:slot-value | |
0ce67a33 | 362 | #:funcall |
0ce67a33 | 363 | #:escape |
e8fdcce7 | 364 | )) |
b73376a5 | 365 | ) |
171bbab3 | 366 | |
e8fdcce7 VS |
367 | (defpackage "PARENSCRIPT" |
368 | (:use "COMMON-LISP") | |
369 | (:nicknames "JS" "PS") | |
171bbab3 | 370 | #.(cons :export *parenscript-lang-exports*) |
b73376a5 TC |
371 | #.(cons :export *parenscript-interface-exports*) |
372 | #.(cons :export *parenscript-interface-deprecated-exports*) | |
e8fdcce7 | 373 | #.(cons :export *javascript-exports*) |
b73376a5 | 374 | ) |
f326f929 | 375 |