Commit | Line | Data |
---|---|---|
8e198a08 | 1 | (in-package :cl-user) |
171bbab3 RD |
2 | ;;;; Package definitions for the Parenscript |
3 | ;; #: | |
4 | ||
5 | (eval-when (:compile-toplevel :load-toplevel) | |
6 | ;; exports shared between PARENSCRIPT and PARENSCRIPT.JAVASCRIPT | |
7 | (defparameter *shared-symbols-ps-js* | |
8 | '( | |
9 | ;; literals | |
10 | #:t | |
11 | #:f | |
12 | #:true | |
13 | #:nil | |
14 | #:this | |
15 | #:false | |
16 | #:undefined | |
17 | ||
18 | ;; keywords | |
19 | #:break | |
20 | #:continue | |
21 | ||
22 | ;; array literals | |
23 | #:array | |
24 | #:list | |
25 | #:aref | |
26 | #:make-array | |
27 | ||
28 | ;; operators | |
29 | #:! #:not #:~ | |
30 | #:* #:/ #:% | |
31 | #:+ #:- | |
32 | #:<< #:>> | |
33 | #:>>> | |
34 | #:< #:> #:<= #:>= | |
35 | #:in | |
36 | #:eql #:== #:!= #:= | |
37 | #:=== #:!== | |
38 | #:& | |
39 | #:^ | |
40 | #:\| | |
41 | #:\&\& #:and | |
42 | #:\|\| #:or | |
43 | #:>>= #:<<= | |
44 | #:*= #:/= #:%= #:+= #:\&= #:^= #:\|= #:~= | |
45 | #:++ #:-- | |
46 | #:1+ #:1- | |
47 | #:incf #:decf | |
48 | ||
49 | ;; body forms | |
50 | #:progn | |
51 | ||
171bbab3 RD |
52 | ;; object literals |
53 | #:create | |
54 | #:slot-value | |
55 | #:with-slots | |
56 | ||
57 | ;; macros | |
58 | #:macrolet | |
59 | #:symbol-macrolet | |
60 | ||
61 | ;; if | |
62 | #:if | |
63 | #:when | |
64 | #:unless | |
65 | ||
66 | ;; single argument statements | |
67 | #:return | |
68 | #:throw | |
69 | ||
70 | ;; single argument expressions | |
71 | #:delete | |
72 | #:void | |
73 | #:typeof | |
74 | #:instanceof | |
75 | #:new | |
76 | ||
77 | ;; assignment | |
78 | #:setf | |
79 | ||
80 | ;; variables | |
81 | #:defvar | |
82 | ||
83 | ;; iteration | |
84 | #:for | |
85 | #:doeach | |
86 | #:while | |
87 | ||
88 | ;; with | |
89 | #:with | |
90 | ||
91 | ;; case | |
92 | #:switch | |
93 | #:case | |
94 | #:default | |
95 | ||
96 | ;; try throw catch | |
97 | #:try | |
98 | ||
99 | ;; regex literals | |
100 | #:regex | |
101 | ||
102 | ;; conditional compilation (IE) | |
103 | #:cc-if) | |
104 | "Symbols exported from both the Parenscript and Javascript packages | |
105 | that are also valid as Parenscript symbols for the corresponding script packages.")) | |
106 | ||
107 | ||
8e198a08 | 108 | |
5aa10005 | 109 | (defpackage parenscript.javascript |
83cb67fd | 110 | (:use :common-lisp) |
5aa10005 | 111 | (:nicknames javascript ps-js) |
171bbab3 | 112 | #.(cons :export *shared-symbols-ps-js*) |
5aa10005 | 113 | (:export |
46f794a4 RD |
114 | ;; function definition |
115 | #:%js-defun | |
116 | #:%js-lambda | |
5aa10005 RD |
117 | ;; translate |
118 | #:js-to-strings | |
119 | #:js-to-statement-strings | |
120 | ) | |
121 | (:documentation "The package used to define Javascript special forms. Most of Parenscript | |
122 | is defined as macros on top of Javascript special forms")) | |
123 | ||
171bbab3 RD |
124 | (eval-when (:compile-toplevel :load-toplevel :execute) |
125 | (defparameter *parenscript-lang-exports* | |
126 | (append | |
127 | *shared-symbols-ps-js* | |
128 | '( | |
129 | ;; package system | |
130 | #:defpackage | |
131 | #:in-package | |
132 | ||
46f794a4 RD |
133 | ;; function definition |
134 | #:defun | |
135 | #:lambda | |
136 | ||
137 | ||
138 | ;; lambda lists | |
139 | #:&key | |
140 | #:&rest | |
141 | #:&body | |
142 | #:&optional | |
143 | #:&aux | |
144 | #:&environment | |
145 | ||
146 | ||
171bbab3 RD |
147 | ;; eval-when |
148 | #:eval-when | |
149 | ;; macros | |
150 | #:macrolet | |
151 | #:symbol-macrolet | |
46f794a4 RD |
152 | #:define-symbol-macro |
153 | #:define-script-symbol-macro | |
154 | #:defmacro | |
171bbab3 RD |
155 | |
156 | ;; lisp eval | |
157 | #:lisp | |
158 | ||
159 | ;; assignment | |
160 | #:setf | |
46f794a4 RD |
161 | #:defaultf |
162 | ||
171bbab3 RD |
163 | #:let |
164 | ||
165 | ;; iteration | |
166 | #:do | |
167 | #:dotimes | |
168 | #:dolist | |
169 | #:doeach | |
170 | #:while | |
171 | ||
172 | ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v | |
173 | ||
174 | ;; CSS | |
175 | #:css | |
176 | #:css-to-string | |
177 | #:css-inline | |
178 | #:css-file | |
179 | ||
171bbab3 RD |
180 | ;; html generator for javascript |
181 | #:html | |
182 | )) | |
183 | "List of (uninterned) symbols. Contains all symbols considerred | |
184 | part of the Parenscript language. These should be exported within | |
185 | both the Lisp package and the script package for Parenscript.")) | |
186 | ||
5aa10005 RD |
187 | (defpackage :parenscript |
188 | (:use :common-lisp :parenscript.javascript) | |
9da682ca | 189 | (:nicknames :js :ps) |
171bbab3 RD |
190 | #.(cons :export *shared-symbols-ps-js*) |
191 | #.(cons :export *parenscript-lang-exports*) | |
8e198a08 | 192 | (:export |
8e198a08 | 193 | ;; compiler |
9da682ca | 194 | #:compile-script |
171bbab3 | 195 | #:compile-script-file |
3199f8b6 | 196 | #:compile-script-system |
5aa10005 RD |
197 | #:compile-parenscript-file |
198 | #:compile-parenscript-file-to-string | |
9da682ca | 199 | #:script |
7590646c VS |
200 | #:script* |
201 | #:ps | |
202 | #:ps* | |
b5be3f57 VS |
203 | #:js |
204 | #:js* | |
9da682ca RD |
205 | #:with-new-compilation-environment ; tentative |
206 | #:with-compilation-environment ; tentative | |
5aa10005 RD |
207 | #:*compilation-environment* |
208 | ||
209 | ;; package system | |
210 | #:find-script-package | |
211 | #:script-intern | |
212 | #:script-export | |
213 | #:find-script-symbol | |
214 | #:comp-env-current-package | |
215 | #:symbol-script-package | |
216 | #:script-package-name | |
9da682ca RD |
217 | |
218 | ;; for parenscript macro definition within lisp | |
171bbab3 RD |
219 | #:defscriptmacro |
220 | #:defpsmacro ; should we use one or the other of these? | |
a19d2bde VS |
221 | #:defmacro/ps |
222 | #:defmacro+ps | |
ca493d55 | 223 | #:import-macros-from-lisp |
0b7a1d2f | 224 | |
7590646c VS |
225 | ;; gensym |
226 | #:with-unique-ps-names | |
227 | #:gen-script-name | |
228 | #:gen-script-name-string | |
229 | #:gen-ps-name | |
551080b7 | 230 | |
9da682ca | 231 | ;; deprecated interface |
7590646c VS |
232 | #:gen-js-name |
233 | #:gen-js-name-string | |
234 | #:with-unique-js-names | |
9da682ca RD |
235 | #:defjsmacro |
236 | #:js-compile | |
9da682ca RD |
237 | #:js-inline |
238 | #:js-inline* | |
239 | #:js-file | |
240 | #:js-script | |
9da682ca | 241 | #:js-to-statement-strings |
171bbab3 | 242 | )) |
5aa10005 RD |
243 | |
244 | (in-package :parenscript) | |
5aa10005 RD |
245 | (import |
246 | '(defscriptclass | |
247 | define-script-special-form | |
248 | defscriptmacro | |
249 | symbol-to-js | |
250 | script-quote | |
251 | *package-prefix-style* | |
252 | *script-macro-env* | |
253 | compile-to-statement | |
254 | compile-to-block | |
255 | compile-to-symbol | |
256 | compile-to-expression | |
257 | symbol-script-package | |
258 | script-package-name | |
259 | list-join | |
260 | list-to-string | |
261 | append-to-last | |
262 | prepend-to-first | |
263 | string-join | |
264 | val-to-string | |
265 | string-split | |
266 | script-special-form-p | |
267 | make-macro-env-dictionary | |
7590646c | 268 | script-equal |
5aa10005 RD |
269 | compile-script-form |
270 | ) | |
271 | :parenscript.javascript) | |
272 | ||
273 | (defpackage parenscript.reader | |
274 | (:nicknames parenscript-reader) | |
275 | (:use :common-lisp :parenscript) | |
171bbab3 RD |
276 | (:shadow #:readtablep |
277 | #:readtable-case | |
278 | #:copy-readtable | |
279 | #:get-macro-character | |
280 | #:get-dispatch-macro-character | |
281 | #:set-macro-character | |
282 | #:set-dispatch-macro-character | |
283 | #:make-dispatch-macro-character | |
284 | #:set-syntax-from-char | |
285 | #:read-preserving-whitespace | |
286 | #:read | |
287 | #:read-from-string | |
288 | #:read-delimited-list | |
289 | #:backquote-comma-dot | |
290 | #:backquote | |
291 | #:backquote-comma | |
292 | #:backquote-comma-at | |
5aa10005 | 293 | |
171bbab3 RD |
294 | #:*read-eval* |
295 | #:*read-base* | |
296 | #:*read-default-float-format* | |
297 | #:*read-suppress* | |
298 | #:*readtable* | |
299 | #:*read-suppress* | |
300 | #:*reader-error* | |
301 | #:*read-suppress* | |
5aa10005 | 302 | |
171bbab3 RD |
303 | #:readtable |
304 | #:backquote | |
305 | #:reader-error) | |
5aa10005 | 306 | (:export |
171bbab3 RD |
307 | #:read |
308 | #:read-from-string | |
309 | #:read-delimited-list) | |
310 | (:documentation "The Parenscript reader. Used for reading Parenscript | |
311 | forms.")) | |
5aa10005 RD |
312 | |
313 | (defpackage parenscript.global | |
171bbab3 | 314 | (:nicknames "GLOBAL") |
5aa10005 RD |
315 | (:documentation "Symbols interned in the global package are serialized in Javascript |
316 | as non-prefixed identifiers.")) | |
317 | ||
318 | (defpackage parenscript.user | |
171bbab3 | 319 | (:use :parenscript) |
a9fce0a7 RD |
320 | (:nicknames ps-user parenscript-user) |
321 | (:documentation "The default package a user is inside of when compiling code.")) | |
322 | ||
323 | (defpackage parenscript.asdf | |
324 | (:use :parenscript :asdf :common-lisp) | |
905f534e VS |
325 | (:documentation "ASDF extensions that help compile and use Parenscript systems.")) |
326 | ||
327 | (defpackage parenscript.non-prefixed (:nicknames ps.non-prefixed)) | |
328 | (defpackage parenscript.ps-gensyms) |