fix EOF handling
This commit is contained in:
parent
ee82ee99d7
commit
bd822fa4c6
27
src/read.c
27
src/read.c
|
@ -530,6 +530,23 @@ read(pic_state *pic, struct pic_port *port, char c)
|
||||||
{
|
{
|
||||||
pic_value val;
|
pic_value val;
|
||||||
|
|
||||||
|
retry:
|
||||||
|
val = read_nullable(pic, port, c);
|
||||||
|
|
||||||
|
if (pic_undef_p(val)) {
|
||||||
|
c = next(port);
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
pic_value
|
||||||
|
pic_read(pic_state *pic, struct pic_port *port)
|
||||||
|
{
|
||||||
|
pic_value val;
|
||||||
|
char c = next(port);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
c = skip(port, c);
|
c = skip(port, c);
|
||||||
|
|
||||||
|
@ -547,16 +564,6 @@ read(pic_state *pic, struct pic_port *port, char c)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
|
||||||
pic_read(pic_state *pic, struct pic_port *port)
|
|
||||||
{
|
|
||||||
char c;
|
|
||||||
|
|
||||||
c = next(port);
|
|
||||||
|
|
||||||
return read(pic, port, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
pic_value
|
pic_value
|
||||||
pic_read_cstr(pic_state *pic, const char *str)
|
pic_read_cstr(pic_state *pic, const char *str)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue