mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 04:40:29 +02:00
(skip_scsh_block_comment): Recognize "!#" everywhere, not just on a
line of its own. (Backport 1.8 fix by Marius Vollmer <mvo@zagadka.de>.)
This commit is contained in:
parent
90f68ed326
commit
7c72d4e172
1 changed files with 7 additions and 7 deletions
|
@ -255,21 +255,21 @@ static void
|
||||||
skip_scsh_block_comment (SCM port)
|
skip_scsh_block_comment (SCM port)
|
||||||
#define FUNC_NAME "skip_scsh_block_comment"
|
#define FUNC_NAME "skip_scsh_block_comment"
|
||||||
{
|
{
|
||||||
/* Is this portable? Dear God, spare me from the non-eight-bit
|
int bang_seen = 0;
|
||||||
characters. But is it tasteful? */
|
|
||||||
long history = 0;
|
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int c = scm_getc (port);
|
int c = scm_getc (port);
|
||||||
|
|
||||||
if (c == EOF)
|
if (c == EOF)
|
||||||
SCM_MISC_ERROR ("unterminated `#! ... !#' comment", SCM_EOL);
|
SCM_MISC_ERROR ("unterminated `#! ... !#' comment", SCM_EOL);
|
||||||
history = ((history << 8) | (c & 0xff)) & 0xffffffff;
|
|
||||||
|
|
||||||
/* Were the last four characters read "\n!#\n"? */
|
if (c == '!')
|
||||||
if (history == (('\n' << 24) | ('!' << 16) | ('#' << 8) | '\n'))
|
bang_seen = 1;
|
||||||
|
else if (c == '#' && bang_seen)
|
||||||
return;
|
return;
|
||||||
|
else
|
||||||
|
bang_seen = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue