From 8e5dd22426524446fbe7faf9cc0d775c83baf87c Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sun, 7 Jun 2009 10:12:32 +0000 Subject: [PATCH] The Scribble reader was improved to make it pull out the syntax punctuations outside of the form, as it does with quote punctuations. So things like this #, @foo{...} that required the space to make the @foo read as a scribble form are now better written as @#,foo{...} This changes all such occurrences. (In case you see this change in your files and are worried that there might be changes: I mechanically verified that the result of `read'ing the modified files is identical to the previous version.) svn: r15111 original commit: 4288c6c2c703664b6bbd4cd06bd7c2160985b00d --- collects/scribblings/scribble/how-to.scrbl | 6 ++-- collects/scribblings/scribble/manual.scrbl | 15 ++++---- collects/scribblings/scribble/reader.scrbl | 42 +++++++++++----------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/collects/scribblings/scribble/how-to.scrbl b/collects/scribblings/scribble/how-to.scrbl index 52e8da4d..60561926 100644 --- a/collects/scribblings/scribble/how-to.scrbl +++ b/collects/scribblings/scribble/how-to.scrbl @@ -89,7 +89,7 @@ Whether in ``text'' mode or Scheme mode, @litchar["@"] in a document provides an escape to Scheme mode. The syntax of @litchar["@"] is @schemeblock[ - #, @BNF-seq[@litchar["@"] + @#,BNF-seq[@litchar["@"] @nonterm{cmd} @litchar{[} @kleenestar{@nonterm{datum}} @litchar{]} @litchar["{"] @nonterm{text-body} @litchar["}"]] @@ -114,14 +114,14 @@ A @nonterm{cmd} or @nonterm{datum} is a Scheme datum, while a The expansion of @litchar["@"]@nonterm{cmd} into Scheme code is @schemeblock[ - #, @nonterm{cmd} + @#,nonterm{cmd} ] When either @litchar{[} @litchar{]} or @litchar["{"] @litchar["}"] are used, the expansion is @schemeblock[ - (#, @nonterm{cmd} #, @kleenestar{@nonterm{datum}} #, @kleenestar{@nonterm{parsed-body}}) + (@#,nonterm{cmd} @#,kleenestar{@nonterm{datum}} @#,kleenestar{@nonterm{parsed-body}}) ] where @kleenestar{@nonterm{parsed-body}} is the parse result of the diff --git a/collects/scribblings/scribble/manual.scrbl b/collects/scribblings/scribble/manual.scrbl index 32e28287..7da75354 100644 --- a/collects/scribblings/scribble/manual.scrbl +++ b/collects/scribblings/scribble/manual.scrbl @@ -92,8 +92,11 @@ A few other escapes are recognized symbolically: produces a paragraph using @scheme[t]: @verbatim[#:indent 2]|{ - (code:comment #, @t{this is a comment}) - }|} + (code:comment @#,t{this is a comment}) + }| + + (Note that @litchar|{@#,foo{...}}| reads as @scheme[(unsyntax (foo "..."))].) + } @item{@schemeidfont{code:blank} typesets as a blank space.} @@ -366,8 +369,8 @@ sub-sections.} (keyword arg-id contract-expr-datum default-expr) ellipses ellipses+] - [ellipses #, @lit-ellipses] - [ellipses+ #, @lit-ellipses+])]{ + [ellipses @#,lit-ellipses] + [ellipses+ @#,lit-ellipses+])]{ Produces a sequence of flow elements (encapsulated in a @scheme[splice]) to document a procedure named @scheme[id]. Nesting @@ -402,13 +405,13 @@ Each @scheme[arg-spec] must have one of the following forms: Like the previous case, but with a default value.} -@specsubform[#, @lit-ellipses]{Any number of the preceding argument. This +@specsubform[@#,lit-ellipses]{Any number of the preceding argument. This form is normally used at the end, but keyword-based arguments can sensibly appear afterward. See also the documentation for @scheme[append] for a use of @lit-ellipses before the last argument.} -@specsubform[#, @lit-ellipses+]{One or more of the preceding argument +@specsubform[@#,lit-ellipses+]{One or more of the preceding argument (normally at the end, like @lit-ellipses).} The @scheme[result-contract-expr-datum] is typeset via diff --git a/collects/scribblings/scribble/reader.scrbl b/collects/scribblings/scribble/reader.scrbl index d2e057ad..f0e5df58 100644 --- a/collects/scribblings/scribble/reader.scrbl +++ b/collects/scribblings/scribble/reader.scrbl @@ -19,8 +19,8 @@ the least-used characters in Scheme code. You can use the reader via Scheme's @schemefont{#reader} form: @schemeblock[ - #, @schemefont|{ - #reader scribble/reader @foo{This is free-form text!} + @#,schemefont|{ + #reader scribble/reader @foo{This is free-form text!} }|] or use the @scheme[at-exp] meta-language as described in @@ -60,10 +60,10 @@ function to switch the current readtable to a readtable that parses Informally, the concrete syntax of @"@"-forms is @schemeblock[ - #, @BNF-seq[@litchar["@"] - @nonterm{cmd} - @litchar{[} @kleenestar{@nonterm{datum}} @litchar{]} - @litchar["{"] @kleenestar{@nonterm{text-body}} @litchar["}"]] + @#,BNF-seq[@litchar["@"] + @nonterm{cmd} + @litchar{[} @kleenestar{@nonterm{datum}} @litchar{]} + @litchar["{"] @kleenestar{@nonterm{text-body}} @litchar["}"]] ] where all three parts after @litchar["@"] are optional, but at least @@ -71,7 +71,7 @@ one should be present. (Note that spaces are not allowed between the three parts.) Roughly, a form matching the above grammar is read as @schemeblock[ - (#, @nonterm{cmd} #, @kleenestar{@nonterm{datum}} #, @kleenestar{@nonterm{parsed-body}}) + (@#,nonterm{cmd} @#,kleenestar{@nonterm{datum}} @#,kleenestar{@nonterm{parsed-body}}) ] where @nonterm{parsed-body} is the translation of each @@ -289,9 +289,9 @@ comment. There are two comment forms, one for arbitrary-text and possibly nested comments, and another one for line comments: @schemeblock[ -#, @BNF-seq[@litchar["@;{"] @kleenestar{@nonterm{any}} @litchar["}"]] +@#,BNF-seq[@litchar["@;{"] @kleenestar{@nonterm{any}} @litchar["}"]] -#, @BNF-seq[@litchar["@;"] @kleenestar{@nonterm{anything-else-without-newline}}] +@#,BNF-seq[@litchar["@;"] @kleenestar{@nonterm{anything-else-without-newline}}] ] In the first form, the commented body must still parse correctly; see @@ -620,12 +620,12 @@ can be used to identify newlines in the original @nonterm{text-body}. @; FIXME: unfortunate code duplication (again): @interaction[ (eval:alts - (let ([nl (car #, @tt["@'{"] - #, @tt[" }"])]) + (let ([nl (car @#,tt["@'{"] + @#,tt[" }"])]) (for-each (lambda (x) (display (if (eq? x nl) "\n... " x))) - #, @tt["@`{foo"] - #, @elem[@tt[" @"] @scheme[,@(list "bar" "\n" "baz")]] - #, @tt[" blah}}"]) + @#,tt["@`{foo"] + @#,elem[@tt[" @"] @scheme[,@(list "bar" "\n" "baz")]] + @#,tt[" blah}}"]) (newline)) (let ([nl (car @'{ })]) @@ -785,7 +785,7 @@ example, implicitly quoted keywords: (cddr xs))))]))) (eval:alts (code:line - #, @tt["@foo[x 1 y (* 2 3)]{blah}"]) + @#,tt["@foo[x 1 y (* 2 3)]{blah}"]) ;; Unfortunately, expressions are preserved by `def+int' ;; using `quote', not `quote-syntax' (which would create all sorts ;; or binding trouble), so we manually re-attach the property: @@ -827,10 +827,10 @@ is an example of this. rst)])))))])) (eval:alts (code:line - #, @tt["@verb[string-append]{"] - #, @tt[" foo"] - #, @tt[" bar"] - #, @tt["}"]) + @#,tt["@verb[string-append]{"] + @#,tt[" foo"] + @#,tt[" bar"] + @#,tt["}"]) @verb[string-append]{ foo bar @@ -845,13 +845,13 @@ is an example of this. another language that is specified immediate after @schememodname[at-exp].} -For example, @scheme[#, @hash-lang[] at-exp scheme/base] adds @"@"-reader +For example, @scheme[@#,hash-lang[] at-exp scheme/base] adds @"@"-reader support to @scheme[scheme/base], so that @schememod[ at-exp scheme/base -(define (greet who) #, @elem{@tt["@"]@scheme[string-append]@schemeparenfont["{"]@schemevalfont{Hello, }@tt["@|"]@scheme[who]@tt["|"]@schemevalfont{.}@schemeparenfont["}"]}) +(define (greet who) @#,elem{@tt["@"]@scheme[string-append]@schemeparenfont["{"]@schemevalfont{Hello, }@tt["@|"]@scheme[who]@tt["|"]@schemevalfont{.}@schemeparenfont["}"]}) (greet "friend")] reports @scheme["Hello, friend."].