support nested block comment
This commit is contained in:
parent
1440a51ef8
commit
ee82ee99d7
13
src/read.c
13
src/read.c
|
@ -63,6 +63,7 @@ static pic_value
|
||||||
read_block_comment(pic_state *pic, struct pic_port *port, char c)
|
read_block_comment(pic_state *pic, struct pic_port *port, char c)
|
||||||
{
|
{
|
||||||
char x, y;
|
char x, y;
|
||||||
|
int i;
|
||||||
|
|
||||||
UNUSED(pic);
|
UNUSED(pic);
|
||||||
UNUSED(c);
|
UNUSED(c);
|
||||||
|
@ -70,12 +71,16 @@ read_block_comment(pic_state *pic, struct pic_port *port, char c)
|
||||||
x = next(port);
|
x = next(port);
|
||||||
y = next(port);
|
y = next(port);
|
||||||
|
|
||||||
while (! (x == '|' && y == '#')) {
|
i = 1;
|
||||||
|
while (x != EOF && y != EOF && i > 0) {
|
||||||
|
if (x == '|' && y == '#') {
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
if (x == '#' && y == '|') {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
x = y;
|
x = y;
|
||||||
y = next(port);
|
y = next(port);
|
||||||
if (y == EOF) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pic_undef_value();
|
return pic_undef_value();
|
||||||
|
|
Loading…
Reference in New Issue