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

login
register
mail settings
Submitter Ian Taylor
Date Sept. 10, 2010, 5:13 a.m.
Message ID <mcry6bab2q0.fsf@google.com>
Download mbox | patch
Permalink /patch/64353/
State New
Headers show

Comments

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

Ian

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();