Skip to content

Commit f090a66

Browse files
committed
convert picts from rewriters into rhombus picts
1 parent 7afb307 commit f090a66

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

redex-pict-lib/redex/private/core-layout.rkt

+3-3
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@
610610

611611
;; split-out : number pict (listof line) -> (listof line)
612612
(define (split-out col pict lines)
613-
(let ([new-token (make-pict-token col 0 pict)])
613+
(let ([new-token (make-pict-token col 0 (pict-convertible->pict pict))])
614614
(let loop ([lines lines])
615615
(cond
616616
[(null? lines)
@@ -768,7 +768,7 @@
768768
(define (atom->tokens col span atom all-nts unquoted?)
769769
(cond
770770
[(pict-convertible? atom)
771-
(list (make-pict-token col span atom))]
771+
(list (make-pict-token col span (pict-convertible->pict atom)))]
772772
[unquoted?
773773
(list (make-pict-token col span
774774
(pink-background
@@ -828,7 +828,7 @@
828828
(define str/pict/sym (apply-atomic-rewrite e))
829829
(cond
830830
[(string? str/pict/sym) (make-string-token col span str/pict/sym (get-style))]
831-
[(pict-convertible? str/pict/sym) (make-pict-token col span str/pict/sym)]
831+
[(pict-convertible? str/pict/sym) (make-pict-token col span (pict-convertible->pict str/pict/sym))]
832832
[(symbol? str/pict/sym) #f]))
833833

834834
(define (parse-subscript after-underscore)

redex-pict-lib/redex/private/pict-interface.rkt

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
#lang racket
2+
#|
3+
4+
This file exports functions that have the same interface as the functions
5+
in racket's pict library but, if rhombus is available, actually build
6+
rhombus picts. No other file in redex should depend on the racket
7+
pict library.
8+
9+
|#
10+
211
(require (for-syntax syntax/parse racket/syntax)
312
(only-in pict/convert pict-convertible?)
413
(prefix-in p: pict)
5-
pict)
14+
pict/convert)
615

716
(define-syntax (define-rhombus stx)
817
(syntax-parse stx
@@ -50,6 +59,19 @@
5059
(define (to-rhm-pict p)
5160
(choose p (r:from_handle p)))
5261

62+
;; we need this function to make sure that, when we're in rhombus mode
63+
;; we actually work only with rhombus picts, as rhombus pict functions
64+
;; don't implicitly do pict-convertible conversion
65+
(provide pict-convertible->pict)
66+
(define (pict-convertible->pict p)
67+
(choose
68+
(pict-convert p)
69+
(cond
70+
[(p:pict? p)
71+
(to-rhm-pict p)]
72+
[(pict-convertible? p)
73+
(to-rhm-pict (pict-convert p))])))
74+
5375
(provide dc
5476
blank
5577
text

0 commit comments

Comments
 (0)