fix `codeblock' interaction with reader macros

Closes PR 11386

original commit: 090f82cc0b22077664ddf1174cc219694a55e0c7
This commit is contained in:
Matthew Flatt 2011-01-16 18:35:03 -07:00
parent 5de2c07566
commit b4e0d832da

View File

@ -68,7 +68,11 @@
[(and (identifier? e) [(and (identifier? e)
(syntax-original? e)) (syntax-original? e))
(let ([pos (sub1 (syntax-position e))]) (let ([pos (sub1 (syntax-position e))])
(list (list (to-element e) (list (list (lambda (str)
(to-element (syntax-property
e
'display-string
str)))
pos pos
(+ pos (syntax-span e)) (+ pos (syntax-span e))
1)))] 1)))]
@ -142,18 +146,22 @@
[(null? tokens) (split-lines default-color (substring* bstr pos))] [(null? tokens) (split-lines default-color (substring* bstr pos))]
[(eq? (caar tokens) 'white-space) (loop pos (cdr tokens))] [(eq? (caar tokens) 'white-space) (loop pos (cdr tokens))]
[(= pos (cadar tokens)) [(= pos (cadar tokens))
(append (let ([style (caar tokens)]) (append (let ([style (caar tokens)]
(if (symbol? style) [get-str (lambda ()
(let ([scribble-style (substring* bstr (cadar tokens) (caddar tokens)))])
(case style (cond
[(symbol) symbol-color] [(symbol? style)
[(parenthesis) paren-color] (let ([scribble-style
[(constant string) value-color] (case style
[(comment) comment-color] [(symbol) symbol-color]
[else default-color])]) [(parenthesis) paren-color]
(split-lines scribble-style [(constant string) value-color]
(substring* bstr (cadar tokens) (caddar tokens)))) [(comment) comment-color]
(list (caar tokens)))) [else default-color])])
(split-lines scribble-style (get-str)))]
[(procedure? style)
(list (style (get-str)))]
[else (list style)]))
(loop (caddar tokens) (cdr tokens)))] (loop (caddar tokens) (cdr tokens)))]
[(> pos (cadar tokens)) [(> pos (cadar tokens))
(loop pos (cdr tokens))] (loop pos (cdr tokens))]