fix EOF handling

This commit is contained in:
Yuichi Nishiwaki 2014-06-25 21:40:18 +09:00
parent ee82ee99d7
commit bd822fa4c6
1 changed files with 17 additions and 10 deletions

View File

@ -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)
{ {