mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-22 07:09:18 +02:00
adding support for R6RS-style \<space><newline><space> string escapes
This commit is contained in:
parent
32b17bf43e
commit
66482788ec
2 changed files with 24 additions and 3 deletions
|
@ -249,6 +249,10 @@
|
|||
#define SEXP_USE_NO_FEATURES 0
|
||||
#endif
|
||||
|
||||
#ifndef SEXP_USE_PEDANTIC
|
||||
#define SEXP_USE_PEDANTIC 0
|
||||
#endif
|
||||
|
||||
#ifndef SEXP_USE_GREEN_THREADS
|
||||
#define SEXP_USE_GREEN_THREADS ! SEXP_USE_NO_FEATURES
|
||||
#endif
|
||||
|
@ -405,6 +409,14 @@
|
|||
#define SEXP_USE_MATH SEXP_USE_FLONUMS && ! SEXP_USE_NO_FEATURES
|
||||
#endif
|
||||
|
||||
#ifndef SEXP_USE_ESCAPE_NEWLINE
|
||||
#define SEXP_USE_ESCAPE_NEWLINE ! SEXP_USE_NO_FEATURES
|
||||
#endif
|
||||
|
||||
#ifndef SEXP_USE_ESCAPE_REQUIRES_TRAILING_SEMI_COLON
|
||||
#define SEXP_USE_ESCAPE_REQUIRES_TRAILING_SEMI_COLON SEXP_USE_PEDANTIC
|
||||
#endif
|
||||
|
||||
#ifndef SEXP_USE_SELF_PARAMETER
|
||||
#define SEXP_USE_SELF_PARAMETER 1
|
||||
#endif
|
||||
|
|
15
sexp.c
15
sexp.c
|
@ -1542,11 +1542,20 @@ sexp sexp_read_string (sexp ctx, sexp in) {
|
|||
res = sexp_read_number(ctx, in, 16);
|
||||
if (sexp_fixnump(res)) {
|
||||
c = sexp_read_char(ctx, in);
|
||||
if (c == ';')
|
||||
c = sexp_unbox_fixnum(res);
|
||||
else
|
||||
if (c != ';') {
|
||||
#if SEXP_USE_ESCAPE_REQUIRES_TRAILING_SEMI_COLON
|
||||
res = sexp_read_error(ctx, "missing ; in \\x escape", SEXP_NULL, in);
|
||||
#else
|
||||
sexp_push_char(ctx, c, in);
|
||||
#endif
|
||||
}
|
||||
c = sexp_unbox_fixnum(res);
|
||||
}
|
||||
break;
|
||||
#if SEXP_USE_ESCAPE_NEWLINE
|
||||
default:
|
||||
if (isspace(c)) while (isspace(c) && c!=EOF) c=sexp_read_char(ctx, in);
|
||||
#endif
|
||||
}
|
||||
if (sexp_exceptionp(res)) break;
|
||||
} else if (c == '\n') {
|
||||
|
|
Loading…
Add table
Reference in a new issue