11.2 Syntax Object Content
(syntax-source stx) → any |
stx : syntax? |
(syntax-line stx) → (or/c exact-positive-integer? #f) |
stx : syntax? |
(syntax-column stx) → (or/c exact-nonnegative-integer? #f) |
stx : syntax? |
(syntax-position stx) → (or/c exact-positive-integer? #f) |
stx : syntax? |
(syntax-span stx) → (or/c exact-nonnegative-integer? #f) |
stx : syntax? |
(syntax-original? stx) → boolean? |
stx : syntax? |
(syntax-source-module stx [source?]) |
→ (or/c module-path-index? symbol? path? #f) |
stx : syntax? |
source? : any/c = #f |
a symbol
a syntax pair (described below)
the empty list
an immutable vector containing syntax objects
an immutable box containing syntax objects
an immutable hash table containing syntax object values (but not necessarily syntax object keys)
an immutable prefab structure containing syntax objects
some other kind of datum—
usually a number, boolean, or string
A syntax pair is a pair containing a syntax object as its first element, and either the empty list, a syntax pair, or a syntax object as its second element.
A syntax object that is the result of read-syntax reflects the use of delimited . in the input by creating a syntax object for every pair of parentheses in the source, and by creating a pair-valued syntax object only for parentheses in the source. See Reading Pairs and Lists for more information.
(syntax->list stx) → (or/c list? #f) |
stx : syntax? |
(syntax->datum stx) → any |
stx : syntax? |
The stripping operation does not mutate stx; it creates new pairs, vectors, boxes, hash tables, and prefab structures as needed to strip lexical and source-location information recursively.
(datum->syntax ctxt v [srcloc prop cert]) → syntax? | |||||||||||||||||||||||
ctxt : (or/c syntax? #f) | |||||||||||||||||||||||
v : any/c | |||||||||||||||||||||||
| |||||||||||||||||||||||
prop : (or/c syntax? #f) = #f | |||||||||||||||||||||||
cert : (or/c syntax? #f) = #f |
Converted objects in v are given the lexical context information of ctxt and the source-location information of srcloc. If v is not already a syntax object, then the resulting immediate syntax object is given the properties (see Syntax Object Properties) of prop and the inactive certificates (see Syntax Certificates) of cert; if v is a pair, vector, box, immutable hash table, or immutable prefab structure, recursively converted values are not given properties or certificates.
Any of ctxt, srcloc, prop, or cert can be #f, in which case the resulting syntax has no lexical context, source information, new properties, and/or certificates.
If srcloc is not #f or a syntax object, it must be a list or vector of five elements:
(list source-name line column position span) or (vector source-name line column position span)
where source-name-v is an arbitrary value for the source name; line is an integer for the source line, or #f; column is an integer for the source column, or #f; position is an integer for the source position, or #f; and span is an integer for the source span, or #f. The line and column values must both be numbers or both be #f, otherwise the exn:fail:contract exception is raised.
Graph structure is not preserved by the conversion of v to a syntax object. Instead, v is essentially unfolded into a tree. If v has a cycle through pairs, vectors, boxes, immutable hash tables, and immutable prefab structures, then the exn:fail:contract exception is raised.
(identifier? v) → boolean? |
v : any/c |
(generate-temporaries stx-pair) → (listof identifier?) |
stx-pair : (or syntax? list?) |
| ||||||||||||||
id-stx : identifier? | ||||||||||||||
syms : (listof symbol?) = (list (syntax-e id-stx)) |
See also quote-syntax/prune.
(identifier-prune-to-source-module id-stx) → identifier? |
id-stx : identifier? |