diff options
author | Andy Wingo <wingo@pobox.com> | 2021-02-21 11:27:32 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2021-02-21 11:35:12 +0100 |
commit | 1bba859000449a2b69c3c2872b11e8ddef5393c8 (patch) | |
tree | da35cb2f9ea8240747b324f5f949589c3bc7eadd /doc/ref/api-macros.texi | |
parent | 50d3dd83f0260f12f106ea6f4a4c95c917f420c1 (diff) | |
download | guile-1bba859000449a2b69c3c2872b11e8ddef5393c8.tar.gz |
Document datum->syntax extensions
* doc/ref/api-macros.texi (Syntax Case): Document that template-id can
be false, and document srcloc.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (syntax?): Allow the lexical context to be
null. Allow srcloc to be a source properties alist. Inspired by
Racket.
Diffstat (limited to 'doc/ref/api-macros.texi')
-rw-r--r-- | doc/ref/api-macros.texi | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/doc/ref/api-macros.texi b/doc/ref/api-macros.texi index 83345a2f5..7bcca7a2b 100644 --- a/doc/ref/api-macros.texi +++ b/doc/ref/api-macros.texi @@ -1,6 +1,6 @@ @c -*-texinfo-*- @c This is part of the GNU Guile Reference Manual. -@c Copyright (C) 1996, 1997, 2000-2004, 2009-2015, 2018 +@c Copyright (C) 1996, 1997, 2000-2004, 2009-2015, 2018, 2021 @c Free Software Foundation, Inc. @c See the file guile.texi for copying conditions. @@ -638,9 +638,19 @@ won't have access to the binding of @code{it}. But they can, if we explicitly introduce a binding via @code{datum->syntax}. -@deffn {Scheme Procedure} datum->syntax template-id datum -Create a syntax object that wraps @var{datum}, within the lexical context -corresponding to the identifier @var{template-id}. +@deffn {Scheme Procedure} datum->syntax template-id datum [srcloc] +Create a syntax object that wraps @var{datum}, within the lexical +context corresponding to the identifier @var{template-id}. If +@var{template-id} is false, the datum will have no lexical context +information. + +Syntax objects have an associated source location. @xref{Source +Properties}. If a syntax object is passed as @var{srcloc}, the +resulting syntax object will have the source properties of @var{srcloc}. +Otherwise if @var{srcloc} is a source properties alist, those will be +the source properties of the resulting syntax object. Otherwise if +@var{srcloc} is false, the source properties are computed as +@code{(source-properties @var{datum})}. @end deffn For completeness, we should mention that it is possible to strip the metadata |