From ef80ed5ebc20f1c40868f0d015553905dfa5cf18 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Mon, 20 Sep 2004 23:55:38 +0000 Subject: [PATCH] (skip_scsh_block_comment): Recognize "!#" everywhere, not just on a line of its own. --- libguile/read.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/libguile/read.c b/libguile/read.c index 97eb0f5d1..0e5aee3aa 100644 --- a/libguile/read.c +++ b/libguile/read.c @@ -166,14 +166,13 @@ scm_grow_tok_buf (SCM *tok_buf) /* Consume an SCSH-style block comment. Assume that we've already read the initial `#!', and eat characters until we get a - newline/exclamation-point/sharp-sign/newline sequence. - - A carriage return is also reocgnized as a newline. */ + exclamation-point/sharp-sign sequence. +*/ static void skip_scsh_block_comment (SCM port) { - int state = 0; + int bang_seen = 0; for (;;) { @@ -183,16 +182,12 @@ skip_scsh_block_comment (SCM port) scm_input_error ("skip_block_comment", port, "unterminated `#! ... !#' comment", SCM_EOL); - if (state == 1 && c == '!') - state = 2; - else if (state == 2 && c == '#') - state = 3; - else if (state == 3 && (c == '\n' || c == '\r')) + if (c == '!') + bang_seen = 1; + else if (c == '#' && bang_seen) return; - else if (c == '\n' || c == '\r') - state = 1; else - state = 0; + bang_seen = 0; } }