add some reader forms to the index

svn: r7769
This commit is contained in:
Matthew Flatt 2007-11-19 22:17:07 +00:00
parent 24980e41ce
commit c04cf36c29

View File

@ -508,20 +508,21 @@ A @as-index{@litchar{;}} starts a line comment. When the reader
encounters @litchar{;}, then it skips past all characters until the encounters @litchar{;}, then it skips past all characters until the
next linefeed or carriage return. next linefeed or carriage return.
A @litchar["#|"] starts a nestable block comment. When the reader A @as-index{@litchar["#|"]} starts a nestable block comment. When the
encounters @litchar["#|"], then it skips past all characters until a reader encounters @litchar["#|"], then it skips past all characters
closing @litchar["|#"]. Pairs of matching @litchar["#|"] and until a closing @litchar["|#"]. Pairs of matching @litchar["#|"] and
@litchar["|#"] can be nested. @litchar["|#"] can be nested.
A @litchar{#;} starts an S-expression comment. Then the reader A @as-index{@litchar{#;}} starts an S-expression comment. Then the
encounters @litchar{#;}, it recursively reads one datum, and then reader encounters @litchar{#;}, it recursively reads one datum, and
discards the datum (continuing on to the next datum for the read then discards the datum (continuing on to the next datum for the read
result). result).
A @litchar{#! } (which is @litchar{#!} followed by a space) or A @as-index{@litchar{#! }} (which is @litchar{#!} followed by a space)
@litchar{#!/} starts a line comment that can be continued to the next or @as-index{@litchar{#!/}} starts a line comment that can be
line by ending a line with @litchar["\\"]. This form of comment continued to the next line by ending a line with @litchar["\\"]. This
normally appears at the beginning of a Unix script file. form of comment normally appears at the beginning of a Unix script
file.
@reader-examples[ @reader-examples[
"; comment" "; comment"
@ -563,18 +564,18 @@ vector's elements are also wraped as syntax objects.
@section[#:tag "parse-hashtable"]{Reading Hash Tables} @section[#:tag "parse-hashtable"]{Reading Hash Tables}
A @litchar{#hash} starts an immutable hash-table constant with key A @as-index{@litchar{#hash}} starts an immutable hash-table constant
matching based on @scheme[equal?]. The characters after @litchar{hash} with key matching based on @scheme[equal?]. The characters after
must parse as a list of pairs (see @secref["parse-pair"]) with a @litchar{hash} must parse as a list of pairs (see
specific use of delimited @litchar{.}: it must appear between the @secref["parse-pair"]) with a specific use of delimited @litchar{.}:
elements of each pair in the list, and nowhere in the sequence of list it must appear between the elements of each pair in the list, and
elements. The first element of each pair is used as the key for a nowhere in the sequence of list elements. The first element of each
table entry, and the second element of each pair is the associated pair is used as the key for a table entry, and the second element of
value. each pair is the associated value.
A @litchar{#hasheq} starts a hash table like @litchar{#hash}, except A @as-index{@litchar{#hasheq}} starts a hash table like
that it constructs a hash table based on @scheme[eq?] instead of @litchar{#hash}, except that it constructs a hash table based on
@scheme[equal?]. @scheme[eq?] instead of @scheme[equal?].
In either case, the table is constructed by adding each mapping to the In either case, the table is constructed by adding each mapping to the
hash table from left to right, so later mappings can hide earlier hash table from left to right, so later mappings can hide earlier
@ -591,9 +592,10 @@ In either case, the table is constructed by adding each mapping to the
@section[#:tag "parse-box"]{Reading Boxes} @section[#:tag "parse-box"]{Reading Boxes}
When the reader encounters a @litchar{#&}, it starts parsing a box; When the reader encounters a @as-index{@litchar{#&}}, it starts
see @secref["boxes"] for information on boxes. The content of the box parsing a box; see @secref["boxes"] for information on boxes. The
is determined by recursively reading the next datum. content of the box is determined by recursively reading the next
datum.
In @scheme[read-syntax] mode, the recursive read for the box content In @scheme[read-syntax] mode, the recursive read for the box content
is also in @scheme[read-syntax] mode, so that the wrapped box's is also in @scheme[read-syntax] mode, so that the wrapped box's
@ -607,8 +609,8 @@ content is also wraped as a syntax object.
@guideintro["characters"]{the syntax of characters} @guideintro["characters"]{the syntax of characters}
A @litchar["#\\"] starts a character constant, which has one of the A @as-index{@litchar["#\\"]} starts a character constant, which has
following forms: one of the following forms:
@itemize{ @itemize{
@ -655,10 +657,10 @@ following forms:
@section[#:tag "parse-keyword"]{Reading Keywords} @section[#:tag "parse-keyword"]{Reading Keywords}
A @litchar{#:} starts a keyword. The parsing of a keyword after the A @as-index{@litchar{#:}} starts a keyword. The parsing of a keyword
@litchar{#:} is the same as for a symbol, including case-folding in after the @litchar{#:} is the same as for a symbol, including
case-insensitive mode, except that the part after @litchar{#:} is case-folding in case-insensitive mode, except that the part after
never parsed as a number. @litchar{#:} is never parsed as a number.
@reader-examples[ @reader-examples[
"#:Apple" "#:Apple"
@ -667,14 +669,14 @@ never parsed as a number.
@section[#:tag "parse-regexp"]{Reading Regular Expressions} @section[#:tag "parse-regexp"]{Reading Regular Expressions}
A @litchar{#rx} or @litchar{#px} starts a regular expression. The A @as-index{@litchar{#rx}} or @as-index{@litchar{#px}} starts a
characters immediately after @litchar{#rx} or @litchar{#px} must parse regular expression. The characters immediately after @litchar{#rx} or
as a string or byte string (see @secref["parse-string"]). A @litchar{#px} must parse as a string or byte string (see
@litchar{#rx} prefix starts a regular expression as would be @secref["parse-string"]). A @litchar{#rx} prefix starts a regular
constructed by @scheme[regexp], @litchar{#px} as expression as would be constructed by @scheme[regexp], @litchar{#px}
constructed by @scheme[pregexp], @litchar{#rx#} as as constructed by @scheme[pregexp], @litchar{#rx#} as constructed by
constructed by @scheme[byte-regexp], and @litchar{#px#} as @scheme[byte-regexp], and @litchar{#px#} as constructed by
constructed by @scheme[byte-pregexp]. @scheme[byte-pregexp].
@reader-examples[ @reader-examples[
"#rx\".*\"" "#rx\".*\""
@ -715,8 +717,9 @@ neither defines nor uses graph tags for other top-level forms.
@section[#:tag "parse-reader"]{Reading via an External Reader} @section[#:tag "parse-reader"]{Reading via an External Reader}
When the reader encounters @litchar{#reader}, then it loads an When the reader encounters @as-index{@litchar{#reader}}, then it loads
external reader procedure and applies it to the current input stream. an external reader procedure and applies it to the current input
stream.
The reader recursively reads the next datum after @litchar{#reader}, The reader recursively reads the next datum after @litchar{#reader},
and passes it to the procedure that is the value of the and passes it to the procedure that is the value of the
@ -740,14 +743,14 @@ If the @scheme[read-accept-reader] @tech{parameter} is set to
@scheme[#f], then if the reader encounters @litchar{#reader}, the @scheme[#f], then if the reader encounters @litchar{#reader}, the
@exnraise[exn:fail:read]. @exnraise[exn:fail:read].
The @litchar{#lang} reader form is similar, but more constrained: the The @as-index{@litchar{#lang}} reader form is similar, but more
@litchar{#lang} must be followed by a single space (ASCII 32), and constrained: the @litchar{#lang} must be followed by a single space
then a non-empty sequence of alphanumeric ASCII, @litchar{+}, (ASCII 32), and then a non-empty sequence of alphanumeric ASCII,
@litchar{-}, @litchar{_}, and/or @litchar{/} characters terminated by @litchar{+}, @litchar{-}, @litchar{_}, and/or @litchar{/} characters
@schemelink[char-whitespace?]{whitespace} or an end-of-file. The terminated by @schemelink[char-whitespace?]{whitespace} or an
sequence must not start or end with @litchar{/}. A sequence end-of-file. The sequence must not start or end with @litchar{/}. A
@litchar{#lang }@nonterm{name} is equivalent to sequence @litchar{#lang }@nonterm{name} is equivalent to
@litchar{#reader (lib "}@nonterm{name}@litchar{/lang/reader.ss")}. @litchar{#reader }@nonterm{name}@litchar{/lang/reader)}.
By convention, @litchar{#lang} normally appears at the beginning of a By convention, @litchar{#lang} normally appears at the beginning of a
file, possibly after comment forms, to specify the syntax of a module. file, possibly after comment forms, to specify the syntax of a module.