X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=lexer.c;h=8e0567e3c636820e65ba7a147d232776c0a4839d;hb=1c4f7c9f6ddb6c289ccab22a3795ebc6facfd518;hp=15c12a0b9102f3cd24e39b75f3c14b4e75ecb265;hpb=dec805ebf7d0ce3fb32780ef83a06d1bb2881407;p=cparser diff --git a/lexer.c b/lexer.c index 15c12a0..8e0567e 100644 --- a/lexer.c +++ b/lexer.c @@ -87,7 +87,9 @@ static size_t read_block(unsigned char *const read_buf, size_t const n) { size_t const s = fread(read_buf, 1, n, input); if (s == 0) { - if (ferror(input)) + /* on OS/X ferror appears to return true on eof as well when running + * the application in gdb... */ + if (!feof(input) && ferror(input)) parse_error("read from input failed"); buf[MAX_PUTBACK] = EOF; bufpos = buf + MAX_PUTBACK; @@ -768,7 +770,7 @@ static void parse_number(void) /* check for invalid octal digits */ for (size_t i= 0; i < size; ++i) { char t = string[i]; - if (t == '8' || t == '9') + if (t >= '8') errorf(&lexer_token.source_position, "invalid digit '%c' in octal number", t); }