Better handling of unexpected EOF in parser.

From-SVN: r179060
This commit is contained in:
Ian Lance Taylor 2011-09-21 21:06:42 +00:00
parent 70f3cf699d
commit a5682d1525

View File

@ -1299,6 +1299,13 @@ Parse::declaration_may_start_here()
void
Parse::decl(void (Parse::*pfn)(void*), void* varg)
{
if (this->peek_token()->is_eof())
{
if (!saw_errors())
error_at(this->location(), "unexpected end of file");
return;
}
if (!this->peek_token()->is_op(OPERATOR_LPAREN))
(this->*pfn)(varg);
else