mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 06:20:23 +02:00
(skip_scsh_block_comment): Recognize "!#" everywhere, not just on a
line of its own.
This commit is contained in:
parent
1a82a4606c
commit
ef80ed5ebc
1 changed files with 7 additions and 12 deletions
|
@ -166,14 +166,13 @@ scm_grow_tok_buf (SCM *tok_buf)
|
||||||
|
|
||||||
/* 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 we get a
|
read the initial `#!', and eat characters until we get a
|
||||||
newline/exclamation-point/sharp-sign/newline sequence.
|
exclamation-point/sharp-sign sequence.
|
||||||
|
*/
|
||||||
A carriage return is also reocgnized as a newline. */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
skip_scsh_block_comment (SCM port)
|
skip_scsh_block_comment (SCM port)
|
||||||
{
|
{
|
||||||
int state = 0;
|
int bang_seen = 0;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -183,16 +182,12 @@ skip_scsh_block_comment (SCM port)
|
||||||
scm_input_error ("skip_block_comment", port,
|
scm_input_error ("skip_block_comment", port,
|
||||||
"unterminated `#! ... !#' comment", SCM_EOL);
|
"unterminated `#! ... !#' comment", SCM_EOL);
|
||||||
|
|
||||||
if (state == 1 && c == '!')
|
if (c == '!')
|
||||||
state = 2;
|
bang_seen = 1;
|
||||||
else if (state == 2 && c == '#')
|
else if (c == '#' && bang_seen)
|
||||||
state = 3;
|
|
||||||
else if (state == 3 && (c == '\n' || c == '\r'))
|
|
||||||
return;
|
return;
|
||||||
else if (c == '\n' || c == '\r')
|
|
||||||
state = 1;
|
|
||||||
else
|
else
|
||||||
state = 0;
|
bang_seen = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue