Reader option for R6RS hex escapes
authorMichael Gran <spk121@yahoo.com>
Wed, 13 Jan 2010 05:02:41 +0000 (21:02 -0800)
committerMichael Gran <spk121@yahoo.com>
Wed, 13 Jan 2010 05:02:41 +0000 (21:02 -0800)
commitdea901d66e46041f96d3d3a0f95bf0ab209387c9
treef46c70881aac3180a26b2b716725794e3fc14269
parent8470b3f45b48bf627642e8f41938492be4eacf2c
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
libguile/print.c
libguile/private-options.h
libguile/read.c
test-suite/tests/chars.test
test-suite/tests/strings.test