Syntax objects encapsulating Scheme datums together with source-location information.
A syntax object consists of an unwrapped syntax object together with source location information about the unwrapped syntax object. An unwrapped syntax object is either a vector whose elements are syntax objects, a pair whose car is a syntax object and whose cdr is either a syntax object or the empty list, or any other Scheme value. Converts the<datum>
recursively into a syntax object by
wrapping each piece that is not already a syntax object with the
source location information of the syntax object that is the
result of evaluating <context>
. If <context>
is
missing, the current syntactic context (see below) is used. It is
an error if the expansion of <datum>
contains any cycles.
Quasiquote
(`
), unquote
(,
),
unquote-splicing
(,@
), and ...
inside
<datum>
have the same meaning as if <datum>
appeared at the top nesting level inside a quasiquotation. The
meaning of ...
is as in the quasiquotation syntax exported
by (rapid quasiquote
).
Equivalent to (match <expr> <clause> ...)
from
(rapid match)
with the following exceptions: Firstly, the
current syntactic context in the <clause>
s is changed to
that of the result of evaluating <expr>
should it evaluate
to a syntax object. Secondly, while matching the result of
evaluating <expr>
against the clauses, syntax objects are
automatically unwrapped if needed.
Returns a source location with the fields (see below) as specified.
Returns #t
if obj
is a source location, and
#f
otherwise.
Returns the source (an arbitrary value, often a path) of the the
source-location
, identifying its source.
Returns the line number (counting from 1) of the starting position
of the source-location
.
Returns
the column number (counting from 0) of the starting position of
the source-location
.
Returns the line number (counting from 1) of the ending position
of the source-location
.
Returns the column number (counting from 0) of the ending position
of the source-location
.
Converts the source-location
into a string for use in
error messages. The format follows the
GNU
Coding Standards.
Equivalent to (source-location->string source-location)
except that the string ": "
is added to the result if it
is not the empty string.
Returns a new syntax object consisting of the unwrapped syntax
object datum
and source-location
.
Returns #t
if obj
is a source location, and
#f
otherwise.
Returns the unwrapped syntax object inside the syntax object syntax
. Returns
syntax
itself if it is not a syntax object,
Recursively apply unwrap-syntax
to the syntax object
syntax
. Moreover, unwrapped syntax objects that are
neither pairs, vectors, or lists are mapped by the procedure
strip
taking one argument and returning one value. If
strip
is not given, it defaults to a procedure returning
its argument. syntax->datum
is able to handle cycles in
syntax
.
Converts datum
recursively into a syntax object by
wrapping each piece that is not already a syntax object with the
source location information of the syntax object <ontext
.
It is an error if datum
contains cycles.
Returns #t
if obj
is a syntax error object, and
#f
otherwise.
Returns the type of syntax-error-object
. Possible types are
the symbols error
, warning
, note
, and
fatal-error
.
Returns the syntax object associated with
syntax-error-object
.
Returns the error message associated with
syntax-error-object
.
Raises a syntax error object of type error
associated
with syntax
where the error message is given by the
(rapid format)
format-string
whose escape
sequences are replaced by the objects
. The exception is
continuable. When the procedure returns, it returns #f
.
Raises a syntax error object of type warning
associated
with syntax
where the error message is given by the
(rapid format)
format-string
whose escape
sequences are replaced by the objects
. The exception is
continuable. When the procedure returns, it returns #f
.
Raises a syntax error object of type note
associated
with syntax
where the error message is given by the
(rapid format)
format-string
whose escape
sequences are replaced by the objects
. The exception is
continuable. When the procedure returns, it returns #f
.
Raises a syntax error object of type fatal-error
associated with syntax
where the error message is given by
the (rapid format)
format-string
whose escape
sequences are replaced by the objects
.
Converts the syntax-error-object
into a string for use in
error messages. The format follows the
GNU
Coding Standards.
Returns the vicinity of the source location of the
syntax-object
.
Parameter object holding the current syntactic context, a syntax
object.
Comparator used to compare syntax objects. It provides both
ordering and hash functions.