|
|
@ -28,17 +28,20 @@
|
|
|
|
((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
|
|
|
|
;; 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 (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)
|
|
|
|
(let ((expansion (syntax-local-value stx (lambda () #f))))
|
|
|
|
(let ((expansion (syntax-local-value stx (lambda () #f))))
|
|
|
@ -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"
|
|
|
|