diff --git a/collects/scribble/bnf.ss b/collects/scribble/bnf.ss index 1d124ebc..4edf1290 100644 --- a/collects/scribble/bnf.ss +++ b/collects/scribble/bnf.ss @@ -8,7 +8,7 @@ (provide BNF nonterm BNF-seq - BNF-alt ; single-lie alternatives + BNF-alt BNF-alt/close ; single-line alternatives BNF-etc BNF-group optional kleenestar kleeneplus kleenerange) @@ -47,6 +47,9 @@ (define (BNF-alt . l) (interleave l alt)) + (define (BNF-alt/close . l) + (interleave l " | ")) + (define BNF-etc "...") (define/kw (nonterm #:body s) diff --git a/collects/scribble/manual.ss b/collects/scribble/manual.ss index 17628cfa..d7fcf2ea 100644 --- a/collects/scribble/manual.ss +++ b/collects/scribble/manual.ss @@ -2296,6 +2296,15 @@ [(_ super) null])) + (define (flatten-splices l) + (let loop ([l l]) + (cond + [(null? l) null] + [(splice? (car l)) + (append (splice-run (car l)) + (loop (cdr l)))] + [else (cons (car l) (loop (cdr l)))]))) + (define-syntax *defclass (syntax-rules () [(_ *include-class name super (intf ...) body ...) @@ -2315,7 +2324,7 @@ null whole-page? make-class-index-desc))) - (list body ...))))])) + (flatten-splices (list body ...)))))])) (define-syntax defclass (syntax-rules ()