diff options
author | Mark H Weaver <mhw@netris.org> | 2014-01-12 07:55:22 -0500 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2014-01-14 20:23:21 -0500 |
commit | dc59631d3094ad39bba5e40d5c36200fb99023f9 (patch) | |
tree | 8448ce41b34541c89edecdee8e841fde77a2b5eb /doc/ref/api-data.texi | |
parent | b306fae0abe38aac6fede98727a47f57a4ba992f (diff) | |
download | guile-dc59631d3094ad39bba5e40d5c36200fb99023f9.tar.gz |
read: Support R7RS |...| symbol notation.
* libguile/private-options.h (SCM_R7RS_SYMBOLS_P): New macro.
(SCM_N_READ_OPTIONS): Increment.
* libguile/read.c (scm_read_opts): Add entry for 'r7rs-symbols'.
(t_read_opts): Add field for 'r7rs_symbols_p'.
(scm_read_string_like_syntax): New function based on earlier
'scm_read_string' that handles either string literals or R7RS quoted
symbols (delimited by vertical bars), depending on the value of 'chr'.
(scm_read_string): Reimplement based on 'scm_read_string_like_syntax'.
(scm_read_r7rs_symbol): New static function.
* doc/ref/api-data.texi (Symbol Read Syntax): Briefly describe the R7RS
symbol syntax, mention the 'r7rs-symbols' read option, and give some
examples.
* doc/ref/api-evaluation.texi (Scheme Read): Mention the 'r7rs-symbols'
read option.
* test-suite/tests/reader.test ("reading"): Add test.
Diffstat (limited to 'doc/ref/api-data.texi')
-rw-r--r-- | doc/ref/api-data.texi | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index e711402f4..9fd353d75 100644 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -5575,6 +5575,16 @@ Although Guile provides this extended read syntax for symbols, widespread usage of it is discouraged because it is not portable and not very readable. +Alternatively, if you enable the @code{r7rs-symbols} read option (see +@pxref{Scheme Read}), you can write arbitrary symbols using the same +notation used for strings, except delimited by vertical bars instead of +double quotes. + +@example +|foo bar| +|\x3BB; is a greek lambda| +|\| is a vertical bar| +@end example @node Symbol Uninterned @subsubsection Uninterned Symbols |