mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 06:09:18 +02:00
adding #| ... |# comment support
This commit is contained in:
parent
ed86eafb13
commit
ea9255e934
1 changed files with 18 additions and 0 deletions
18
sexp.c
18
sexp.c
|
@ -2212,6 +2212,24 @@ sexp sexp_read_raw (sexp ctx, sexp in) {
|
||||||
else
|
else
|
||||||
goto scan_loop;
|
goto scan_loop;
|
||||||
break;
|
break;
|
||||||
|
case '|':
|
||||||
|
for (c2 = 1; c2 > 0 && c1 != EOF; ) {
|
||||||
|
c1 = sexp_read_char(ctx, in);
|
||||||
|
if (c1 == '#') {
|
||||||
|
while ((c1 = sexp_read_char(ctx, in)) == '#')
|
||||||
|
;
|
||||||
|
if (c1 == '|') c2++;
|
||||||
|
} else if (c1 == '|') {
|
||||||
|
while ((c1 = sexp_read_char(ctx, in)) == '|')
|
||||||
|
;
|
||||||
|
if (c1 == '#') c2--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c1 == EOF)
|
||||||
|
res = sexp_read_error(ctx, "unterminated #| comment", SEXP_NULL, in);
|
||||||
|
else
|
||||||
|
goto scan_loop;
|
||||||
|
break;
|
||||||
case '!':
|
case '!':
|
||||||
#if SEXP_USE_FOLD_CASE_SYMS
|
#if SEXP_USE_FOLD_CASE_SYMS
|
||||||
res = sexp_read_symbol(ctx, in, '!', 0);
|
res = sexp_read_symbol(ctx, in, '!', 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue