Added several new utility macros, including a primitive DESTRUCTURING-BIND.
[clinton/parenscript.git] / src / package.lisp
CommitLineData
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
352621e1 199 ;; js runtime utils
c72e87d8
VS
200 #:*ps-lisp-library*
201 #:mapcar
352621e1
VS
202 #:map-into
203 #:map
204 #:map-until
205 #:member
206 #:append
207 #:set-difference
b73376a5
TC
208 ))
209 (defparameter *parenscript-interface-exports*
210 '(;; compiler
211 #:compile-script
212 #:ps
213 #:ps-doc
157cb2d6 214 #:ps-doc*
b73376a5 215 #:ps*
cb8f8e58 216 #:ps1*
b73376a5
TC
217 #:ps-inline
218 #:ps-inline*
219
220 ;; for parenscript macro definition within lisp
221 #:defpsmacro
222 #:defmacro/ps
223 #:defmacro+ps
224 #:import-macros-from-lisp
225
226 ;; gensym
227 #:ps-gensym
228 #:with-ps-gensyms
229 #:ps-once-only
230 #:*ps-gensym-counter*
231
232 ;; naming and namespaces
233 #:ps-package-prefix
234 #:obfuscate-package
235 #:unobfuscate-package
236
237 ;; printer
6274a448 238 #:symbol-to-js-string
b73376a5
TC
239 #:*js-string-delimiter*
240 #:*js-inline-string-delimiter*
241 #:*ps-print-pretty*
242 #:*indent-num-spaces*
243 ))
244 (defparameter *parenscript-interface-deprecated-exports*
245 '(;; deprecated interface
b65b21c2 246 #:define-script-symbol-macro
b73376a5
TC
247 #:gen-js-name
248 #:with-unique-js-names
249 #:defjsmacro
250 #:js-compile
251 #:js-inline
252 #:js-inline*
253 #:js
254 #:js*
ffb6d061 255 #:symbol-to-js
b73376a5 256 ))
e8fdcce7
VS
257
258 (defparameter *javascript-exports*
259 '(;; for representing js code as s-expressions
260 #:?
261 #:if
262 #:unary-operator
263 #:--
0ce67a33
VS
264 #:!
265 #:block
266 #:literal
267 #:break
268 #:continue
269 #:return
270 #:throw
271 #:array
272 #:aref
273 #:++
274 #:+=
275 #:operator
276 #:-=
277 #:-
278 #:=
279 #:cond
280 #:lambda
281 #:object
282 #:variable
283 #:slot-value
284 #:new
285 #:funcall
286 #:instanceof
287 #:in
288 #:escape
e8fdcce7 289 ))
b73376a5 290 )
171bbab3 291
e8fdcce7
VS
292(defpackage "PARENSCRIPT"
293 (:use "COMMON-LISP")
294 (:nicknames "JS" "PS")
171bbab3 295 #.(cons :export *parenscript-lang-exports*)
b73376a5
TC
296 #.(cons :export *parenscript-interface-exports*)
297 #.(cons :export *parenscript-interface-deprecated-exports*)
e8fdcce7 298 #.(cons :export *javascript-exports*)
b73376a5 299 )
f326f929 300