diff options
author | Jim Blandy <jimb@red-bean.com> | 1997-05-27 23:58:26 +0000 |
---|---|---|
committer | Jim Blandy <jimb@red-bean.com> | 1997-05-27 23:58:26 +0000 |
commit | 50a095f1c8972cc4fbad6bbefa941e96529ca281 (patch) | |
tree | beec549e3c34ab84f3f1748d4ceb20554e0b78da /libguile | |
parent | 995685aa709bcfeb2121acd1454e3e15357e484c (diff) | |
download | guile-50a095f1c8972cc4fbad6bbefa941e96529ca281.tar.gz |
Add new R4RS-compliant syntax for keywords.
* read.c (scm_lreadr): Recognize `#:' as a prefix for keywords,
regardless of the setting of the `keywords' read option.
* kw.c (prin_kw): Print keywords using the `#:' syntax, so they
can be re-read no matter what the setting of the `keywords' read
option.
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/kw.c | 2 | ||||
-rw-r--r-- | libguile/read.c | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/libguile/kw.c b/libguile/kw.c index 73ee17fe6..e60cba90f 100644 --- a/libguile/kw.c +++ b/libguile/kw.c @@ -68,7 +68,7 @@ prin_kw (exp, port, pstate) SCM port; scm_print_state *pstate; { - scm_gen_puts (scm_regular_string, ":", port); + scm_gen_puts (scm_regular_string, "#:", port); scm_gen_puts((SCM_MB_STRINGP(SCM_CDR (exp)) ? scm_mb_string : scm_regular_string), diff --git a/libguile/read.c b/libguile/read.c index c5eac9edf..db5742f71 100644 --- a/libguile/read.c +++ b/libguile/read.c @@ -399,6 +399,13 @@ tryagain_no_flush_ws: return SCM_MAKICHR (scm_charnums[c]); scm_wta (SCM_UNDEFINED, "unknown # object: #\\", SCM_CHARS (*tok_buf)); + /* #:SYMBOL is a syntax for keywords supported in all contexts. */ + case ':': + j = scm_read_token ('-', tok_buf, port, 0); + p = scm_intern (SCM_CHARS (*tok_buf), j); + if (SCM_PORT_REPRESENTATION (port) != scm_regular_port) + scm_set_symbol_multi_byte_x (SCM_CAR (p), SCM_BOOL_T); + return scm_make_keyword_from_dash_symbol (SCM_CAR (p)); default: callshrp: |