Skip to content

Commit 65b90be

Browse files
committed
fix derivations/ps
closes #259
1 parent 2442037 commit 65b90be

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

redex-gui-lib/redex/private/show-derivations.rkt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@
131131
(define derivation-pb%
132132
(class pasteboard%
133133

134+
;; this method is called to give the pasteboard a
135+
;; chance to relayout its snips based on font size
136+
(define/public (re-run-layout) (void))
137+
134138
(init-field pp racket-colors?)
135139
(define root-snip #f)
136140
(define/public (set-root ts) (set! root-snip ts))

redex-test/redex/tests/color-test.rkt

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ as you reduce you expect to see a spectrum from blue to red
99
1010
In the other window, you expect to see the currently unreducted terms in green and all others white.
1111
12-
Also just tests that the stepper works. The third window is a stepper window.
12+
Also just tests that the stepper and show-derivations work. The third window is a stepper window.
1313
Expect the second step to split and show two steps.
1414
1515
|#
1616

1717
(require redex/reduction-semantics
1818
redex/gui
1919
racket/gui/base
20-
racket/class)
20+
racket/class
21+
racket/file)
2122

2223
(module test racket/base)
2324

@@ -94,3 +95,31 @@ Expect the second step to split and show two steps.
9495
(--> 0 zero)
9596
(--> (any) (any any) "not-computed"))
9697
0))
98+
99+
(let ()
100+
(define-language L
101+
(e ::= (e e) n)
102+
(n ::= natural))
103+
(define-judgment-form L
104+
#:mode (J I O)
105+
[-------
106+
(J n n)]
107+
108+
[(J e_1 n_1) (J e_2 n_2)
109+
----------------------------------------
110+
(J (e_1 e_2) ,(+ (term n_1) (term n_2)))])
111+
(show-derivations
112+
(build-derivations
113+
(J (0 ((((1 2) (3 4)) ((5 6) (7 8))) ((9 10) (11 12)))) 78))))
114+
115+
116+
(let ([tmp.ps (make-temporary-file "redex-derivations-ps-test~a.ps")])
117+
(dynamic-wind
118+
void
119+
(λ () (derivation/ps
120+
(derivation '(P foo) "foo"
121+
(list (derivation '(P foo) "foo" '())
122+
(derivation '(P foo) "foo" '())))
123+
tmp.ps))
124+
(λ ()
125+
(delete-file tmp.ps))))

0 commit comments

Comments
 (0)