From d4c68e735944a264c82c3e700e1a61f16cd87ebf Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 17 Sep 2010 15:13:53 -0500 Subject: [PATCH] added grammar-style for the ::= and | in grammars in redex typesetting --- collects/redex/private/core-layout.rkt | 2 ++ collects/redex/private/pict.rkt | 7 ++++--- collects/redex/redex.scrbl | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/collects/redex/private/core-layout.rkt b/collects/redex/private/core-layout.rkt index 9052c98859..fd080c8e8b 100644 --- a/collects/redex/private/core-layout.rkt +++ b/collects/redex/private/core-layout.rkt @@ -18,6 +18,7 @@ lw->pict basic-text metafunction-text + grammar-style default-style label-style non-terminal-style @@ -755,6 +756,7 @@ (define non-terminal-subscript-style (make-parameter `(subscript . ,(non-terminal-style)))) (define non-terminal-superscript-style (make-parameter `(superscript . ,(non-terminal-style)))) (define default-style (make-parameter 'roman)) + (define grammar-style (make-parameter 'roman)) (define metafunction-style (make-parameter 'swiss)) (define (metafunction-text str) ((current-text) str (metafunction-style) (metafunction-font-size))) (define literal-style (make-parameter 'swiss)) diff --git a/collects/redex/private/pict.rkt b/collects/redex/private/pict.rkt index 1a87a7871e..18fac2db14 100644 --- a/collects/redex/private/pict.rkt +++ b/collects/redex/private/pict.rkt @@ -33,6 +33,7 @@ basic-text default-style + grammar-style label-style literal-style metafunction-style @@ -587,11 +588,11 @@ extensions))] [else info])))) -(define (make-::=) (basic-text " ::= " (default-style))) +(define (make-::=) (basic-text " ::= " (grammar-style))) (define (make-bar) - (basic-text " | " (default-style)) + (basic-text " | " (grammar-style)) #; - (let ([p (basic-text " | " (default-style))]) + (let ([p (basic-text " | " (grammar-style))]) (dc (λ (dc dx dy) (cond diff --git a/collects/redex/redex.scrbl b/collects/redex/redex.scrbl index 8d79cf875b..23390a502f 100644 --- a/collects/redex/redex.scrbl +++ b/collects/redex/redex.scrbl @@ -2057,6 +2057,7 @@ cases appear. If it is a list of numbers, then only the selected cases appear (c @deftogether[[ @defparam[label-style style text-style/c]{} +@defparam[grammar-style style text-style/c]{} @defparam[literal-style style text-style/c]{} @defparam[metafunction-style style text-style/c]{} @defparam[non-terminal-style style text-style/c]{} @@ -2076,7 +2077,8 @@ The @racket[label-style] is used for the reduction rule label names. The @racket[literal-style] is used for names that aren't non-terminals that appear in patterns. The @racket[metafunction-style] is used for the names of -metafunctions. +metafunctions. The @racket[grammar-style] is used for the ``::='' and ``|'' +in grammars. The @racket[non-terminal-style] is used for the names of non-terminals. Two parameters style the text in the (optional) "underscore" component @@ -2093,7 +2095,7 @@ The after the underscore in non-terminal references. The @racket[default-style] is used for parenthesis, the dot in dotted -lists, spaces, the separator words in the grammar, the +lists, spaces, the "where" and "fresh" in side-conditions, and other places where the other parameters aren't used. }