fix rendering of atomic transformers that produce strings, notably for hole

svn: r15394
This commit is contained in:
Matthew Flatt 2009-07-06 15:11:29 +00:00
parent fbad6d002a
commit ebb45abee5

View File

@ -704,13 +704,13 @@
(memq atom '(number variable variable-except variable-not-otherwise-mentioned))) (memq atom '(number variable variable-except variable-not-otherwise-mentioned)))
(list (non-terminal->token col span (format "~s" atom)))] (list (non-terminal->token col span (format "~s" atom)))]
[(symbol? atom) [(symbol? atom)
(list (or (rewrite-atomic col span atom) (list (or (rewrite-atomic col span atom literal-style)
(make-string-token col span (symbol->string atom) (literal-style))))] (make-string-token col span (symbol->string atom) (literal-style))))]
[(string? atom) [(string? atom)
(list (make-string-token col span atom (default-style)))] (list (make-string-token col span atom (default-style)))]
[else (error 'atom->tokens "unk ~s" atom)])) [else (error 'atom->tokens "unk ~s" atom)]))
(define (rewrite-atomic col span e) (define (rewrite-atomic col span e get-style)
(cond (cond
[(assoc e (atomic-rewrite-table)) [(assoc e (atomic-rewrite-table))
=> =>
@ -720,12 +720,12 @@
(let ([p (cadr m)]) (let ([p (cadr m)])
(if (procedure? p) (if (procedure? p)
(make-pict-token col span (p)) (make-pict-token col span (p))
(make-string-token col span p (non-terminal-style)))))] (make-string-token col span p (get-style)))))]
[else #f])) [else #f]))
(define (non-terminal->token col span str) (define (non-terminal->token col span str)
(let ([e (string->symbol str)]) (let ([e (string->symbol str)])
(or (rewrite-atomic col span e) (or (rewrite-atomic col span e non-terminal-style)
(make-string-token col (make-string-token col
span span
str str