update documentation for preserved syntax-object source locations

This commit is contained in:
Matthew Flatt 2015-09-02 12:55:44 -06:00
parent fb8e08a2ac
commit efe056f18d
3 changed files with 20 additions and 17 deletions

View File

@ -594,9 +594,13 @@ binding, constructor, etc.}
@defstruct+[(stx-obj zo)
([datum any/c]
[wrap wrap?]
[srcloc (or/c #f srcloc?)]
[props (hash/c symbol? any/c)]
[tamper-status (or/c 'clean 'armed 'tainted)])]{
Represents a syntax object, where @racket[wrap] contains lexical
information and @racket[tamper-status] is taint information. When the
information, @racket[srcloc] is the source location,
@racket[props] contains preserved properties,
and @racket[tamper-status] is taint information. When the
@racket[datum] part is itself compound, its pieces are wrapped
as @racket[stx-obj]s, too.

View File

@ -38,9 +38,7 @@ Returns @racket[#t] if @racket[v] is a @tech{syntax object} and
Returns the source for the @tech{syntax object} @racket[stx], or @racket[#f]
if none is known. The source is represented by an arbitrary value
(e.g., one passed to @racket[read-syntax]), but it is typically a file
path string. Source-location information is dropped for a syntax
object that is marshaled as part of compiled code; see also
@racket[current-compile].}
path string.}
@defproc[(syntax-line [stx syntax?])
@ -50,8 +48,7 @@ Returns the line number (positive exact integer) for the start of the
@tech{syntax object} in its source, or @racket[#f] if the line number or
source is unknown. The result is @racket[#f] if and only if
@racket[(syntax-column stx)] produces @racket[#f]. See also
@secref["linecol"], and see @racket[syntax-source] for information
about marshaling compiled @tech{syntax object}s.}
@secref["linecol"].}
@defproc[(syntax-column [stx syntax?])
@ -61,8 +58,7 @@ Returns the column number (non-negative exact integer) for the start
of the @tech{syntax object} in its source, or @racket[#f] if the source
column is unknown. The result is @racket[#f] if and only if
@racket[(syntax-line stx)] produces @racket[#f]. See also
@secref["linecol"], and see @racket[syntax-source] for information
about marshaling compiled @tech{syntax object}s.}
@secref["linecol"].}
@defproc[(syntax-position [stx syntax?])
@ -70,9 +66,7 @@ about marshaling compiled @tech{syntax object}s.}
Returns the character position (positive exact integer) for the start
of the @tech{syntax object} in its source, or @racket[#f] if the source
position is unknown. See also @secref["linecol"], and see
@racket[syntax-source] for information about marshaling compiled
@tech{syntax object}s.}
position is unknown. See also @secref["linecol"].}
@defproc[(syntax-span [stx syntax?])
@ -80,8 +74,7 @@ position is unknown. See also @secref["linecol"], and see
Returns the span (non-negative exact integer) in characters of the
@tech{syntax object} in its source, or @racket[#f] if the span is
unknown. See also @racket[syntax-source] for information about
marshaling compiled @tech{syntax object}s.}
unknown.}
@defproc[(syntax-original? [stx syntax?]) boolean?]{
@ -95,14 +88,19 @@ object was introduced by a syntax transformer; see
This predicate can be used to distinguish @tech{syntax object}s in an expanded
expression that were directly present in the original expression, as
opposed to @tech{syntax object}s inserted by macros.}
opposed to @tech{syntax object}s inserted by macros.
The (hidden) property to represent original syntax is dropped for a
syntax object that is marshaled as part of compiled code; see also
@racket[current-compile].}
@defproc[(syntax-source-module [stx syntax?] [source? any/c #f])
(or/c module-path-index? symbol? path? resolved-module-path? #f)]{
Returns an indication of the module whose source contains
@racket[stx], or @racket[#f] if @racket[stx] has no source module. If
@racket[stx], or @racket[#f] if no source module for @racket[stx]
can be inferred from its lexical context. If
@racket[source?] is @racket[#f], then result is a module path index or
symbol (see @secref["modpathidx"]) or a @tech{resolved module path}; if @racket[source?] is true, the
result is a path or symbol corresponding to the loaded module's

View File

@ -6,8 +6,9 @@
Every syntax object has an associated @deftech{syntax property} list,
which can be queried or extended with
@racket[syntax-property]. Properties are not preserved for a
@racket[syntax-quoted] syntax object in a compiled form that is
marshaled to a byte string.
syntax object in a compiled form that is
marshaled to a byte string or @filepath{.zo} file, except for a @racket['paren-shape]
property value of @racket[#\[] or @racket[#\{].
In @racket[read-syntax], the reader attaches a @racket['paren-shape]
property to any pair or vector syntax object generated from parsing a