github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/src/cmd/gc/go.errors (about)

     1  // Copyright 2010 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Example-based syntax error messages.
     6  // See bisonerrors, Makefile, go.y.
     7  
     8  static struct {
     9  	int yystate;
    10  	int yychar;
    11  	char *msg;
    12  } yymsg[] = {
    13  	// Each line of the form % token list
    14  	// is converted by bisonerrors into the yystate and yychar caused
    15  	// by that token list.
    16  
    17  	% loadsys package LIMPORT '(' LLITERAL import_package import_there ','
    18  	"unexpected comma during import block",
    19  
    20  	% loadsys package imports LFUNC LNAME '(' ')' '{' LIF if_header ';'
    21  	"unexpected semicolon or newline before {",
    22  
    23  	% loadsys package imports LFUNC LNAME '(' ')' '{' LSWITCH if_header ';'
    24  	"unexpected semicolon or newline before {",
    25  
    26  	% loadsys package imports LFUNC LNAME '(' ')' '{' LFOR for_header ';'
    27  	"unexpected semicolon or newline before {",
    28  
    29  	% loadsys package imports LFUNC LNAME '(' ')' '{' LFOR ';' LBODY
    30  	"unexpected semicolon or newline before {",
    31  
    32  	% loadsys package imports LFUNC LNAME '(' ')' ';' '{'
    33  	"unexpected semicolon or newline before {",
    34  
    35  	% loadsys package imports LTYPE LNAME ';'
    36  	"unexpected semicolon or newline in type declaration",
    37  
    38  	% loadsys package imports LCHAN '}'
    39  	"unexpected } in channel type",
    40  	
    41  	% loadsys package imports LCHAN ')'
    42  	"unexpected ) in channel type",
    43  	
    44  	% loadsys package imports LCHAN ','
    45  	"unexpected comma in channel type",
    46  
    47  	% loadsys package imports LFUNC LNAME '(' ')' '{' if_stmt ';' LELSE
    48  	"unexpected semicolon or newline before else",
    49  
    50  	% loadsys package imports LTYPE LNAME LINTERFACE '{' LNAME ',' LNAME
    51  	"name list not allowed in interface type",
    52  
    53  	% loadsys package imports LFUNC LNAME '(' ')' '{' LFOR LVAR LNAME '=' LNAME
    54  	"var declaration not allowed in for initializer",
    55  
    56  	% loadsys package imports LVAR LNAME '[' ']' LNAME '{'
    57  	"unexpected { at end of statement",
    58  
    59  	% loadsys package imports LFUNC LNAME '(' ')' '{' LVAR LNAME '[' ']' LNAME '{'
    60  	"unexpected { at end of statement",
    61  	
    62  	% loadsys package imports LFUNC LNAME '(' ')' '{' LDEFER LNAME ';'
    63  	"argument to go/defer must be function call",
    64  	
    65  	% loadsys package imports LVAR LNAME '=' LNAME '{' LNAME ';'
    66  	"need trailing comma before newline in composite literal",
    67  	
    68  	% loadsys package imports LVAR LNAME '=' comptype '{' LNAME ';'
    69  	"need trailing comma before newline in composite literal",
    70  	
    71  	% loadsys package imports LFUNC LNAME '(' ')' '{' LFUNC LNAME
    72  	"nested func not allowed",
    73  
    74  	% loadsys package imports LFUNC LNAME '(' ')' '{' LIF if_header loop_body LELSE ';'
    75  	"else must be followed by if or statement block"
    76  };