remove lingering format string
[clinton/parenscript.git] / src / package.lisp
1 (in-package :cl-user)
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
52 ;; object literals
53 #:create
54 #:with-slots
55
56 ;; macros
57 #:macrolet
58 #:symbol-macrolet
59
60 ;; if
61 #:if
62 #:when
63 #:unless
64
65 ;; single argument statements
66 #:return
67 #:throw
68
69 ;; single argument expressions
70 #:delete
71 #:void
72 #:typeof
73 #:instanceof
74 #:new
75
76 ;; assignment
77 #:setf
78
79 ;; variables
80 #:defvar
81
82 ;; iteration
83 #:for
84 #:doeach
85 #:while
86
87 ;; with
88 #:with
89
90 ;; case
91 #:switch
92 #:case
93 #:default
94
95 ;; try throw catch
96 #:try
97
98 ;; regex literals
99 #:regex
100
101 ;; conditional compilation (IE)
102 #:cc-if)
103 "Symbols exported from both the Parenscript and Javascript packages
104 that are also valid as Parenscript symbols for the corresponding script packages."))
105
106 (defpackage parenscript.javascript
107 (:use :common-lisp)
108 (:nicknames javascript ps-js)
109 #.(cons :export *shared-symbols-ps-js*)
110 (:export
111 ;; function definition
112 #:%js-defun
113 #:%js-lambda
114 #:%js-slot-value
115 ;; translate
116 #:js-to-strings
117 #:js-to-statement-strings
118 )
119 (:documentation "The package used to define Javascript special forms. Most of Parenscript
120 is defined as macros on top of Javascript special forms"))
121
122 (eval-when (:compile-toplevel :load-toplevel :execute)
123 (defparameter *parenscript-lang-exports*
124 (append
125 *shared-symbols-ps-js*
126 '(
127 ;; package system
128 #:defpackage
129 #:in-package
130
131 ;; function definition
132 #:defun
133 #:lambda
134
135 ;; lambda lists
136 #:&key
137 #:&rest
138 #:&body
139 #:&optional
140 #:&aux
141 #:&environment
142 #:&key-object
143 #:optional-args
144
145 ;; slot access
146 #:with-slots
147 #:slot-value
148
149 ;; eval-when
150 #:eval-when
151 ;; macros
152 #:macrolet
153 #:symbol-macrolet
154 #:define-symbol-macro
155 #:define-script-symbol-macro
156 #:defmacro
157
158 ;; lisp eval
159 #:lisp
160
161 ;; assignment
162 #:setf
163 #:defaultf
164
165 #:let
166
167 ;; iteration
168 #:do
169 #:dotimes
170 #:dolist
171 #:doeach
172 #:while
173
174 ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v
175
176 ;; CSS
177 #:css
178 #:css-to-string
179 #:css-inline
180 #:css-file
181
182 ;; html generator for javascript
183 #:html
184
185 ;; utils
186 #:do-set-timeout
187 ))
188 "List of (uninterned) symbols. Contains all symbols considerred
189 part of the Parenscript language. These should be exported within
190 both the Lisp package and the script package for Parenscript."))
191
192 (defpackage :parenscript
193 (:use :common-lisp :parenscript.javascript)
194 (:nicknames :js :ps)
195 #.(cons :export *shared-symbols-ps-js*)
196 #.(cons :export *parenscript-lang-exports*)
197 (:export
198 ;; compiler
199 #:compile-script
200 #:script
201 #:script*
202 #:ps
203 #:ps*
204 #:js
205 #:js*
206 #:with-new-compilation-environment ; tentative
207 #:with-compilation-environment ; tentative
208 #:*compilation-environment*
209
210 ;; package system
211 #:find-script-package
212 #:script-intern
213 #:script-export
214 #:find-script-symbol
215 #:comp-env-current-package
216 #:symbol-script-package
217 #:script-package-name
218
219 ;; for parenscript macro definition within lisp
220 #:defscriptmacro
221 #:defpsmacro ; should we use one or the other of these?
222 #:defmacro/ps
223 #:defmacro+ps
224 #:import-macros-from-lisp
225
226 ;; gensym
227 #:with-unique-ps-names
228 #:gen-script-name
229 #:gen-script-name-string
230 #:gen-ps-name
231
232 ;; deprecated interface
233 #:gen-js-name
234 #:gen-js-name-string
235 #:with-unique-js-names
236 #:defjsmacro
237 #:js-compile
238 #:js-inline
239 #:js-inline*
240 #:js-file
241 #:js-script
242 #:js-to-statement-strings
243 ))
244
245 (in-package :parenscript)
246 (import
247 '(defscriptclass
248 define-script-special-form
249 defscriptmacro
250 symbol-to-js
251 script-quote
252 *package-prefix-style*
253 *script-macro-env*
254 compile-to-statement
255 compile-to-block
256 compile-to-symbol
257 compile-to-expression
258 symbol-script-package
259 script-package-name
260 list-join
261 list-to-string
262 append-to-last
263 prepend-to-first
264 string-join
265 val-to-string
266 string-split
267 script-special-form-p
268 make-macro-env-dictionary
269 script-equal
270 compile-script-form
271 )
272 :parenscript.javascript)
273
274 (defpackage parenscript.global
275 (:nicknames "GLOBAL")
276 (:documentation "Symbols interned in the global package are serialized in Javascript
277 as non-prefixed identifiers."))
278
279 (defpackage parenscript.user
280 (:use :parenscript)
281 (:nicknames ps-user parenscript-user)
282 (:documentation "The default package a user is inside of when compiling code."))
283
284 (defpackage parenscript.non-prefixed (:nicknames ps.non-prefixed))
285 (defpackage parenscript.ps-gensyms)