|
51 | 51 | (defclass it-form (ast)
|
52 | 52 | ())
|
53 | 53 |
|
54 |
| -(defclass for-as-in-list-clause (ast <with-binding-form>) |
| 54 | +(defclass <for-as-in-on-list-clause> (ast <with-binding-form>) |
55 | 55 | ((binding :initarg :binding
|
56 | 56 | :reader ast-binding)
|
57 |
| - (in :initarg :in |
58 |
| - :reader ast-in) |
| 57 | + (in-on :initarg :in-on |
| 58 | + :reader ast-in-on) |
59 | 59 | (by :initarg :by
|
60 | 60 | :reader ast-by)))
|
61 | 61 |
|
| 62 | +(defclass for-as-in-list-clause (<for-as-in-on-list-clause>) ()) |
| 63 | +(defclass for-as-on-list-clause (<for-as-in-on-list-clause>) ()) |
| 64 | + |
62 | 65 | (defun walk-d-var-spec (walker d-var-spec env path)
|
63 | 66 | (cond ((null d-var-spec)
|
64 | 67 | '())
|
|
194 | 197 | (cond ((accept :in)
|
195 | 198 | (for-as-in-list binding))
|
196 | 199 | ((accept :on)
|
197 |
| - (for-as-on-list)) |
| 200 | + (for-as-on-list binding)) |
198 | 201 | ((accept :=)
|
199 | 202 | (for-as-equals-then))
|
200 | 203 | ((accept :across)
|
|
206 | 209 | ;; TODO: error
|
207 | 210 | ;; TODO: from, to, downfrom, downto, above, by
|
208 | 211 | )))))
|
209 |
| - (for-as-in-list (binding) |
| 212 | + |
| 213 | + (for-as-in-on-list (ast-class binding) |
210 | 214 | (let* ((for-pos (- pos 2))
|
211 | 215 | (in (walk walker (next) env (cons (+ for-pos 3) path)))
|
212 | 216 | (by (when (accept :by)
|
213 | 217 | (walk walker (next) env (cons (+ for-pos 5) path)))))
|
214 |
| - (push (make-instance 'for-as-in-list-clause |
| 218 | + (push (make-instance ast-class |
215 | 219 | :path (cons (+ for-pos 1) path)
|
216 | 220 | :binding binding
|
217 |
| - :in in |
| 221 | + :in-on in |
218 | 222 | :by by)
|
219 | 223 | for-as-clauses)
|
220 | 224 | (setf env (extend-env env binding))))
|
221 |
| - (for-as-on-list () |
222 |
| - ;; TODO |
223 |
| - ) |
| 225 | + (for-as-in-list (binding) |
| 226 | + (for-as-in-on-list 'for-as-in-list-clause binding)) |
| 227 | + (for-as-on-list (binding) |
| 228 | + (for-as-in-on-list 'for-as-on-list-clause binding)) |
224 | 229 | (for-as-equals-then ()
|
225 | 230 | ;; TODO
|
226 | 231 | )
|
|
290 | 295 | (defmethod visit (visitor (ast it-form))
|
291 | 296 | nil)
|
292 | 297 |
|
293 |
| -(defmethod visit (visitor (ast for-as-in-list-clause)) |
294 |
| - (visit visitor (ast-in ast)) |
| 298 | +(defmethod visit (visitor (ast <for-as-in-on-list-clause>)) |
| 299 | + (visit visitor (ast-in-on ast)) |
295 | 300 | (when (ast-by ast) (visit visitor (ast-by ast))))
|
296 | 301 |
|
297 | 302 | (defmethod visit (visitor (ast simple-loop-form))
|
|
0 commit comments