Big refactoring of the ParenScript compiler.
[clinton/parenscript.git] / src / package.lisp
CommitLineData
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
bbea4c83 13 "NIL"
171bbab3
RD
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
171bbab3
RD
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
104that are also valid as Parenscript symbols for the corresponding script packages."))
105
171bbab3
RD
106(eval-when (:compile-toplevel :load-toplevel :execute)
107 (defparameter *parenscript-lang-exports*
108 (append
109 *shared-symbols-ps-js*
110 '(
46f794a4
RD
111 ;; function definition
112 #:defun
113 #:lambda
114
46f794a4
RD
115 ;; lambda lists
116 #:&key
117 #:&rest
118 #:&body
119 #:&optional
120 #:&aux
121 #:&environment
bbea4c83 122 #:&key-object
d989d711 123 #:optional-args
46f794a4 124
bbea4c83
RD
125 ;; slot access
126 #:with-slots
127 #:slot-value
46f794a4 128
171bbab3
RD
129 ;; macros
130 #:macrolet
131 #:symbol-macrolet
46f794a4
RD
132 #:define-symbol-macro
133 #:define-script-symbol-macro
134 #:defmacro
171bbab3
RD
135
136 ;; lisp eval
137 #:lisp
138
139 ;; assignment
140 #:setf
46f794a4
RD
141 #:defaultf
142
171bbab3
RD
143 #:let
144
145 ;; iteration
146 #:do
147 #:dotimes
148 #:dolist
149 #:doeach
150 #:while
151
152 ;; v v v STUFF WE SHOULD PROBABLY MOVE TO OTHER LIBS v v v
153
154 ;; CSS
155 #:css
156 #:css-to-string
157 #:css-inline
158 #:css-file
159
171bbab3
RD
160 ;; html generator for javascript
161 #:html
dbb7017b
VS
162
163 ;; utils
164 #:do-set-timeout
171bbab3
RD
165 ))
166 "List of (uninterned) symbols. Contains all symbols considerred
167part of the Parenscript language. These should be exported within
168both the Lisp package and the script package for Parenscript."))
169
5aa10005 170(defpackage :parenscript
4a987e2b 171 (:use :common-lisp)
9da682ca 172 (:nicknames :js :ps)
171bbab3
RD
173 #.(cons :export *shared-symbols-ps-js*)
174 #.(cons :export *parenscript-lang-exports*)
8e198a08 175 (:export
8e198a08 176 ;; compiler
9da682ca 177 #:compile-script
7590646c
VS
178 #:ps
179 #:ps*
9da682ca
RD
180
181 ;; for parenscript macro definition within lisp
4a987e2b 182 #:defpsmacro
a19d2bde
VS
183 #:defmacro/ps
184 #:defmacro+ps
ca493d55 185 #:import-macros-from-lisp
0b7a1d2f 186
7590646c 187 ;; gensym
4a987e2b
VS
188 #:ps-gensym
189 #:with-ps-gensyms
190 #:*ps-gensym-counter*
551080b7 191
9da682ca 192 ;; deprecated interface
7590646c
VS
193 #:gen-js-name
194 #:gen-js-name-string
195 #:with-unique-js-names
9da682ca
RD
196 #:defjsmacro
197 #:js-compile
9da682ca
RD
198 #:js-inline
199 #:js-inline*
200 #:js-file
201 #:js-script
9da682ca 202 #:js-to-statement-strings
4a987e2b
VS
203 #:js
204 #:js*
171bbab3 205 ))
5aa10005 206