scribble/bnf: use 'roman for all BNF metasyntax

This change solves a long-standing problem with using @nonterm{}
inside @tt{} or other constructors that change the font, where
the font would be different (and uglier) than uses outside of font
changes.

original commit: 9f68533f82df6398e59d9190a61af12c34a5a1af
This commit is contained in:
Matthew Flatt 2013-08-21 19:39:29 -06:00
parent b76ed3d3ae
commit e9c1b7dc5e

View File

@ -61,30 +61,33 @@
(interleave l alt))
(define (BNF-alt/close . l)
(interleave l " | "))
(interleave l (make-element 'roman " | ")))
(define BNF-etc "...")
(define BNF-etc (make-element 'roman "..."))
(define/kw (nonterm #:body s)
(make-element #f (append (list 'lang)
(list (make-element 'italic (decode-content s)))
(list 'rang))))
(make-element 'roman (append (list 'lang)
(list (make-element 'italic (decode-content s)))
(list 'rang))))
(define/kw (optional #:body s)
(make-element #f (append (list "[") (decode-content s) (list "]"))))
(make-element #f (append (list (make-element 'roman "["))
(decode-content s)
(list (make-element 'roman "]")))))
(define/kw (BNF-group #:body s)
(make-element #f (append (list "{")
(make-element #f (append (list (make-element 'roman "{"))
(list (apply BNF-seq (decode-content s)))
(list "}"))))
(list (make-element 'roman "}")))))
(define/kw (kleenestar #:body s)
(make-element #f (append (decode-content s) (list "*"))))
(make-element #f (append (decode-content s) (list (make-element 'roman "*")))))
(define/kw (kleeneplus #:body s)
(make-element #f (append (decode-content s) (list (make-element 'superscript (list "+"))))))
(define/kw (kleenerange a b #:body s)
(make-element #f (append (decode-content s)
(list (make-element 'superscript
(list (format "{~a,~a}" a b))))))))
(list (make-element 'roman
(make-element 'superscript
(list (format "{~a,~a}" a b)))))))))