From ea9255e934f67bca9a7549ee40012376c12f835e Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sun, 2 Oct 2011 19:37:31 +0900 Subject: [PATCH] adding #| ... |# comment support --- sexp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sexp.c b/sexp.c index ca9c2394..6c23fbd2 100644 --- a/sexp.c +++ b/sexp.c @@ -2212,6 +2212,24 @@ sexp sexp_read_raw (sexp ctx, sexp in) { else goto scan_loop; 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 '!': #if SEXP_USE_FOLD_CASE_SYMS res = sexp_read_symbol(ctx, in, '!', 0);