diff options
author | Andy Wingo <wingo@pobox.com> | 2021-02-21 20:48:15 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2021-02-21 22:09:41 +0100 |
commit | a04a024f205e1e2cd04e80c1eece649acf6e2fa8 (patch) | |
tree | e973a1316d56bf2a25342ebe07b62ec8a24e24cd /module/ice-9/psyntax.scm | |
parent | 1bba859000449a2b69c3c2872b11e8ddef5393c8 (diff) | |
download | guile-a04a024f205e1e2cd04e80c1eece649acf6e2fa8.tar.gz |
Implement read-syntax
* doc/ref/api-macros.texi (Syntax Case): Update documentation for
datum->syntax.
* module/ice-9/psyntax.scm (datum->syntax): Use #:source keyword for
source location info instead of an optional, and allow an alist.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/read.scm (%read, read): Refactor to allow read and
read-syntax to share an implementation.
(read-syntax): New function.
Diffstat (limited to 'module/ice-9/psyntax.scm')
-rw-r--r-- | module/ice-9/psyntax.scm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index c5c85fde5..061beb9cd 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -2763,7 +2763,7 @@ (nonsymbol-id? x))) (set! datum->syntax - (lambda* (id datum #:optional srcloc) + (lambda* (id datum #:key source) (make-syntax datum (if id (syntax-wrap id) @@ -2772,9 +2772,9 @@ (syntax-module id) (cons 'hygiene (module-name (current-module)))) (cond - ((not srcloc) (source-properties datum)) - ((and (list? srcloc) (and-map pair? srcloc)) srcloc) - (else (syntax-source srcloc)))))) + ((not source) (source-properties datum)) + ((and (list? source) (and-map pair? source)) source) + (else (syntax-source source)))))) (set! syntax->datum ;; accepts any object, since syntax objects may consist partially |