diff mbox

[gccgo] Fix error recovery for top-level parse errors

Message ID mcry6bab2q0.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Sept. 10, 2010, 5:13 a.m. UTC
This gccgo patch improves error recovery for top-level parse errors.
Committed to gccgo branch.

Ian
diff mbox

Patch

diff -r 2b820e9f9138 go/parse.cc
--- a/go/parse.cc	Thu Sep 09 20:34:31 2010 -0700
+++ b/go/parse.cc	Thu Sep 09 22:12:07 2010 -0700
@@ -4605,7 +4605,8 @@ 
 	  while (!this->peek_token()->is_eof()
 		 && !this->peek_token()->is_op(OPERATOR_SEMICOLON)
 		 && !this->peek_token()->is_op(OPERATOR_RCURLY));
-	  if (!this->peek_token()->is_eof())
+	  if (!this->peek_token()->is_eof()
+	      && !this->peek_token()->is_op(OPERATOR_SEMICOLON))
 	    this->advance_token();
 	}
       token = this->peek_token();