mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
add modules to syntax objects (part 1, intermediate step)
* module/ice-9/psyntax.scm (make-syntax-object): As an intermediate step to adding modules to syntax objects, replace the definition of syntax-object as a structure with an expanded-out definition that has (1) a constructor that takes 2 or 3 arguments, and (2) a predicate that works with vectors of length 3 or 4. I couldn't just redefine make-syntax-object, for example, because these are internal definitions, and we can't have duplicate bindings in a letrec.
This commit is contained in:
parent
9d80c15649
commit
1641568c33
2 changed files with 31 additions and 12 deletions
File diff suppressed because one or more lines are too long
|
@ -432,7 +432,26 @@
|
|||
(syntax-rules ()
|
||||
((_ src id) (build-annotated src (gensym (symbol->string id))))))
|
||||
|
||||
(define-structure (syntax-object expression wrap))
|
||||
;; (define-structure (syntax-object expression wrap module))
|
||||
|
||||
(define (make-syntax-object exp wrap . mod)
|
||||
(vector 'syntax-object exp wrap (if (null? mod) #f (car mod))))
|
||||
|
||||
(define (syntax-object? x)
|
||||
(and (vector? x) (> (vector-length x) 0) (eq? (vector-ref x 0) 'syntax-object)))
|
||||
|
||||
(define (syntax-object-expression x)
|
||||
(vector-ref x 1))
|
||||
(define (syntax-object-wrap x)
|
||||
(vector-ref x 2))
|
||||
(define (syntax-object-module x)
|
||||
(vector-ref x 3))
|
||||
(define (set-syntax-object-expression! x y)
|
||||
(vector-set! x 1 y))
|
||||
(define (set-syntax-object-wrap! x y)
|
||||
(vector-set! x 2 y))
|
||||
(define (set-syntax-object-module! x y)
|
||||
(vector-set! x 3 y))
|
||||
|
||||
(define-syntax unannotate
|
||||
(syntax-rules ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue