From patchwork Fri Sep 10 05:13:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 64353 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B2861B70F5 for ; Fri, 10 Sep 2010 15:13:50 +1000 (EST) Received: (qmail 12770 invoked by alias); 10 Sep 2010 05:13:47 -0000 Received: (qmail 12761 invoked by uid 22791); 10 Sep 2010 05:13:45 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, TW_CC, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Sep 2010 05:13:41 +0000 Received: from kpbe11.cbf.corp.google.com (kpbe11.cbf.corp.google.com [172.25.105.75]) by smtp-out.google.com with ESMTP id o8A5DbaG016132 for ; Thu, 9 Sep 2010 22:13:38 -0700 Received: from pwi1 (pwi1.prod.google.com [10.241.219.1]) by kpbe11.cbf.corp.google.com with ESMTP id o8A5Da9c001110 for ; Thu, 9 Sep 2010 22:13:36 -0700 Received: by pwi1 with SMTP id 1so1081473pwi.17 for ; Thu, 09 Sep 2010 22:13:36 -0700 (PDT) Received: by 10.114.66.8 with SMTP id o8mr150899waa.215.1284095616254; Thu, 09 Sep 2010 22:13:36 -0700 (PDT) Received: from coign.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) by mx.google.com with ESMTPS id s5sm3703704wak.12.2010.09.09.22.13.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 09 Sep 2010 22:13:33 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: [gccgo] Fix error recovery for top-level parse errors Date: Thu, 09 Sep 2010 22:13:27 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This gccgo patch improves error recovery for top-level parse errors. Committed to gccgo branch. Ian 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();