mirror of
https://github.com/golang/go
synced 2024-11-17 20:54:48 -07:00
cmd/gc: better error messages for C-style if statements.
Given if (i == 0) x++ The old message was x.go:6: syntax error: unexpected semicolon or newline before { Now we see x.go:6: syntax error: missing { after if clause Fixes #5687 R=golang-dev, adg CC=golang-dev https://golang.org/cl/12822045
This commit is contained in:
parent
bc6bb3efb4
commit
d00bd1d1f4
@ -21,16 +21,16 @@ static struct {
|
|||||||
"missing import path; require quoted string",
|
"missing import path; require quoted string",
|
||||||
|
|
||||||
% loadsys package imports LFUNC LNAME '(' ')' '{' LIF if_header ';'
|
% loadsys package imports LFUNC LNAME '(' ')' '{' LIF if_header ';'
|
||||||
"unexpected semicolon or newline before {",
|
"missing { after if clause",
|
||||||
|
|
||||||
% loadsys package imports LFUNC LNAME '(' ')' '{' LSWITCH if_header ';'
|
% loadsys package imports LFUNC LNAME '(' ')' '{' LSWITCH if_header ';'
|
||||||
"unexpected semicolon or newline before {",
|
"missing { after switch clause",
|
||||||
|
|
||||||
% loadsys package imports LFUNC LNAME '(' ')' '{' LFOR for_header ';'
|
% loadsys package imports LFUNC LNAME '(' ')' '{' LFOR for_header ';'
|
||||||
"unexpected semicolon or newline before {",
|
"missing { after for clause",
|
||||||
|
|
||||||
% loadsys package imports LFUNC LNAME '(' ')' '{' LFOR ';' LBODY
|
% loadsys package imports LFUNC LNAME '(' ')' '{' LFOR ';' LBODY
|
||||||
"unexpected semicolon or newline before {",
|
"missing { after for clause",
|
||||||
|
|
||||||
% loadsys package imports LFUNC LNAME '(' ')' ';' '{'
|
% loadsys package imports LFUNC LNAME '(' ')' ';' '{'
|
||||||
"unexpected semicolon or newline before {",
|
"unexpected semicolon or newline before {",
|
||||||
|
1854
src/cmd/gc/y.tab.c
1854
src/cmd/gc/y.tab.c
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,14 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.5. */
|
/* A Bison parser, made by GNU Bison 2.3. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
|
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
(at your option) any later version.
|
any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@ -15,7 +16,9 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
/* As a special exception, you may create a larger work that contains
|
/* As a special exception, you may create a larger work that contains
|
||||||
part or all of the Bison parser skeleton and distribute that work
|
part or all of the Bison parser skeleton and distribute that work
|
||||||
@ -30,7 +33,6 @@
|
|||||||
This special exception was added by the Free Software Foundation in
|
This special exception was added by the Free Software Foundation in
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define YYTOKENTYPE
|
||||||
@ -144,28 +146,22 @@
|
|||||||
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
typedef union YYSTYPE
|
typedef union YYSTYPE
|
||||||
{
|
|
||||||
|
|
||||||
/* Line 2068 of yacc.c */
|
|
||||||
#line 30 "go.y"
|
#line 30 "go.y"
|
||||||
|
{
|
||||||
Node* node;
|
Node* node;
|
||||||
NodeList* list;
|
NodeList* list;
|
||||||
Type* type;
|
Type* type;
|
||||||
Sym* sym;
|
Sym* sym;
|
||||||
struct Val val;
|
struct Val val;
|
||||||
int i;
|
int i;
|
||||||
|
}
|
||||||
|
/* Line 1529 of yacc.c. */
|
||||||
|
#line 160 "y.tab.h"
|
||||||
/* Line 2068 of yacc.c */
|
YYSTYPE;
|
||||||
#line 163 "y.tab.h"
|
|
||||||
} YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
extern YYSTYPE yylval;
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,16 +21,16 @@ static struct {
|
|||||||
"missing import path; require quoted string",
|
"missing import path; require quoted string",
|
||||||
|
|
||||||
377, ';',
|
377, ';',
|
||||||
"unexpected semicolon or newline before {",
|
"missing { after if clause",
|
||||||
|
|
||||||
398, ';',
|
398, ';',
|
||||||
"unexpected semicolon or newline before {",
|
"missing { after switch clause",
|
||||||
|
|
||||||
237, ';',
|
237, ';',
|
||||||
"unexpected semicolon or newline before {",
|
"missing { after for clause",
|
||||||
|
|
||||||
475, LBODY,
|
475, LBODY,
|
||||||
"unexpected semicolon or newline before {",
|
"missing { after for clause",
|
||||||
|
|
||||||
22, '{',
|
22, '{',
|
||||||
"unexpected semicolon or newline before {",
|
"unexpected semicolon or newline before {",
|
||||||
|
Loading…
Reference in New Issue
Block a user