*** empty log message ***

original commit: 27620ae4971368a800168f028b47d844efd615ef
tokens
Scott Owens 20 years ago
parent d40da544f7
commit 4f08438adf

@ -164,7 +164,10 @@
((_ name-form body-form) ((_ name-form body-form)
(let-values (((name body) (let-values (((name body)
(normalize-definition (syntax (define-syntax name-form body-form)) #'lambda))) (normalize-definition (syntax (define-syntax name-form body-form)) #'lambda)))
#`(define-syntax #,name (make-lex-trans #,body)))) #`(define-syntax #,name
(let ((certifier (syntax-local-certifier)))
(make-lex-trans (lambda (stx)
(certifier (#,body stx) 'a)))))))
(_ (_
(raise-syntax-error (raise-syntax-error
#f #f

@ -34,8 +34,9 @@
;; Expands lex-abbrevs and applies lex-trans. ;; Expands lex-abbrevs and applies lex-trans.
(define (parse stx disappeared-uses) (define (parse stx disappeared-uses)
(let ((parse (let ((parse
(lambda (stx) (lambda (s)
(parse stx disappeared-uses)))) (parse (syntax-recertify s stx (current-inspector) 'a)
disappeared-uses))))
(syntax-case stx (repetition union intersection complement concatenation (syntax-case stx (repetition union intersection complement concatenation
char-range char-complement) char-range char-complement)
(_ (_
@ -111,7 +112,9 @@
((op form ...) ((op form ...)
(identifier? (syntax op)) (identifier? (syntax op))
(let* ((o (syntax op)) (let* ((o (syntax op))
(expansion (syntax-local-value o (lambda () #f)))) (expansion (syntax-local-value
(syntax-recertify o stx (current-inspector) 'a)
(lambda () #f))))
(set-box! disappeared-uses (cons o (unbox disappeared-uses))) (set-box! disappeared-uses (cons o (unbox disappeared-uses)))
(cond (cond
((lex-trans? expansion) ((lex-trans? expansion)

@ -73,7 +73,7 @@
#`(define (#,(make-ctor-name n) x) #`(define (#,(make-ctor-name n) x)
(make-token '#,n x)))) (make-token '#,n x))))
(syntax->list (syntax (token ...)))) (syntax->list (syntax (token ...))))
(define-syntax marked-token #f) ...)))) (define marked-token #f) ...))))
((_ ...) ((_ ...)
(raise-syntax-error (raise-syntax-error
#f #f

@ -12,14 +12,6 @@
(listof identifier?) (union syntax? false?) syntax?) . ->* . (listof identifier?) (union syntax? false?) syntax?) . ->* .
(any? any? any? any?)))) (any? any? any? any?))))
(define (strip so)
(syntax-local-introduce
(datum->syntax-object
#f
(syntax-object->datum so)
so
so)))
;; fix-check-syntax : (listof identifier?) (listof identifier?) (listof identifier?) ;; fix-check-syntax : (listof identifier?) (listof identifier?) (listof identifier?)
;; (union syntax? false?) syntax?) -> syntax? ;; (union syntax? false?) syntax?) -> syntax?
(define (fix-check-syntax input-terms start end assocs prods) (define (fix-check-syntax input-terms start end assocs prods)
@ -36,8 +28,7 @@
(syntax-case prods () (syntax-case prods ()
(((_ rhs ...) ...) (((_ rhs ...) ...)
(syntax->list (syntax (rhs ... ...))))))) (syntax->list (syntax (rhs ... ...)))))))
(with-syntax (((tmp ...) term-binders) (with-syntax (((term-group ...)
((term-group ...)
(map (lambda (tg) (map (lambda (tg)
(syntax-property (syntax-property
(datum->syntax-object tg #f) (datum->syntax-object tg #f)
@ -46,9 +37,12 @@
input-terms)) input-terms))
((end ...) ((end ...)
(map get-term-binder end)) (map get-term-binder end))
((start ...)
(map get-term-binder start))
((bind ...) ((bind ...)
(syntax-case prods () (syntax-case prods ()
(((bind _ ...) ...) (syntax->list (syntax (bind ...)))))) (((bind _ ...) ...)
(syntax->list (syntax (bind ...))))))
(((bound ...) ...) (((bound ...) ...)
(map (map
(lambda (rhs) (lambda (rhs)
@ -69,8 +63,8 @@
(syntax->list (syntax (term ... ...)))))) (syntax->list (syntax (term ... ...))))))
null))) null)))
#`(when #f #`(when #f
(let ((bind void) ... (tmp void) ...) (let ((bind void) ...)
(void bound ... ... term-group ... end ... prec ...)))))) (void bound ... ... term-group ... start ... end ... prec ...))))))
(define (build-parser filename src-pos suppress input-terms start end assocs prods) (define (build-parser filename src-pos suppress input-terms start end assocs prods)
(let* ((grammar (parse-input input-terms start end assocs prods src-pos)) (let* ((grammar (parse-input input-terms start end assocs prods src-pos))

Loading…
Cancel
Save