mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-13 23:20:32 +02:00
* read.c (skip_scsh_block_comment): SCSH says the !# that ends a
#! block comment must occur on a line all by itself.
This commit is contained in:
parent
0487b82f9f
commit
f973126498
1 changed files with 9 additions and 5 deletions
|
@ -239,13 +239,16 @@ recsexpr (obj, line, column, filename)
|
||||||
|
|
||||||
|
|
||||||
/* Consume an SCSH-style block comment. Assume that we've already
|
/* Consume an SCSH-style block comment. Assume that we've already
|
||||||
read the initial `#!', and eat characters until the matching `!#'. */
|
read the initial `#!', and eat characters until we get a
|
||||||
|
newline/exclamation-point/sharp-sign/newline sequence. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
skip_scsh_block_comment (port)
|
skip_scsh_block_comment (port)
|
||||||
SCM port;
|
SCM port;
|
||||||
{
|
{
|
||||||
char last_c = '\0';
|
/* Is this portable? Dear God, spare me from the non-eight-bit
|
||||||
|
characters. But is it tasteful? */
|
||||||
|
long history = 0;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -254,10 +257,11 @@ skip_scsh_block_comment (port)
|
||||||
if (c == EOF)
|
if (c == EOF)
|
||||||
scm_wta (SCM_UNDEFINED,
|
scm_wta (SCM_UNDEFINED,
|
||||||
"unterminated `#! ... !#' comment", "read");
|
"unterminated `#! ... !#' comment", "read");
|
||||||
else if (c == '#' && last_c == '!')
|
history = ((history << 8) | (c & 0xff)) & 0xffffffff;
|
||||||
return;
|
|
||||||
|
|
||||||
last_c = c;
|
/* Were the last four characters read "\n!#\n"? */
|
||||||
|
if (history == (('\n' << 24) | ('!' << 16) | ('#' << 8) | '\n'))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue