diff --git a/collects/redex/pict.ss b/collects/redex/pict.ss index 10cc69a8ea..d5ebef2e4b 100644 --- a/collects/redex/pict.ss +++ b/collects/redex/pict.ss @@ -12,6 +12,7 @@ (symbols 'compact-vertical 'vertical 'vertical-overlapping-side-conditions + 'horizontal-left-align 'horizontal)) (provide reduction-rule-style/c) diff --git a/collects/redex/private/pict.ss b/collects/redex/private/pict.ss index 010ea726fb..9a97ceac3a 100644 --- a/collects/redex/private/pict.ss +++ b/collects/redex/private/pict.ss @@ -127,7 +127,7 @@ (define current-label-extra-space (make-parameter 0)) (define reduction-relation-rule-separation (make-parameter 4)) -(define (rule-picts->pict/horizontal rps) +(define ((rule-picts->pict/horizontal left-column-align) rps) (let* ([sep 2] [max-rhs (apply max 0 @@ -160,8 +160,8 @@ (blank) sep (blank) (blank) (blank)))) rps)) - (list* rtl-superimpose ctl-superimpose ltl-superimpose) - (list* rtl-superimpose ctl-superimpose ltl-superimpose) + (list* left-column-align ctl-superimpose ltl-superimpose) + (list* left-column-align ctl-superimpose ltl-superimpose) (list* sep sep (+ sep (current-label-extra-space))) 2))) (define arrow-space (make-parameter 0)) @@ -326,7 +326,10 @@ [(compact-vertical) rule-picts->pict/compact-vertical] [(vertical-overlapping-side-conditions) rule-picts->pict/vertical-overlapping-side-conditions] - [else rule-picts->pict/horizontal])) + [(horizontal-left-align) + (rule-picts->pict/horizontal ltl-superimpose)] + [else ;; horizontal + (rule-picts->pict/horizontal rtl-superimpose)])) (define (mk-arrow-pict sz style) (let ([cache (make-hash)]) diff --git a/collects/redex/redex.scrbl b/collects/redex/redex.scrbl index 20122a4d70..5d72329009 100644 --- a/collects/redex/redex.scrbl +++ b/collects/redex/redex.scrbl @@ -1672,14 +1672,17 @@ multi-line right-hand sides. This parameter controls the style used by default for the reduction relation. It can be @scheme['horizontal], where the left and -right-hand sides of the reduction rule are beside each other -or @scheme['vertical], where the left and right-hand sides of the -reduction rule are above each other. -The @scheme['compact-vertical] style moves the reduction arrow -to the second line and uses less space between lines. -Finally, in the @scheme['vertical-overlapping-side-conditions] variant, the side-conditions don't contribute to -the width of the pict, but are just overlaid on the second -line of each rule. +right-hand sides of the reduction rule are beside each other or +@scheme['vertical], where the left and right-hand sides of the +reduction rule are above each other. The @scheme['compact-vertical] +style moves the reduction arrow to the second line and uses less space +between lines. The @scheme['vertical-overlapping-side-conditions] +variant, the side-conditions don't contribute to the width of the +pict, but are just overlaid on the second line of each rule. The +@scheme['horizontal-left-align] style is like the @scheme['horizontal] +style, but the left-hand sides of the rules are aligned on the left, +instead of on the right. + } @defthing[reduction-rule-style/c flat-contract?]{