remove syntax certificates; add syntax taints

original commit: 1160d3df629ce65eb8fe9ebea2c33b8d4000ea50
tokens
Matthew Flatt 14 years ago
parent 616c2649fd
commit f8081d0175

@ -189,14 +189,12 @@
(normalize-definition (syntax (define-syntax name-form body-form)) #'lambda))) (normalize-definition (syntax (define-syntax name-form body-form)) #'lambda)))
#`(define-syntax #,name #`(define-syntax #,name
(let ((certifier (syntax-local-certifier)) (let ((func #,body))
(func #,body))
(unless (procedure? func) (unless (procedure? func)
(raise-syntax-error 'define-lex-trans "expected a procedure as the transformer, got ~e" func)) (raise-syntax-error 'define-lex-trans "expected a procedure as the transformer, got ~e" func))
(unless (procedure-arity-includes? func 1) (unless (procedure-arity-includes? func 1)
(raise-syntax-error 'define-lex-trans "expected a procedure that accepts 1 argument as the transformer, got ~e" func)) (raise-syntax-error 'define-lex-trans "expected a procedure that accepts 1 argument as the transformer, got ~e" func))
(make-lex-trans (lambda (stx) (make-lex-trans func)))))
(certifier (func stx) 'a)))))))
(_ (_
(raise-syntax-error (raise-syntax-error
#f #f

@ -331,6 +331,7 @@ characters, @racket[char-lower-case?] characters, etc.}
_datum ...)] appears as a regular expression, it is replaced with _datum ...)] appears as a regular expression, it is replaced with
the result of applying the transformer to the expression.} the result of applying the transformer to the expression.}
@; ---------------------------------------- @; ----------------------------------------
@subsection{Lexer SRE Operators} @subsection{Lexer SRE Operators}

@ -28,6 +28,9 @@
((char-range-arg #'#\1 #'here) (char->integer #\1)) ((char-range-arg #'#\1 #'here) (char->integer #\1))
((char-range-arg #'"1" #'here) (char->integer #\1))) ((char-range-arg #'"1" #'here) (char->integer #\1)))
(define orig-insp (current-code-inspector))
(define (disarm stx)
(syntax-disarm stx orig-insp))
;; parse : syntax-object (box (list-of syntax-object)) -> s-re (see re.ss) ;; parse : syntax-object (box (list-of syntax-object)) -> s-re (see re.ss)
;; checks for errors and generates the plain s-exp form for s ;; checks for errors and generates the plain s-exp form for s
@ -35,9 +38,9 @@
(define (parse stx disappeared-uses) (define (parse stx disappeared-uses)
(let ((parse (let ((parse
(lambda (s) (lambda (s)
(parse (syntax-recertify s stx (current-inspector) 'a) (parse (syntax-rearm s stx)
disappeared-uses)))) disappeared-uses))))
(syntax-case stx (repetition union intersection complement concatenation (syntax-case (disarm stx) (repetition union intersection complement concatenation
char-range char-complement) char-range char-complement)
(_ (_
(identifier? stx) (identifier? stx)
@ -112,13 +115,11 @@
((op form ...) ((op form ...)
(identifier? (syntax op)) (identifier? (syntax op))
(let* ((o (syntax op)) (let* ((o (syntax op))
(expansion (syntax-local-value (expansion (syntax-local-value o (lambda () #f))))
(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)
(parse ((lex-trans-f expansion) stx))) (parse ((lex-trans-f expansion) (disarm stx))))
(expansion (expansion
(raise-syntax-error 'regular-expression (raise-syntax-error 'regular-expression
"not a lex-trans" "not a lex-trans"

Loading…
Cancel
Save