forked from robert-strandh/SICL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove copyright notice and untabify.
- Loading branch information
1 parent
568aff7
commit b2a7fdd
Showing
3 changed files
with
528 additions
and
564 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
;;;; Copyright (c) 2014 | ||
;;;; | ||
;;;; Robert Strandh ([email protected]) | ||
;;;; | ||
;;;; all rights reserved. | ||
;;;; | ||
;;;; Permission is hereby granted to use this software for any | ||
;;;; purpose, including using, modifying, and redistributing it. | ||
;;;; | ||
;;;; The software is provided "as-is" with no warranty. The user of | ||
;;;; this software assumes any responsibility of the consequences. | ||
|
||
(cl:in-package #:sicl-loop) | ||
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
|
@@ -35,31 +23,31 @@ | |
(multiple-value-bind (temp-vars dictionary) | ||
(fresh-variables (var-spec clause)) | ||
(reinitialize-instance clause | ||
:temp-vars temp-vars | ||
:dictionary dictionary))) | ||
:temp-vars temp-vars | ||
:dictionary dictionary))) | ||
|
||
;;; The FOR-AS-ACROSS clasue binds all the variables in the VAR-SPEC | ||
;;; of the clause, so this method should return a list of all those | ||
;;; variables. | ||
(defmethod bound-variables ((clause for-as-across)) | ||
(mapcar #'car | ||
(extract-variables (var-spec clause) nil))) | ||
(extract-variables (var-spec clause) nil))) | ||
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;;; | ||
;;; Parser | ||
|
||
(define-parser for-as-across-parser | ||
(consecutive (lambda (var type-spec across vector-form) | ||
(declare (ignore across)) | ||
(make-instance 'for-as-across | ||
:var-spec var | ||
:type-spec type-spec | ||
:vector-form vector-form)) | ||
'anything-parser | ||
'optional-type-spec-parser | ||
(keyword-parser 'across) | ||
'anything-parser)) | ||
(declare (ignore across)) | ||
(make-instance 'for-as-across | ||
:var-spec var | ||
:type-spec type-spec | ||
:vector-form vector-form)) | ||
'anything-parser | ||
'optional-type-spec-parser | ||
(keyword-parser 'across) | ||
'anything-parser)) | ||
|
||
(add-for-as-subclause-parser 'for-as-across-parser) | ||
|
||
|
@@ -74,28 +62,28 @@ | |
(defmethod final-bindings ((clause for-as-across)) | ||
`((,(length-var clause) (length ,(form-var clause))) | ||
,@(loop for (real-var) in (dictionary clause) | ||
collect `(,real-var nil)))) | ||
collect `(,real-var nil)))) | ||
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;;; | ||
;;; Compute declarations. | ||
|
||
(defmethod declarations ((clause for-as-across)) | ||
(loop with d-var-spec = (var-spec clause) | ||
with d-type-spec = (type-spec clause) | ||
for (variable type) in (extract-variables d-var-spec d-type-spec) | ||
collect `(cl:type (or null ,type) ,variable))) | ||
with d-type-spec = (type-spec clause) | ||
for (variable type) in (extract-variables d-var-spec d-type-spec) | ||
collect `(cl:type (or null ,type) ,variable))) | ||
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;;; | ||
;;; Compute prologue-form. | ||
|
||
(defmethod prologue-form ((clause for-as-across) end-tag) | ||
`(progn ,(termination-form clause end-tag) | ||
,(generate-assignments (var-spec clause) | ||
`(aref ,(form-var clause) | ||
,(index-var clause))) | ||
(incf ,(index-var clause)))) | ||
,(generate-assignments (var-spec clause) | ||
`(aref ,(form-var clause) | ||
,(index-var clause))) | ||
(incf ,(index-var clause)))) | ||
|
||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;;; | ||
|
@@ -111,6 +99,6 @@ | |
|
||
(defmethod step-form ((clause for-as-across)) | ||
`(progn ,(generate-assignments (var-spec clause) | ||
`(aref ,(form-var clause) | ||
,(index-var clause))) | ||
(incf ,(index-var clause)))) | ||
`(aref ,(form-var clause) | ||
,(index-var clause))) | ||
(incf ,(index-var clause)))) |
Oops, something went wrong.