diff options
author | Michael Gran <spk121@yahoo.com> | 2010-01-12 21:02:41 -0800 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2010-01-12 21:02:41 -0800 |
commit | dea901d66e46041f96d3d3a0f95bf0ab209387c9 (patch) | |
tree | f46c70881aac3180a26b2b716725794e3fc14269 /libguile/private-options.h | |
parent | 8470b3f45b48bf627642e8f41938492be4eacf2c (diff) |
Reader option for R6RS hex escapes
This adds a reader option 'r6rs-hex-escapes that modifies the
behavior of numeric escapes in characters and strings. When enabled,
variable-length character hex escapes (#\xNNN) are allowed and become
the default output format for numerically-escaped characters. Also,
string hex escapes switch to a semicolon terminated hex escape (\xNNNN;).
* libguile/print.c (PRINT_CHAR_ESCAPE): new macro
(iprin1): use new macro PRINT_CHAR_ESCAPE
* libguile/private-options.h (SCM_R6RS_ESCAPES_P): new #define
* libguile/read.c (scm_read_opts): add new option r6rs-hex-escapes
(SCM_READ_HEX_ESCAPE): modify to take a terminator parameter
(scm_read_string): parse R6RS hex string escapes
(scm_read_character): parse R6RS hex character escapes
* test-suite/tests/chars.test (with-read-options): new procedure
(R6RS hex escapes): new tests
* test-suite/tests/strings.test (with-read-options): new procedure
(R6RS hex escapes): new tests
Diffstat (limited to 'libguile/private-options.h')
-rw-r--r-- | libguile/private-options.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libguile/private-options.h b/libguile/private-options.h index 703ca8a5b..40d40fbd7 100644 --- a/libguile/private-options.h +++ b/libguile/private-options.h @@ -94,9 +94,13 @@ SCM_API scm_t_option scm_read_opts[]; #if SCM_ENABLE_ELISP #define SCM_ELISP_VECTORS_P scm_read_opts[4].val #define SCM_ESCAPED_PARENS_P scm_read_opts[5].val -#define SCM_N_READ_OPTIONS 6 +#endif +#define SCM_R6RS_ESCAPES_P scm_read_opts[6].val + +#if SCM_ENABLE_ELISP +#define SCM_N_READ_OPTIONS 7 #else -#define SCM_N_READ_OPTIONS 4 +#define SCM_N_READ_OPTIONS 5 #endif #endif /* PRIVATE_OPTIONS */ |