Patchwork [gccgo] Better error recover after top level declaration

login
register
mail settings
Submitter Ian Taylor
Date Sept. 10, 2010, 6:42 p.m.
Message ID <mcry6b98mpm.fsf@google.com>
Download mbox | patch
Permalink /patch/64444/
State New
Headers show

Comments

Ian Taylor - Sept. 10, 2010, 6:42 p.m.
This gccgo patch improves error recovery when something goes wrong after
a top level declaration.  Committed to gccgo branch.

Ian

Patch

diff -r b59226aea9d4 go/parse.cc
--- a/go/parse.cc	Thu Sep 09 22:12:54 2010 -0700
+++ b/go/parse.cc	Fri Sep 10 11:40:58 2010 -0700
@@ -4613,7 +4613,10 @@ 
       if (token->is_op(OPERATOR_SEMICOLON))
 	token = this->advance_token();
       else if (!token->is_eof() || !saw_errors())
-	this->error("expected %<;%> or newline after top level declaration");
+	{
+	  this->error("expected %<;%> or newline after top level declaration");
+	  this->skip_past_error(OPERATOR_INVALID);
+	}
     }
 }