From ba5aea8cdd800c980e9614c6142b0fdb907a088a Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 1 Jul 2009 04:45:02 +0000 Subject: [PATCH] added 'left-right/beside-side-conditions svn: r15350 --- collects/redex/pict.ss | 1 + collects/redex/private/pict.ss | 10 +++++++--- collects/redex/redex.scrbl | 9 +++++++-- doc/release-notes/redex/HISTORY.txt | 5 +++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/collects/redex/pict.ss b/collects/redex/pict.ss index 8429413073..dfa33b66e7 100644 --- a/collects/redex/pict.ss +++ b/collects/redex/pict.ss @@ -74,6 +74,7 @@ (parameter/c (symbols 'left-right 'left-right/vertical-side-conditions 'left-right/compact-side-conditions + 'left-right/beside-side-conditions 'up-down 'up-down/vertical-side-conditions 'up-down/compact-side-conditions))]) diff --git a/collects/redex/private/pict.ss b/collects/redex/private/pict.ss index 82118d5477..31597b3501 100644 --- a/collects/redex/private/pict.ss +++ b/collects/redex/private/pict.ss @@ -784,14 +784,16 @@ +inf.0))))) eqns)]) (case style - [(left-right left-right/vertical-side-conditions left-right/compact-side-conditions) + [(left-right left-right/vertical-side-conditions left-right/compact-side-conditions left-right/beside-side-conditions) (table 3 (apply append (map (lambda (lhs sc rhs linebreak?) (append (if linebreak? (list lhs (blank) (blank)) - (list lhs =-pict rhs)) + (if (and sc (eq? style 'left-right/beside-side-conditions)) + (list lhs =-pict (hbl-append 10 rhs sc)) + (list lhs =-pict rhs))) (if linebreak? (let ([p rhs]) (list (hbl-append sep @@ -802,7 +804,9 @@ (blank (max 0 (- (pict-width p) max-lhs-w sep)) 0))) null) - (if (not sc) + (if (or (not sc) + (and (not linebreak?) + (eq? style 'left-right/beside-side-conditions))) null (list (inset sc 0 0 (- 5 (pict-width sc)) 0) (blank) diff --git a/collects/redex/redex.scrbl b/collects/redex/redex.scrbl index 4a1a4b2210..8a7027cd59 100644 --- a/collects/redex/redex.scrbl +++ b/collects/redex/redex.scrbl @@ -1766,7 +1766,8 @@ label on each rule, but only in horizontal mode. Defaults to 'left-right/vertical-side-conditions 'up-down/vertical-side-conditions 'left-right/compact-side-conditions - 'up-down/compact-side-conditions)]{ + 'up-down/compact-side-conditions + 'left-right/beside-side-conditions)]{ This parameter controls the style used for typesetting metafunctions. The @scheme['left-right] style means that the @@ -1781,7 +1782,11 @@ conditions each on a separate line, instead of all on the same line. The @scheme['left-right/compact-side-conditions] and @scheme['up-down/compact-side-conditions] variants move side conditions to separate lines to avoid making the rendered form wider -than it would be otherwise.} +than it would be otherwise. + +The @scheme['left-right/beside-side-conditions] variant is like +@scheme['left-right], except it puts the side-conditions on the +same line, instead of on a new line below the case.} @defparam[metafunction-cases diff --git a/doc/release-notes/redex/HISTORY.txt b/doc/release-notes/redex/HISTORY.txt index e5b06a6c25..aede97fb27 100644 --- a/doc/release-notes/redex/HISTORY.txt +++ b/doc/release-notes/redex/HISTORY.txt @@ -9,8 +9,9 @@ v4.2.1 pattern matches are allowed, as long as the right-hand side has the same value for each different pattern binding - * added metafunction styles 'up-down/compact-side-conditions and - 'left-right/compact-side-conditions + * added metafunction styles 'up-down/compact-side-conditions, + 'left-right/compact-side-conditions, and + 'left-right/beside-side-conditions. v4.2