Commit b5fe0771 authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: remove yacc-based parser

- moved yySymType and token constants (L...) to lex.go
- removed oldparser flag and related code
- removed go generate that generated y.go

Fixes #13240.

Change-Id: I2576ec61ee1efe482f2a5132175725c9c02ef977
Reviewed-on: https://go-review.googlesource.com/17176Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent f1b91957
......@@ -627,8 +627,6 @@ var Widthint int
var Widthreg int
var typesw *Node // TODO(gri) remove when yacc-based parser is gone
var nblank *Node
var Funcdepth int32
......
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
* Go language grammar.
*
* The Go semicolon rules are:
*
* 1. all statements and declarations are terminated by semicolons.
* 2. semicolons can be omitted before a closing ) or }.
* 3. semicolons are inserted by the lexer before a newline
* following a specific list of tokens.
*
* Rules #1 and #2 are accomplished by writing the lists as
* semicolon-separated lists with an optional trailing semicolon.
* Rule #3 is implemented in yylex.
*/
%{
package gc
import (
"fmt"
"strings"
)
%}
%union {
node *Node
list *NodeList
typ *Type
sym *Sym
val Val
i int
}
// |sed 's/.* //' |9 fmt -l1 |sort |9 fmt -l50 | sed 's/^/%xxx /'
%token <val> LLITERAL
%token <i> LASOP LCOLAS
%token <sym> LBREAK LCASE LCHAN LCONST LCONTINUE LDDD
%token <sym> LDEFAULT LDEFER LELSE LFALL LFOR LFUNC LGO LGOTO
%token <sym> LIF LIMPORT LINTERFACE LMAP LNAME
%token <sym> LPACKAGE LRANGE LRETURN LSELECT LSTRUCT LSWITCH
%token <sym> LTYPE LVAR
%token LANDAND LANDNOT LBODY LCOMM LDEC LEQ LGE LGT
%token LIGNORE LINC LLE LLSH LLT LNE LOROR LRSH
%type <i> lbrace import_here
%type <sym> sym packname
%type <val> oliteral
%type <node> stmt ntype
%type <node> arg_type
%type <node> case caseblock
%type <node> compound_stmt dotname embed expr complitexpr bare_complitexpr
%type <node> expr_or_type
%type <node> fndcl hidden_fndcl fnliteral
%type <node> for_body for_header for_stmt if_header if_stmt non_dcl_stmt
%type <node> interfacedcl keyval labelname name
%type <node> name_or_type non_expr_type
%type <node> new_name dcl_name oexpr typedclname
%type <node> onew_name
%type <node> osimple_stmt pexpr pexpr_no_paren
%type <node> pseudocall range_stmt select_stmt
%type <node> simple_stmt
%type <node> switch_stmt uexpr
%type <node> xfndcl typedcl start_complit
%type <list> xdcl fnbody fnres loop_body dcl_name_list
%type <list> new_name_list expr_list keyval_list braced_keyval_list expr_or_type_list xdcl_list
%type <list> oexpr_list caseblock_list elseif elseif_list else stmt_list oarg_type_list_ocomma arg_type_list
%type <list> interfacedcl_list vardcl vardcl_list structdcl structdcl_list
%type <list> common_dcl constdcl constdcl1 constdcl_list typedcl_list
%type <node> convtype comptype dotdotdot
%type <node> indcl interfacetype structtype ptrtype
%type <node> recvchantype non_recvchantype othertype fnret_type fntype
%type <sym> hidden_importsym hidden_pkg_importsym
%type <node> hidden_constant hidden_literal hidden_funarg
%type <node> hidden_interfacedcl hidden_structdcl
%type <list> hidden_funres
%type <list> ohidden_funres
%type <list> hidden_funarg_list ohidden_funarg_list
%type <list> hidden_interfacedcl_list ohidden_interfacedcl_list
%type <list> hidden_structdcl_list ohidden_structdcl_list
%type <typ> hidden_type hidden_type_misc hidden_pkgtype
%type <typ> hidden_type_func
%type <typ> hidden_type_recv_chan hidden_type_non_recv_chan
%left LCOMM /* outside the usual hierarchy; here for good error messages */
%left LOROR
%left LANDAND
%left LEQ LNE LLE LGE LLT LGT
%left '+' '-' '|' '^'
%left '*' '/' '%' '&' LLSH LRSH LANDNOT
/*
* manual override of shift/reduce conflicts.
* the general form is that we assign a precedence
* to the token being shifted and then introduce
* NotToken with lower precedence or PreferToToken with higher
* and annotate the reducing rule accordingly.
*/
%left NotPackage
%left LPACKAGE
%left NotParen
%left '('
%left ')'
%left PreferToRightParen
%error loadsys package LIMPORT '(' LLITERAL import_package import_there ',':
"unexpected comma during import block"
%error loadsys package LIMPORT LNAME ';':
"missing import path; require quoted string"
%error loadsys package imports LFUNC LNAME '(' ')' '{' LIF if_header ';':
"missing { after if clause"
%error loadsys package imports LFUNC LNAME '(' ')' '{' LSWITCH if_header ';':
"missing { after switch clause"
%error loadsys package imports LFUNC LNAME '(' ')' '{' LFOR for_header ';':
"missing { after for clause"
%error loadsys package imports LFUNC LNAME '(' ')' '{' LFOR ';' LBODY:
"missing { after for clause"
%error loadsys package imports LFUNC LNAME '(' ')' ';' '{':
"unexpected semicolon or newline before {"
%error loadsys package imports LTYPE LNAME ';':
"unexpected semicolon or newline in type declaration"
%error loadsys package imports LCHAN '}':
"unexpected } in channel type"
%error loadsys package imports LCHAN ')':
"unexpected ) in channel type"
%error loadsys package imports LCHAN ',':
"unexpected comma in channel type"
%error loadsys package imports LFUNC LNAME '(' ')' '{' if_stmt ';' LELSE:
"unexpected semicolon or newline before else"
%error loadsys package imports LTYPE LNAME LINTERFACE '{' LNAME ',' LNAME:
"name list not allowed in interface type"
%error loadsys package imports LFUNC LNAME '(' ')' '{' LFOR LVAR LNAME '=' LNAME:
"var declaration not allowed in for initializer"
%error loadsys package imports LVAR LNAME '[' ']' LNAME '{':
"unexpected { at end of statement"
%error loadsys package imports LFUNC LNAME '(' ')' '{' LVAR LNAME '[' ']' LNAME '{':
"unexpected { at end of statement"
%error loadsys package imports LFUNC LNAME '(' ')' '{' LDEFER LNAME ';':
"argument to go/defer must be function call"
%error loadsys package imports LVAR LNAME '=' LNAME '{' LNAME ';':
"need trailing comma before newline in composite literal"
%error loadsys package imports LVAR LNAME '=' comptype '{' LNAME ';':
"need trailing comma before newline in composite literal"
%error loadsys package imports LFUNC LNAME '(' ')' '{' LFUNC LNAME:
"nested func not allowed"
%error loadsys package imports LFUNC LNAME '(' ')' '{' LIF if_header loop_body LELSE ';':
"else must be followed by if or statement block"
%%
file:
loadsys
package
imports
xdcl_list
{
xtop = concat(xtop, $4);
}
package:
%prec NotPackage
{
prevlineno = lineno;
Yyerror("package statement must be first");
errorexit();
}
| LPACKAGE sym ';'
{
mkpackage($2.Name);
}
/*
* this loads the definitions for the low-level runtime functions,
* so that the compiler can generate calls to them,
* but does not make the name "runtime" visible as a package.
*/
loadsys:
{
importpkg = Runtimepkg;
if Debug['A'] != 0 {
cannedimports("runtime.Builtin", "package runtime\n\n$$\n\n");
} else {
cannedimports("runtime.Builtin", runtimeimport);
}
curio.importsafe = true
}
import_package
import_there
{
importpkg = nil;
}
imports:
| imports import ';'
import:
LIMPORT import_stmt
| LIMPORT '(' import_stmt_list osemi ')'
| LIMPORT '(' ')'
import_stmt:
import_here import_package import_there
{
ipkg := importpkg;
my := importmyname;
importpkg = nil;
importmyname = nil;
if my == nil {
my = Lookup(ipkg.Name);
}
pack := Nod(OPACK, nil, nil);
pack.Sym = my;
pack.Name.Pkg = ipkg;
pack.Lineno = int32($1);
if strings.HasPrefix(my.Name, ".") {
importdot(ipkg, pack);
break;
}
if my.Name == "init" {
lineno = int32($1)
Yyerror("cannot import package as init - init must be a func");
break;
}
if my.Name == "_" {
break;
}
if my.Def != nil {
lineno = int32($1);
redeclare(my, "as imported package name");
}
my.Def = pack;
my.Lastlineno = int32($1);
my.Block = 1; // at top level
}
| import_here import_there
{
// When an invalid import path is passed to importfile,
// it calls Yyerror and then sets up a fake import with
// no package statement. This allows us to test more
// than one invalid import statement in a single file.
if nerrors == 0 {
Fatalf("phase error in import");
}
}
import_stmt_list:
import_stmt
| import_stmt_list ';' import_stmt
import_here:
LLITERAL
{
// import with original name
$$ = parserline();
importmyname = nil;
importfile(&$1, $$);
}
| sym LLITERAL
{
// import with given name
$$ = parserline();
importmyname = $1;
importfile(&$2, $$);
}
| '.' LLITERAL
{
// import into my name space
$$ = parserline();
importmyname = Lookup(".");
importfile(&$2, $$);
}
import_package:
LPACKAGE LNAME import_safety ';'
{
if importpkg.Name == "" {
importpkg.Name = $2.Name;
numImport[$2.Name]++
} else if importpkg.Name != $2.Name {
Yyerror("conflicting names %s and %s for package %q", importpkg.Name, $2.Name, importpkg.Path);
}
if incannedimport == 0 {
importpkg.Direct = true;
}
importpkg.Safe = curio.importsafe
if safemode != 0 && !curio.importsafe {
Yyerror("cannot import unsafe package %q", importpkg.Path);
}
}
import_safety:
| LNAME
{
if $1.Name == "safe" {
curio.importsafe = true
}
}
import_there:
{
defercheckwidth();
}
hidden_import_list '$' '$'
{
resumecheckwidth();
unimportfile();
}
/*
* declarations
*/
xdcl:
{
Yyerror("empty top-level declaration");
$$ = nil;
}
| common_dcl
| xfndcl
{
$$ = list1($1);
}
| non_dcl_stmt
{
Yyerror("non-declaration statement outside function body");
$$ = nil;
}
| error
{
$$ = nil;
}
common_dcl:
LVAR vardcl
{
$$ = $2;
}
| LVAR '(' vardcl_list osemi ')'
{
$$ = $3;
}
| LVAR '(' ')'
{
$$ = nil;
}
| lconst constdcl
{
$$ = $2;
iota_ = -100000;
lastconst = nil;
}
| lconst '(' constdcl osemi ')'
{
$$ = $3;
iota_ = -100000;
lastconst = nil;
}
| lconst '(' constdcl ';' constdcl_list osemi ')'
{
$$ = concat($3, $5);
iota_ = -100000;
lastconst = nil;
}
| lconst '(' ')'
{
$$ = nil;
iota_ = -100000;
}
| LTYPE typedcl
{
$$ = list1($2);
}
| LTYPE '(' typedcl_list osemi ')'
{
$$ = $3;
}
| LTYPE '(' ')'
{
$$ = nil;
}
lconst:
LCONST
{
iota_ = 0;
}
vardcl:
dcl_name_list ntype
{
$$ = variter($1, $2, nil);
}
| dcl_name_list ntype '=' expr_list
{
$$ = variter($1, $2, $4);
}
| dcl_name_list '=' expr_list
{
$$ = variter($1, nil, $3);
}
constdcl:
dcl_name_list ntype '=' expr_list
{
$$ = constiter($1, $2, $4);
}
| dcl_name_list '=' expr_list
{
$$ = constiter($1, nil, $3);
}
constdcl1:
constdcl
| dcl_name_list ntype
{
$$ = constiter($1, $2, nil);
}
| dcl_name_list
{
$$ = constiter($1, nil, nil);
}
typedclname:
sym
{
// different from dclname because the name
// becomes visible right here, not at the end
// of the declaration.
$$ = typedcl0($1);
}
typedcl:
typedclname ntype
{
$$ = typedcl1($1, $2, true);
}
simple_stmt:
expr
{
$$ = $1;
// These nodes do not carry line numbers.
// Since a bare name used as an expression is an error,
// introduce a wrapper node to give the correct line.
switch($$.Op) {
case ONAME, ONONAME, OTYPE, OPACK, OLITERAL:
$$ = Nod(OPAREN, $$, nil);
$$.Implicit = true;
break;
}
}
| expr LASOP expr
{
$$ = Nod(OASOP, $1, $3);
$$.Etype = EType($2); // rathole to pass opcode
}
| expr_list '=' expr_list
{
if $1.Next == nil && $3.Next == nil {
// simple
$$ = Nod(OAS, $1.N, $3.N);
break;
}
// multiple
$$ = Nod(OAS2, nil, nil);
$$.List = $1;
$$.Rlist = $3;
}
| expr_list LCOLAS expr_list
{
if $3.N.Op == OTYPESW {
$$ = Nod(OTYPESW, nil, $3.N.Right);
if $3.Next != nil {
Yyerror("expr.(type) must be alone in list");
}
if $1.Next != nil {
Yyerror("argument count mismatch: %d = %d", count($1), 1);
} else if ($1.N.Op != ONAME && $1.N.Op != OTYPE && $1.N.Op != ONONAME && ($1.N.Op != OLITERAL || $1.N.Name == nil)) || isblank($1.N) {
Yyerror("invalid variable name %s in type switch", $1.N);
} else {
$$.Left = dclname($1.N.Sym);
} // it's a colas, so must not re-use an oldname.
break;
}
$$ = colas($1, $3, int32($2));
}
| expr LINC
{
$$ = Nod(OASOP, $1, Nodintconst(1));
$$.Implicit = true;
// TODO(marvin): Fix Node.EType type union.
$$.Etype = EType(OADD);
}
| expr LDEC
{
$$ = Nod(OASOP, $1, Nodintconst(1));
$$.Implicit = true;
// TODO(marvin): Fix Node.EType type union.
$$.Etype = EType(OSUB);
}
case:
LCASE expr_or_type_list ':'
{
var n, nn *Node
// will be converted to OCASE
// right will point to next case
// done in casebody()
markdcl();
$$ = Nod(OXCASE, nil, nil);
$$.List = $2;
if typesw != nil && typesw.Right != nil {
n = typesw.Right.Left
if n != nil {
// type switch - declare variable
nn = newname(n.Sym);
declare(nn, dclcontext);
$$.Rlist = list1(nn);
// keep track of the instances for reporting unused
nn.Name.Defn = typesw.Right;
}
}
}
| LCASE expr_or_type_list '=' expr ':'
{
var n *Node
// will be converted to OCASE
// right will point to next case
// done in casebody()
markdcl();
$$ = Nod(OXCASE, nil, nil);
if $2.Next == nil {
n = Nod(OAS, $2.N, $4);
} else {
n = Nod(OAS2, nil, nil);
n.List = $2;
n.Rlist = list1($4);
}
$$.List = list1(n);
}
| LCASE expr_or_type_list LCOLAS expr ':'
{
// will be converted to OCASE
// right will point to next case
// done in casebody()
markdcl();
$$ = Nod(OXCASE, nil, nil);
$$.List = list1(colas($2, list1($4), int32($3)));
}
| LDEFAULT ':'
{
var n, nn *Node
markdcl();
$$ = Nod(OXCASE, nil, nil);
if typesw != nil && typesw.Right != nil {
n = typesw.Right.Left
if n != nil {
// type switch - declare variable
nn = newname(n.Sym);
declare(nn, dclcontext);
$$.Rlist = list1(nn);
// keep track of the instances for reporting unused
nn.Name.Defn = typesw.Right;
}
}
}
compound_stmt:
'{'
{
markdcl();
}
stmt_list '}'
{
if $3 == nil {
$$ = Nod(OEMPTY, nil, nil);
} else {
$$ = liststmt($3);
}
popdcl();
}
caseblock:
case
{
// If the last token read by the lexer was consumed
// as part of the case, clear it (parser has cleared yychar).
// If the last token read by the lexer was the lookahead
// leave it alone (parser has it cached in yychar).
// This is so that the stmt_list action doesn't look at
// the case tokens if the stmt_list is empty.
yylast = yychar;
$1.Xoffset = int64(block);
}
stmt_list
{
// This is the only place in the language where a statement
// list is not allowed to drop the final semicolon, because
// it's the only place where a statement list is not followed
// by a closing brace. Handle the error for pedantry.
// Find the final token of the statement list.
// yylast is lookahead; yyprev is last of stmt_list
last := yyprev;
if last > 0 && last != ';' && yychar != '}' {
Yyerror("missing statement after label");
}
$$ = $1;
$$.Nbody = $3;
popdcl();
}
caseblock_list:
{
$$ = nil;
}
| caseblock_list caseblock
{
$$ = list($1, $2);
}
loop_body:
LBODY
{
markdcl();
}
stmt_list '}'
{
$$ = $3;
popdcl();
}
range_stmt:
expr_list '=' LRANGE expr
{
$$ = Nod(ORANGE, nil, $4);
$$.List = $1;
$$.Etype = 0; // := flag
}
| expr_list LCOLAS LRANGE expr
{
$$ = Nod(ORANGE, nil, $4);
$$.List = $1;
$$.Colas = true;
colasdefn($1, $$);
}
| LRANGE expr
{
$$ = Nod(ORANGE, nil, $2);
$$.Etype = 0; // := flag
}
for_header:
osimple_stmt ';' osimple_stmt ';' osimple_stmt
{
// init ; test ; incr
if $5 != nil && $5.Colas {
Yyerror("cannot declare in the for-increment");
}
$$ = Nod(OFOR, nil, nil);
if $1 != nil {
$$.Ninit = list1($1);
}
$$.Left = $3;
$$.Right = $5;
}
| osimple_stmt
{
// normal test
$$ = Nod(OFOR, nil, nil);
$$.Left = $1;
}
| range_stmt
for_body:
for_header loop_body
{
$$ = $1;
$$.Nbody = concat($$.Nbody, $2);
}
for_stmt:
LFOR
{
markdcl();
}
for_body
{
$$ = $3;
popdcl();
}
if_header:
osimple_stmt
{
// test
$$ = Nod(OIF, nil, nil);
$$.Left = $1;
}
| osimple_stmt ';' osimple_stmt
{
// init ; test
$$ = Nod(OIF, nil, nil);
if $1 != nil {
$$.Ninit = list1($1);
}
$$.Left = $3;
}
/* IF cond body (ELSE IF cond body)* (ELSE block)? */
if_stmt:
LIF
{
markdcl();
}
if_header
{
if $3.Left == nil {
Yyerror("missing condition in if statement");
}
}
loop_body
{
$3.Nbody = $5;
}
elseif_list else
{
var n *Node
var nn *NodeList
$$ = $3;
n = $3;
popdcl();
for nn = concat($7, $8); nn != nil; nn = nn.Next {
if nn.N.Op == OIF {
popdcl();
}
n.Rlist = list1(nn.N);
n = nn.N;
}
}
elseif:
LELSE LIF
{
markdcl();
}
if_header loop_body
{
if $4.Left == nil {
Yyerror("missing condition in if statement");
}
$4.Nbody = $5;
$$ = list1($4);
}
elseif_list:
{
$$ = nil;
}
| elseif_list elseif
{
$$ = concat($1, $2);
}
else:
{
$$ = nil;
}
| LELSE compound_stmt
{
l := &NodeList{N: $2}
l.End = l
$$ = l;
}
switch_stmt:
LSWITCH
{
markdcl();
}
if_header
{
var n *Node
n = $3.Left;
if n != nil && n.Op != OTYPESW {
n = nil;
}
typesw = Nod(OXXX, typesw, n);
}
LBODY caseblock_list '}'
{
$$ = $3;
$$.Op = OSWITCH;
$$.List = $6;
typesw = typesw.Left;
popdcl();
}
select_stmt:
LSELECT
{
typesw = Nod(OXXX, typesw, nil);
}
LBODY caseblock_list '}'
{
$$ = Nod(OSELECT, nil, nil);
$$.Lineno = typesw.Lineno;
$$.List = $4;
typesw = typesw.Left;
}
/*
* expressions
*/
expr:
uexpr
| expr LOROR expr
{
$$ = Nod(OOROR, $1, $3);
}
| expr LANDAND expr
{
$$ = Nod(OANDAND, $1, $3);
}
| expr LEQ expr
{
$$ = Nod(OEQ, $1, $3);
}
| expr LNE expr
{
$$ = Nod(ONE, $1, $3);
}
| expr LLT expr
{
$$ = Nod(OLT, $1, $3);
}
| expr LLE expr
{
$$ = Nod(OLE, $1, $3);
}
| expr LGE expr
{
$$ = Nod(OGE, $1, $3);
}
| expr LGT expr
{
$$ = Nod(OGT, $1, $3);
}
| expr '+' expr
{
$$ = Nod(OADD, $1, $3);
}
| expr '-' expr
{
$$ = Nod(OSUB, $1, $3);
}
| expr '|' expr
{
$$ = Nod(OOR, $1, $3);
}
| expr '^' expr
{
$$ = Nod(OXOR, $1, $3);
}
| expr '*' expr
{
$$ = Nod(OMUL, $1, $3);
}
| expr '/' expr
{
$$ = Nod(ODIV, $1, $3);
}
| expr '%' expr
{
$$ = Nod(OMOD, $1, $3);
}
| expr '&' expr
{
$$ = Nod(OAND, $1, $3);
}
| expr LANDNOT expr
{
$$ = Nod(OANDNOT, $1, $3);
}
| expr LLSH expr
{
$$ = Nod(OLSH, $1, $3);
}
| expr LRSH expr
{
$$ = Nod(ORSH, $1, $3);
}
/* not an expression anymore, but left in so we can give a good error */
| expr LCOMM expr
{
$$ = Nod(OSEND, $1, $3);
}
uexpr:
pexpr
| '*' uexpr
{
$$ = Nod(OIND, $2, nil);
}
| '&' uexpr
{
if $2.Op == OCOMPLIT {
// Special case for &T{...}: turn into (*T){...}.
$$ = $2;
$$.Right = Nod(OIND, $$.Right, nil);
$$.Right.Implicit = true;
} else {
$$ = Nod(OADDR, $2, nil);
}
}
| '+' uexpr
{
$$ = Nod(OPLUS, $2, nil);
}
| '-' uexpr
{
$$ = Nod(OMINUS, $2, nil);
}
| '!' uexpr
{
$$ = Nod(ONOT, $2, nil);
}
| '~' uexpr
{
Yyerror("the bitwise complement operator is ^");
$$ = Nod(OCOM, $2, nil);
}
| '^' uexpr
{
$$ = Nod(OCOM, $2, nil);
}
| LCOMM uexpr
{
$$ = Nod(ORECV, $2, nil);
}
/*
* call-like statements that
* can be preceded by 'defer' and 'go'
*/
pseudocall:
pexpr '(' ')'
{
$$ = Nod(OCALL, $1, nil);
}
| pexpr '(' expr_or_type_list ocomma ')'
{
$$ = Nod(OCALL, $1, nil);
$$.List = $3;
}
| pexpr '(' expr_or_type_list LDDD ocomma ')'
{
$$ = Nod(OCALL, $1, nil);
$$.List = $3;
$$.Isddd = true;
}
pexpr_no_paren:
LLITERAL
{
$$ = nodlit($1);
}
| name
| pexpr '.' sym
{
if $1.Op == OPACK {
var s *Sym
s = restrictlookup($3.Name, $1.Name.Pkg);
$1.Used = true;
$$ = oldname(s);
break;
}
$$ = Nod(OXDOT, $1, newname($3));
}
| pexpr '.' '(' expr_or_type ')'
{
$$ = Nod(ODOTTYPE, $1, $4);
}
| pexpr '.' '(' LTYPE ')'
{
$$ = Nod(OTYPESW, nil, $1);
}
| pexpr '[' expr ']'
{
$$ = Nod(OINDEX, $1, $3);
}
| pexpr '[' oexpr ':' oexpr ']'
{
$$ = Nod(OSLICE, $1, Nod(OKEY, $3, $5));
}
| pexpr '[' oexpr ':' oexpr ':' oexpr ']'
{
if $5 == nil {
Yyerror("middle index required in 3-index slice");
}
if $7 == nil {
Yyerror("final index required in 3-index slice");
}
$$ = Nod(OSLICE3, $1, Nod(OKEY, $3, Nod(OKEY, $5, $7)));
}
| pseudocall
| convtype '(' expr ocomma ')'
{
// conversion
$$ = Nod(OCALL, $1, nil);
$$.List = list1($3);
}
| comptype lbrace start_complit braced_keyval_list '}'
{
$$ = $3;
$$.Right = $1;
$$.List = $4;
fixlbrace($2);
}
| pexpr_no_paren '{' start_complit braced_keyval_list '}'
{
$$ = $3;
$$.Right = $1;
$$.List = $4;
}
| '(' expr_or_type ')' '{' start_complit braced_keyval_list '}'
{
Yyerror("cannot parenthesize type in composite literal");
$$ = $5;
$$.Right = $2;
$$.List = $6;
}
| fnliteral
start_complit:
{
// composite expression.
// make node early so we get the right line number.
$$ = Nod(OCOMPLIT, nil, nil);
}
keyval:
complitexpr ':' complitexpr
{
$$ = Nod(OKEY, $1, $3);
}
bare_complitexpr:
expr
{
// These nodes do not carry line numbers.
// Since a composite literal commonly spans several lines,
// the line number on errors may be misleading.
// Introduce a wrapper node to give the correct line.
$$ = $1;
switch($$.Op) {
case ONAME, ONONAME, OTYPE, OPACK, OLITERAL:
$$ = Nod(OPAREN, $$, nil);
$$.Implicit = true;
}
}
| '{' start_complit braced_keyval_list '}'
{
$$ = $2;
$$.List = $3;
}
complitexpr:
expr
| '{' start_complit braced_keyval_list '}'
{
$$ = $2;
$$.List = $3;
}
pexpr:
pexpr_no_paren
| '(' expr_or_type ')'
{
$$ = $2;
// Need to know on lhs of := whether there are ( ).
// Don't bother with the OPAREN in other cases:
// it's just a waste of memory and time.
switch($$.Op) {
case ONAME, ONONAME, OPACK, OTYPE, OLITERAL, OTYPESW:
$$ = Nod(OPAREN, $$, nil);
}
}
expr_or_type:
expr
| non_expr_type %prec PreferToRightParen
name_or_type:
ntype
lbrace:
LBODY
{
$$ = LBODY;
}
| '{'
{
$$ = '{';
}
/*
* names and types
* newname is used before declared
* oldname is used after declared
*/
new_name:
sym
{
if $1 == nil {
$$ = nil;
} else {
$$ = newname($1);
}
}
dcl_name:
sym
{
$$ = dclname($1);
}
onew_name:
{
$$ = nil;
}
| new_name
sym:
LNAME
{
$$ = $1;
// during imports, unqualified non-exported identifiers are from builtinpkg
if importpkg != nil && !exportname($1.Name) {
$$ = Pkglookup($1.Name, builtinpkg);
}
}
| hidden_importsym
| '?'
{
$$ = nil;
}
hidden_importsym:
'@' LLITERAL '.' LNAME
{
var p *Pkg
if $2.U.(string) == "" {
p = importpkg;
} else {
if isbadimport($2.U.(string)) {
errorexit();
}
p = mkpkg($2.U.(string));
}
$$ = Pkglookup($4.Name, p);
}
| '@' LLITERAL '.' '?'
{
var p *Pkg
if $2.U.(string) == "" {
p = importpkg;
} else {
if isbadimport($2.U.(string)) {
errorexit();
}
p = mkpkg($2.U.(string));
}
$$ = Pkglookup("?", p);
}
name:
sym %prec NotParen
{
$$ = oldname($1);
if $$.Name != nil && $$.Name.Pack != nil {
$$.Name.Pack.Used = true;
}
}
labelname:
new_name
/*
* to avoid parsing conflicts, type is split into
* channel types
* function types
* parenthesized types
* any other type
* the type system makes additional restrictions,
* but those are not implemented in the grammar.
*/
dotdotdot:
LDDD
{
Yyerror("final argument in variadic function missing type");
$$ = Nod(ODDD, typenod(typ(TINTER)), nil);
}
| LDDD ntype
{
$$ = Nod(ODDD, $2, nil);
}
ntype:
recvchantype
| fntype
| othertype
| ptrtype
| dotname
| '(' ntype ')'
{
$$ = $2;
}
non_expr_type:
recvchantype
| fntype
| othertype
| '*' non_expr_type
{
$$ = Nod(OIND, $2, nil);
}
non_recvchantype:
fntype
| othertype
| ptrtype
| dotname
| '(' ntype ')'
{
$$ = $2;
}
convtype:
fntype
| othertype
comptype:
othertype
fnret_type:
recvchantype
| fntype
| othertype
| ptrtype
| dotname
dotname:
name
| name '.' sym
{
if $1.Op == OPACK {
var s *Sym
s = restrictlookup($3.Name, $1.Name.Pkg);
$1.Used = true;
$$ = oldname(s);
break;
}
$$ = Nod(OXDOT, $1, newname($3));
}
othertype:
'[' oexpr ']' ntype
{
$$ = Nod(OTARRAY, $2, $4);
}
| '[' LDDD ']' ntype
{
// array literal of nelem
$$ = Nod(OTARRAY, Nod(ODDD, nil, nil), $4);
}
| LCHAN non_recvchantype
{
$$ = Nod(OTCHAN, $2, nil);
$$.Etype = Cboth;
}
| LCHAN LCOMM ntype
{
$$ = Nod(OTCHAN, $3, nil);
$$.Etype = Csend;
}
| LMAP '[' ntype ']' ntype
{
$$ = Nod(OTMAP, $3, $5);
}
| structtype
| interfacetype
ptrtype:
'*' ntype
{
$$ = Nod(OIND, $2, nil);
}
recvchantype:
LCOMM LCHAN ntype
{
$$ = Nod(OTCHAN, $3, nil);
$$.Etype = Crecv;
}
structtype:
LSTRUCT lbrace structdcl_list osemi '}'
{
$$ = Nod(OTSTRUCT, nil, nil);
$$.List = $3;
fixlbrace($2);
}
| LSTRUCT lbrace '}'
{
$$ = Nod(OTSTRUCT, nil, nil);
fixlbrace($2);
}
interfacetype:
LINTERFACE lbrace interfacedcl_list osemi '}'
{
$$ = Nod(OTINTER, nil, nil);
$$.List = $3;
fixlbrace($2);
}
| LINTERFACE lbrace '}'
{
$$ = Nod(OTINTER, nil, nil);
fixlbrace($2);
}
/*
* function stuff
* all in one place to show how crappy it all is
*/
xfndcl:
LFUNC fndcl fnbody
{
$$ = $2;
if $$ == nil {
break;
}
if noescape && $3 != nil {
Yyerror("can only use //go:noescape with external func implementations");
}
$$.Nbody = $3;
$$.Func.Endlineno = lineno;
$$.Noescape = noescape;
$$.Func.Norace = norace;
$$.Func.Nosplit = nosplit;
$$.Func.Noinline = noinline;
$$.Func.Nowritebarrier = nowritebarrier;
$$.Func.Nowritebarrierrec = nowritebarrierrec;
$$.Func.Systemstack = systemstack;
funcbody($$);
}
fndcl:
sym '(' oarg_type_list_ocomma ')' fnres
{
var t *Node
$$ = nil;
$3 = checkarglist($3, 1);
if $1.Name == "init" {
$1 = renameinit();
if $3 != nil || $5 != nil {
Yyerror("func init must have no arguments and no return values");
}
}
if localpkg.Name == "main" && $1.Name == "main" {
if $3 != nil || $5 != nil {
Yyerror("func main must have no arguments and no return values");
}
}
t = Nod(OTFUNC, nil, nil);
t.List = $3;
t.Rlist = $5;
$$ = Nod(ODCLFUNC, nil, nil);
$$.Func.Nname = newfuncname($1);
$$.Func.Nname.Name.Defn = $$;
$$.Func.Nname.Name.Param.Ntype = t; // TODO: check if nname already has an ntype
declare($$.Func.Nname, PFUNC);
funchdr($$);
}
| '(' oarg_type_list_ocomma ')' sym '(' oarg_type_list_ocomma ')' fnres
{
var rcvr, t *Node
$$ = nil;
$2 = checkarglist($2, 0);
$6 = checkarglist($6, 1);
if $2 == nil {
Yyerror("method has no receiver");
break;
}
if $2.Next != nil {
Yyerror("method has multiple receivers");
break;
}
rcvr = $2.N;
if rcvr.Op != ODCLFIELD {
Yyerror("bad receiver in method");
break;
}
t = Nod(OTFUNC, rcvr, nil);
t.List = $6;
t.Rlist = $8;
$$ = Nod(ODCLFUNC, nil, nil);
$$.Func.Shortname = newfuncname($4);
$$.Func.Nname = methodname1($$.Func.Shortname, rcvr.Right);
$$.Func.Nname.Name.Defn = $$;
$$.Func.Nname.Name.Param.Ntype = t;
$$.Func.Nname.Nointerface = nointerface;
declare($$.Func.Nname, PFUNC);
funchdr($$);
}
hidden_fndcl:
hidden_pkg_importsym '(' ohidden_funarg_list ')' ohidden_funres
{
var s *Sym
var t *Type
$$ = nil;
s = $1;
t = functype(nil, $3, $5);
importsym(s, ONAME);
if s.Def != nil && s.Def.Op == ONAME {
if Eqtype(t, s.Def.Type) {
dclcontext = PDISCARD; // since we skip funchdr below
break;
}
Yyerror("inconsistent definition for func %v during import\n\t%v\n\t%v", s, s.Def.Type, t);
}
$$ = newfuncname(s);
$$.Type = t;
declare($$, PFUNC);
funchdr($$);
}
| '(' hidden_funarg_list ')' sym '(' ohidden_funarg_list ')' ohidden_funres
{
$$ = methodname1(newname($4), $2.N.Right);
$$.Type = functype($2.N, $6, $8);
checkwidth($$.Type);
addmethod($4, $$.Type, false, nointerface);
nointerface = false
funchdr($$);
// inl.C's inlnode in on a dotmeth node expects to find the inlineable body as
// (dotmeth's type).Nname.Inl, and dotmeth's type has been pulled
// out by typecheck's lookdot as this $$.ttype. So by providing
// this back link here we avoid special casing there.
$$.Type.Nname = $$;
}
fntype:
LFUNC '(' oarg_type_list_ocomma ')' fnres
{
$3 = checkarglist($3, 1);
$$ = Nod(OTFUNC, nil, nil);
$$.List = $3;
$$.Rlist = $5;
}
fnbody:
{
$$ = nil;
}
| '{' stmt_list '}'
{
$$ = $2;
if $$ == nil {
$$ = list1(Nod(OEMPTY, nil, nil));
}
}
fnres:
%prec NotParen
{
$$ = nil;
}
| fnret_type
{
$$ = list1(Nod(ODCLFIELD, nil, $1));
}
| '(' oarg_type_list_ocomma ')'
{
$2 = checkarglist($2, 0);
$$ = $2;
}
fnlitdcl:
fntype
{
closurehdr($1);
}
fnliteral:
fnlitdcl lbrace stmt_list '}'
{
$$ = closurebody($3);
fixlbrace($2);
}
| fnlitdcl error
{
$$ = closurebody(nil);
}
/*
* lists of things
* note that they are left recursive
* to conserve yacc stack. they need to
* be reversed to interpret correctly
*/
xdcl_list:
{
$$ = nil;
}
| xdcl_list xdcl ';'
{
$$ = concat($1, $2);
if nsyntaxerrors == 0 {
testdclstack();
}
noescape = false
noinline = false
nointerface = false
norace = false
nosplit = false
nowritebarrier = false
nowritebarrierrec = false
systemstack = false
}
vardcl_list:
vardcl
| vardcl_list ';' vardcl
{
$$ = concat($1, $3);
}
constdcl_list:
constdcl1
| constdcl_list ';' constdcl1
{
$$ = concat($1, $3);
}
typedcl_list:
typedcl
{
$$ = list1($1);
}
| typedcl_list ';' typedcl
{
$$ = list($1, $3);
}
structdcl_list:
structdcl
| structdcl_list ';' structdcl
{
$$ = concat($1, $3);
}
interfacedcl_list:
interfacedcl
{
$$ = list1($1);
}
| interfacedcl_list ';' interfacedcl
{
$$ = list($1, $3);
}
structdcl:
new_name_list ntype oliteral
{
var l *NodeList
var n *Node
l = $1;
if l == nil || l.N.Sym.Name == "?" {
// ? symbol, during import (list1(nil) == nil)
n = $2;
if n.Op == OIND {
n = n.Left;
}
n = embedded(n.Sym, importpkg);
n.Right = $2;
n.SetVal($3)
$$ = list1(n);
break;
}
for l=$1; l != nil; l=l.Next {
l.N = Nod(ODCLFIELD, l.N, $2);
l.N.SetVal($3)
}
}
| embed oliteral
{
$1.SetVal($2)
$$ = list1($1);
}
| '(' embed ')' oliteral
{
$2.SetVal($4)
$$ = list1($2);
Yyerror("cannot parenthesize embedded type");
}
| '*' embed oliteral
{
$2.Right = Nod(OIND, $2.Right, nil);
$2.SetVal($3)
$$ = list1($2);
}
| '(' '*' embed ')' oliteral
{
$3.Right = Nod(OIND, $3.Right, nil);
$3.SetVal($5)
$$ = list1($3);
Yyerror("cannot parenthesize embedded type");
}
| '*' '(' embed ')' oliteral
{
$3.Right = Nod(OIND, $3.Right, nil);
$3.SetVal($5)
$$ = list1($3);
Yyerror("cannot parenthesize embedded type");
}
packname:
LNAME
{
var n *Node
$$ = $1;
n = oldname($1);
if n.Name != nil && n.Name.Pack != nil {
n.Name.Pack.Used = true;
}
}
| LNAME '.' sym
{
var pkg *Pkg
if $1.Def == nil || $1.Def.Op != OPACK {
Yyerror("%v is not a package", $1);
pkg = localpkg;
} else {
$1.Def.Used = true;
pkg = $1.Def.Name.Pkg;
}
$$ = restrictlookup($3.Name, pkg);
}
embed:
packname
{
$$ = embedded($1, localpkg);
}
interfacedcl:
new_name indcl
{
$$ = Nod(ODCLFIELD, $1, $2);
ifacedcl($$);
}
| packname
{
$$ = Nod(ODCLFIELD, nil, oldname($1));
}
| '(' packname ')'
{
$$ = Nod(ODCLFIELD, nil, oldname($2));
Yyerror("cannot parenthesize embedded type");
}
indcl:
'(' oarg_type_list_ocomma ')' fnres
{
// without func keyword
$2 = checkarglist($2, 1);
$$ = Nod(OTFUNC, fakethis(), nil);
$$.List = $2;
$$.Rlist = $4;
}
/*
* function arguments.
*/
arg_type:
name_or_type
| sym name_or_type
{
$$ = Nod(ONONAME, nil, nil);
$$.Sym = $1;
$$ = Nod(OKEY, $$, $2);
}
| sym dotdotdot
{
$$ = Nod(ONONAME, nil, nil);
$$.Sym = $1;
$$ = Nod(OKEY, $$, $2);
}
| dotdotdot
arg_type_list:
arg_type
{
$$ = list1($1);
}
| arg_type_list ',' arg_type
{
$$ = list($1, $3);
}
oarg_type_list_ocomma:
{
$$ = nil;
}
| arg_type_list ocomma
{
$$ = $1;
}
/*
* statement
*/
stmt:
{
$$ = nil;
}
| compound_stmt
| common_dcl
{
$$ = liststmt($1);
}
| non_dcl_stmt
| error
{
$$ = nil;
}
non_dcl_stmt:
simple_stmt
| for_stmt
| switch_stmt
| select_stmt
| if_stmt
| labelname ':'
{
$1 = Nod(OLABEL, $1, nil);
$1.Sym = dclstack; // context, for goto restrictions
}
stmt
{
var l *NodeList
$1.Name.Defn = $4;
l = list1($1);
if $4 != nil {
l = list(l, $4);
}
$$ = liststmt(l);
}
| LFALL
{
// will be converted to OFALL
$$ = Nod(OXFALL, nil, nil);
$$.Xoffset = int64(block);
}
| LBREAK onew_name
{
$$ = Nod(OBREAK, $2, nil);
}
| LCONTINUE onew_name
{
$$ = Nod(OCONTINUE, $2, nil);
}
| LGO pseudocall
{
$$ = Nod(OPROC, $2, nil);
}
| LDEFER pseudocall
{
$$ = Nod(ODEFER, $2, nil);
}
| LGOTO new_name
{
$$ = Nod(OGOTO, $2, nil);
$$.Sym = dclstack; // context, for goto restrictions
}
| LRETURN oexpr_list
{
$$ = Nod(ORETURN, nil, nil);
$$.List = $2;
if $$.List == nil && Curfn != nil {
var l *NodeList
for l=Curfn.Func.Dcl; l != nil; l=l.Next {
if l.N.Class == PPARAM {
continue;
}
if l.N.Class != PPARAMOUT {
break;
}
if l.N.Sym.Def != l.N {
Yyerror("%s is shadowed during return", l.N.Sym.Name);
}
}
}
}
stmt_list:
stmt
{
$$ = nil;
if $1 != nil {
$$ = list1($1);
}
}
| stmt_list ';' stmt
{
$$ = $1;
if $3 != nil {
$$ = list($$, $3);
}
}
new_name_list:
new_name
{
$$ = list1($1);
}
| new_name_list ',' new_name
{
$$ = list($1, $3);
}
dcl_name_list:
dcl_name
{
$$ = list1($1);
}
| dcl_name_list ',' dcl_name
{
$$ = list($1, $3);
}
expr_list:
expr
{
$$ = list1($1);
}
| expr_list ',' expr
{
$$ = list($1, $3);
}
expr_or_type_list:
expr_or_type
{
$$ = list1($1);
}
| expr_or_type_list ',' expr_or_type
{
$$ = list($1, $3);
}
/*
* list of combo of keyval and val
*/
keyval_list:
keyval
{
$$ = list1($1);
}
| bare_complitexpr
{
$$ = list1($1);
}
| keyval_list ',' keyval
{
$$ = list($1, $3);
}
| keyval_list ',' bare_complitexpr
{
$$ = list($1, $3);
}
braced_keyval_list:
{
$$ = nil;
}
| keyval_list ocomma
{
$$ = $1;
}
/*
* optional things
*/
osemi:
| ';'
ocomma:
| ','
oexpr:
{
$$ = nil;
}
| expr
oexpr_list:
{
$$ = nil;
}
| expr_list
osimple_stmt:
{
$$ = nil;
}
| simple_stmt
ohidden_funarg_list:
{
$$ = nil;
}
| hidden_funarg_list
ohidden_structdcl_list:
{
$$ = nil;
}
| hidden_structdcl_list
ohidden_interfacedcl_list:
{
$$ = nil;
}
| hidden_interfacedcl_list
oliteral:
{
$$.U = nil
}
| LLITERAL
/*
* import syntax from package header
*/
hidden_import:
LIMPORT LNAME LLITERAL ';'
{
importimport($2, $3.U.(string));
}
| LVAR hidden_pkg_importsym hidden_type ';'
{
importvar($2, $3);
}
| LCONST hidden_pkg_importsym '=' hidden_constant ';'
{
importconst($2, Types[TIDEAL], $4);
}
| LCONST hidden_pkg_importsym hidden_type '=' hidden_constant ';'
{
importconst($2, $3, $5);
}
| LTYPE hidden_pkgtype hidden_type ';'
{
importtype($2, $3);
}
| LFUNC hidden_fndcl fnbody ';'
{
if $2 == nil {
dclcontext = PEXTERN; // since we skip the funcbody below
break;
}
$2.Func.Inl = $3;
funcbody($2);
importlist = append(importlist, $2);
if Debug['E'] > 0 {
fmt.Printf("import [%q] func %v \n", importpkg.Path, $2)
if Debug['m'] > 2 && $2.Func.Inl != nil {
fmt.Printf("inl body:%v\n", $2.Func.Inl)
}
}
}
hidden_pkg_importsym:
hidden_importsym
{
$$ = $1;
structpkg = $$.Pkg;
}
hidden_pkgtype:
hidden_pkg_importsym
{
$$ = pkgtype($1);
importsym($1, OTYPE);
}
/*
* importing types
*/
hidden_type:
hidden_type_misc
| hidden_type_recv_chan
| hidden_type_func
hidden_type_non_recv_chan:
hidden_type_misc
| hidden_type_func
hidden_type_misc:
hidden_importsym
{
$$ = pkgtype($1);
}
| LNAME
{
// predefined name like uint8
$1 = Pkglookup($1.Name, builtinpkg);
if $1.Def == nil || $1.Def.Op != OTYPE {
Yyerror("%s is not a type", $1.Name);
$$ = nil;
} else {
$$ = $1.Def.Type;
}
}
| '[' ']' hidden_type
{
$$ = aindex(nil, $3);
}
| '[' LLITERAL ']' hidden_type
{
$$ = aindex(nodlit($2), $4);
}
| LMAP '[' hidden_type ']' hidden_type
{
$$ = maptype($3, $5);
}
| LSTRUCT '{' ohidden_structdcl_list '}'
{
$$ = tostruct($3);
}
| LINTERFACE '{' ohidden_interfacedcl_list '}'
{
$$ = tointerface($3);
}
| '*' hidden_type
{
$$ = Ptrto($2);
}
| LCHAN hidden_type_non_recv_chan
{
$$ = typ(TCHAN);
$$.Type = $2;
$$.Chan = Cboth;
}
| LCHAN '(' hidden_type_recv_chan ')'
{
$$ = typ(TCHAN);
$$.Type = $3;
$$.Chan = Cboth;
}
| LCHAN LCOMM hidden_type
{
$$ = typ(TCHAN);
$$.Type = $3;
$$.Chan = Csend;
}
hidden_type_recv_chan:
LCOMM LCHAN hidden_type
{
$$ = typ(TCHAN);
$$.Type = $3;
$$.Chan = Crecv;
}
hidden_type_func:
LFUNC '(' ohidden_funarg_list ')' ohidden_funres
{
$$ = functype(nil, $3, $5);
}
hidden_funarg:
sym hidden_type oliteral
{
$$ = Nod(ODCLFIELD, nil, typenod($2));
if $1 != nil {
$$.Left = newname($1);
}
$$.SetVal($3)
}
| sym LDDD hidden_type oliteral
{
var t *Type
t = typ(TARRAY);
t.Bound = -1;
t.Type = $3;
$$ = Nod(ODCLFIELD, nil, typenod(t));
if $1 != nil {
$$.Left = newname($1);
}
$$.Isddd = true;
$$.SetVal($4)
}
hidden_structdcl:
sym hidden_type oliteral
{
var s *Sym
var p *Pkg
if $1 != nil && $1.Name != "?" {
$$ = Nod(ODCLFIELD, newname($1), typenod($2));
$$.SetVal($3)
} else {
s = $2.Sym;
if s == nil && Isptr[$2.Etype] {
s = $2.Type.Sym;
}
p = importpkg;
if $1 != nil {
p = $1.Pkg;
}
$$ = embedded(s, p);
$$.Right = typenod($2);
$$.SetVal($3)
}
}
hidden_interfacedcl:
sym '(' ohidden_funarg_list ')' ohidden_funres
{
$$ = Nod(ODCLFIELD, newname($1), typenod(functype(fakethis(), $3, $5)));
}
| hidden_type
{
$$ = Nod(ODCLFIELD, nil, typenod($1));
}
ohidden_funres:
{
$$ = nil;
}
| hidden_funres
hidden_funres:
'(' ohidden_funarg_list ')'
{
$$ = $2;
}
| hidden_type
{
$$ = list1(Nod(ODCLFIELD, nil, typenod($1)));
}
/*
* importing constants
*/
hidden_literal:
LLITERAL
{
$$ = nodlit($1);
}
| '-' LLITERAL
{
$$ = nodlit($2);
switch($$.Val().Ctype()){
case CTINT, CTRUNE:
mpnegfix($$.Val().U.(*Mpint));
break;
case CTFLT:
mpnegflt($$.Val().U.(*Mpflt));
break;
case CTCPLX:
mpnegflt(&$$.Val().U.(*Mpcplx).Real);
mpnegflt(&$$.Val().U.(*Mpcplx).Imag);
break;
default:
Yyerror("bad negated constant");
}
}
| sym
{
$$ = oldname(Pkglookup($1.Name, builtinpkg));
if $$.Op != OLITERAL {
Yyerror("bad constant %v", $$.Sym);
}
}
hidden_constant:
hidden_literal
| '(' hidden_literal '+' hidden_literal ')'
{
if $2.Val().Ctype() == CTRUNE && $4.Val().Ctype() == CTINT {
$$ = $2;
mpaddfixfix($2.Val().U.(*Mpint), $4.Val().U.(*Mpint), 0);
break;
}
$4.Val().U.(*Mpcplx).Real = $4.Val().U.(*Mpcplx).Imag;
Mpmovecflt(&$4.Val().U.(*Mpcplx).Imag, 0.0);
$$ = nodcplxlit($2.Val(), $4.Val());
}
hidden_import_list:
| hidden_import_list hidden_import
hidden_funarg_list:
hidden_funarg
{
$$ = list1($1);
}
| hidden_funarg_list ',' hidden_funarg
{
$$ = list($1, $3);
}
hidden_structdcl_list:
hidden_structdcl
{
$$ = list1($1);
}
| hidden_structdcl_list ';' hidden_structdcl
{
$$ = list($1, $3);
}
hidden_interfacedcl_list:
hidden_interfacedcl
{
$$ = list1($1);
}
| hidden_interfacedcl_list ';' hidden_interfacedcl
{
$$ = list($1, $3);
}
%%
func fixlbrace(lbr int) {
// If the opening brace was an LBODY,
// set up for another one now that we're done.
// See comment in lex.C about loophack.
if lbr == LBODY {
loophack = true
}
}
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:generate go tool yacc go.y
//go:generate go run mkbuiltin.go runtime unsafe
package gc
......@@ -203,7 +202,6 @@ func Main() {
obj.Flagcount("m", "print optimization decisions", &Debug['m'])
obj.Flagcount("msan", "build code compatible with C/C++ memory sanitizer", &flag_msan)
obj.Flagcount("newexport", "use new export format", &newexport) // TODO(gri) remove eventually (issue 13241)
obj.Flagcount("oldparser", "use old parser", &oldparser) // TODO(gri) remove eventually (issue 13240)
obj.Flagcount("nolocalimports", "reject local (relative) imports", &nolocalimports)
obj.Flagstr("o", "write output to `file`", &outfile)
obj.Flagstr("p", "set expected package import `path`", &myimportpath)
......@@ -318,16 +316,8 @@ func Main() {
lexlineno = 1
const BOM = 0xFEFF
// Uncomment the line below to temporarily switch the compiler back
// to the yacc-based parser. Short-term work-around for issues with
// the new recursive-descent parser for which setting -oldparser is
// not sufficient.
// TODO(gri) remove this eventually (issue 13240)
//
// oldparser = 1
for _, infile = range flag.Args() {
if trace && Debug['x'] != 0 && oldparser == 0 {
if trace && Debug['x'] != 0 {
fmt.Printf("--- %s ---\n", infile)
}
......@@ -844,9 +834,7 @@ func importfile(f *Val, line int) {
curio.nlsemi = false
typecheckok = true
if oldparser == 0 {
push_parser()
}
push_parser()
case 'B':
// new export format
......@@ -867,9 +855,7 @@ func importfile(f *Val, line int) {
}
func unimportfile() {
if oldparser == 0 {
pop_parser()
}
pop_parser()
if curio.bin != nil {
obj.Bterm(curio.bin)
......@@ -901,9 +887,7 @@ func cannedimports(file string, cp string) {
typecheckok = true
incannedimport = 1
if oldparser == 0 {
push_parser()
}
push_parser()
}
func isSpace(c int) bool {
......@@ -945,12 +929,64 @@ func isfrog(c int) bool {
return false
}
type Loophack struct {
next *Loophack
v bool
type yySymType struct {
yys int
node *Node
list *NodeList
typ *Type
sym *Sym
val Val
i int
}
var _yylex_lstk *Loophack
const (
LLITERAL = 57346 + iota
LASOP
LCOLAS
LBREAK
LCASE
LCHAN
LCONST
LCONTINUE
LDDD
LDEFAULT
LDEFER
LELSE
LFALL
LFOR
LFUNC
LGO
LGOTO
LIF
LIMPORT
LINTERFACE
LMAP
LNAME
LPACKAGE
LRANGE
LRETURN
LSELECT
LSTRUCT
LSWITCH
LTYPE
LVAR
LANDAND
LANDNOT
LBODY
LCOMM
LDEC
LEQ
LGE
LGT
LIGNORE
LINC
LLE
LLSH
LLT
LNE
LOROR
LRSH
)
func _yylex(yylval *yySymType) int32 {
var c1 int
......@@ -958,7 +994,6 @@ func _yylex(yylval *yySymType) int32 {
var v int64
var cp *bytes.Buffer
var s *Sym
var h *Loophack
var str string
prevlineno = lineno
......@@ -1367,61 +1402,6 @@ l0:
goto asop
}
// clumsy dance:
// to implement rule that disallows
// if T{1}[0] { ... }
// but allows
// if (T{1}[0]) { ... }
// the block bodies for if/for/switch/select
// begin with an LBODY token, not '{'.
//
// when we see the keyword, the next
// non-parenthesized '{' becomes an LBODY.
// loophack is normally false.
// a keyword sets it to true.
// parens push loophack onto a stack and go back to false.
// a '{' with loophack == true becomes LBODY and disables loophack.
//
// I said it was clumsy.
//
// We only need the loophack when running with -oldparser.
case '(', '[':
if oldparser != 0 && (loophack || _yylex_lstk != nil) {
h = new(Loophack)
if h == nil {
Flusherrors()
Yyerror("out of memory")
errorexit()
}
h.v = loophack
h.next = _yylex_lstk
_yylex_lstk = h
loophack = false
}
goto lx
case ')', ']':
if oldparser != 0 && _yylex_lstk != nil {
h = _yylex_lstk
loophack = h.v
_yylex_lstk = h.next
}
goto lx
case '{':
if oldparser != 0 && loophack {
if Debug['x'] != 0 {
fmt.Printf("%v lex: LBODY\n", Ctxt.Line(int(lexlineno)))
}
loophack = false
return LBODY
}
goto lx
default:
goto lx
}
......@@ -1485,14 +1465,8 @@ talph:
ungetc(c)
s = LookupBytes(lexbuf.Bytes())
switch s.Lexical {
case LIGNORE:
if s.Lexical == LIGNORE {
goto l0
case LFOR, LIF, LSWITCH, LSELECT:
if oldparser != 0 {
loophack = true // see comment about loophack above
}
}
if Debug['x'] != 0 {
......@@ -1934,18 +1908,11 @@ func (yy) Error(msg string) {
Yyerror("%s", msg)
}
var oldparser int // if set, theparser is used (otherwise we use the recursive-descent parser)
var theparser yyParser
var parsing bool
func yyparse() {
parsing = true
if oldparser != 0 {
theparser = yyNewParser()
theparser.Parse(yy{})
} else {
parse_file()
}
parse_file()
parsing = false
}
......@@ -2617,20 +2584,6 @@ var yytfix = map[string]string{
"','": "comma",
}
func init() {
yyErrorVerbose = true
for i, s := range yyToknames {
// Apply yytfix if possible.
if fix, ok := yytfix[s]; ok {
yyToknames[i] = fix
} else if len(s) == 3 && s[0] == '\'' && s[2] == '\'' {
// Turn 'x' into x.
yyToknames[i] = s[1:2]
}
}
}
func pkgnotused(lineno int, path string, name string) {
// If the package was imported with a name other than the final
// import path element, show it explicitly in the error message.
......
......@@ -229,55 +229,52 @@ func tokstring(tok int32) string {
}
var tokstrings = map[int32]string{
LLITERAL: "LLITERAL",
LASOP: "op=",
LCOLAS: ":=",
LBREAK: "break",
LCASE: "case",
LCHAN: "chan",
LCONST: "const",
LCONTINUE: "continue",
LDDD: "...",
LDEFAULT: "default",
LDEFER: "defer",
LELSE: "else",
LFALL: "fallthrough",
LFOR: "for",
LFUNC: "func",
LGO: "go",
LGOTO: "goto",
LIF: "if",
LIMPORT: "import",
LINTERFACE: "interface",
LMAP: "map",
LNAME: "LNAME",
LPACKAGE: "package",
LRANGE: "range",
LRETURN: "return",
LSELECT: "select",
LSTRUCT: "struct",
LSWITCH: "switch",
LTYPE: "type",
LVAR: "var",
LANDAND: "&&",
LANDNOT: "&^",
LBODY: "LBODY", // we should never see this one
LCOMM: "<-",
LDEC: "--",
LEQ: "==",
LGE: ">=",
LGT: ">",
LIGNORE: "LIGNORE", // we should never see this one
LINC: "++",
LLE: "<=",
LLSH: "<<",
LLT: "<",
LNE: "!=",
LOROR: "||",
LRSH: ">>",
NotPackage: "NotPackage", // we should never see this one
NotParen: "NotParen", // we should never see this one
PreferToRightParen: "PreferToRightParen", // we should never see this one
LLITERAL: "LLITERAL",
LASOP: "op=",
LCOLAS: ":=",
LBREAK: "break",
LCASE: "case",
LCHAN: "chan",
LCONST: "const",
LCONTINUE: "continue",
LDDD: "...",
LDEFAULT: "default",
LDEFER: "defer",
LELSE: "else",
LFALL: "fallthrough",
LFOR: "for",
LFUNC: "func",
LGO: "go",
LGOTO: "goto",
LIF: "if",
LIMPORT: "import",
LINTERFACE: "interface",
LMAP: "map",
LNAME: "LNAME",
LPACKAGE: "package",
LRANGE: "range",
LRETURN: "return",
LSELECT: "select",
LSTRUCT: "struct",
LSWITCH: "switch",
LTYPE: "type",
LVAR: "var",
LANDAND: "&&",
LANDNOT: "&^",
LBODY: "LBODY", // we should never see this one
LCOMM: "<-",
LDEC: "--",
LEQ: "==",
LGE: ">=",
LGT: ">",
LIGNORE: "LIGNORE", // we should never see this one
LINC: "++",
LLE: "<=",
LLSH: "<<",
LLT: "<",
LNE: "!=",
LOROR: "||",
LRSH: ">>",
}
// usage: defer p.trace(msg)()
......
......@@ -34,10 +34,6 @@ func errorexit() {
}
func parserline() int {
if oldparser != 0 && parsing && theparser.Lookahead() > 0 {
// parser has one symbol lookahead
return int(prevlineno)
}
return int(lineno)
}
......
//line go.y:21
package gc
import __yyfmt__ "fmt"
//line go.y:21
import (
"fmt"
"strings"
)
//line go.y:28
type yySymType struct {
yys int
node *Node
list *NodeList
typ *Type
sym *Sym
val Val
i int
}
const LLITERAL = 57346
const LASOP = 57347
const LCOLAS = 57348
const LBREAK = 57349
const LCASE = 57350
const LCHAN = 57351
const LCONST = 57352
const LCONTINUE = 57353
const LDDD = 57354
const LDEFAULT = 57355
const LDEFER = 57356
const LELSE = 57357
const LFALL = 57358
const LFOR = 57359
const LFUNC = 57360
const LGO = 57361
const LGOTO = 57362
const LIF = 57363
const LIMPORT = 57364
const LINTERFACE = 57365
const LMAP = 57366
const LNAME = 57367
const LPACKAGE = 57368
const LRANGE = 57369
const LRETURN = 57370
const LSELECT = 57371
const LSTRUCT = 57372
const LSWITCH = 57373
const LTYPE = 57374
const LVAR = 57375
const LANDAND = 57376
const LANDNOT = 57377
const LBODY = 57378
const LCOMM = 57379
const LDEC = 57380
const LEQ = 57381
const LGE = 57382
const LGT = 57383
const LIGNORE = 57384
const LINC = 57385
const LLE = 57386
const LLSH = 57387
const LLT = 57388
const LNE = 57389
const LOROR = 57390
const LRSH = 57391
const NotPackage = 57392
const NotParen = 57393
const PreferToRightParen = 57394
var yyToknames = [...]string{
"$end",
"error",
"$unk",
"LLITERAL",
"LASOP",
"LCOLAS",
"LBREAK",
"LCASE",
"LCHAN",
"LCONST",
"LCONTINUE",
"LDDD",
"LDEFAULT",
"LDEFER",
"LELSE",
"LFALL",
"LFOR",
"LFUNC",
"LGO",
"LGOTO",
"LIF",
"LIMPORT",
"LINTERFACE",
"LMAP",
"LNAME",
"LPACKAGE",
"LRANGE",
"LRETURN",
"LSELECT",
"LSTRUCT",
"LSWITCH",
"LTYPE",
"LVAR",
"LANDAND",
"LANDNOT",
"LBODY",
"LCOMM",
"LDEC",
"LEQ",
"LGE",
"LGT",
"LIGNORE",
"LINC",
"LLE",
"LLSH",
"LLT",
"LNE",
"LOROR",
"LRSH",
"'+'",
"'-'",
"'|'",
"'^'",
"'*'",
"'/'",
"'%'",
"'&'",
"NotPackage",
"NotParen",
"'('",
"')'",
"PreferToRightParen",
"';'",
"'.'",
"'$'",
"'='",
"':'",
"'{'",
"'}'",
"'!'",
"'~'",
"'['",
"']'",
"'?'",
"'@'",
"','",
}
var yyStatenames = [...]string{}
const yyEofCode = 1
const yyErrCode = 2
const yyMaxDepth = 200
//line go.y:2317
func fixlbrace(lbr int) {
// If the opening brace was an LBODY,
// set up for another one now that we're done.
// See comment in lex.C about loophack.
if lbr == LBODY {
loophack = true
}
}
//line yacctab:1
var yyExca = [...]int{
-1, 1,
1, -1,
-2, 0,
-1, 17,
1, 1,
63, 23,
-2, 0,
-1, 48,
6, 276,
66, 276,
76, 276,
-2, 49,
-1, 56,
67, 153,
-2, 162,
-1, 74,
60, 181,
-2, 215,
-1, 75,
60, 182,
-2, 183,
-1, 121,
60, 134,
64, 134,
68, 134,
72, 134,
-2, 266,
-1, 125,
60, 134,
64, 134,
68, 134,
72, 134,
-2, 267,
-1, 176,
2, 215,
36, 215,
60, 181,
68, 215,
-2, 173,
-1, 177,
36, 183,
60, 182,
68, 183,
-2, 174,
-1, 184,
63, 251,
69, 251,
-2, 0,
-1, 242,
63, 251,
69, 251,
-2, 0,
-1, 252,
8, 251,
13, 251,
63, 251,
69, 251,
-2, 0,
-1, 325,
4, 236,
63, 236,
69, 236,
-2, 157,
-1, 403,
67, 144,
-2, 142,
-1, 408,
36, 176,
60, 176,
68, 176,
-2, 167,
-1, 409,
36, 177,
60, 177,
68, 177,
-2, 168,
-1, 410,
36, 178,
60, 178,
68, 178,
-2, 169,
-1, 411,
36, 179,
60, 179,
68, 179,
-2, 170,
-1, 417,
8, 251,
13, 251,
63, 251,
69, 251,
-2, 0,
-1, 418,
63, 251,
69, 251,
-2, 0,
-1, 498,
63, 251,
69, 251,
-2, 0,
-1, 553,
60, 157,
-2, 318,
-1, 554,
60, 158,
-2, 317,
-1, 579,
8, 251,
13, 251,
63, 251,
69, 251,
-2, 0,
-1, 593,
36, 180,
60, 180,
68, 180,
-2, 171,
-1, 632,
67, 145,
-2, 143,
}
const yyNprod = 352
const yyPrivate = 57344
var yyTokenNames []string
var yyStates []string
const yyLast = 2321
var yyAct = [...]int{
74, 304, 381, 291, 487, 611, 459, 285, 546, 229,
398, 467, 34, 296, 75, 302, 402, 550, 290, 186,
286, 479, 458, 356, 400, 401, 389, 338, 103, 318,
328, 245, 303, 339, 324, 243, 337, 468, 101, 374,
109, 104, 248, 85, 14, 246, 241, 174, 480, 212,
6, 181, 325, 155, 470, 469, 325, 385, 332, 517,
108, 627, 414, 373, 13, 208, 585, 11, 176, 461,
470, 172, 584, 461, 652, 600, 230, 219, 392, 191,
106, 322, 177, 542, 226, 322, 423, 321, 193, 88,
10, 321, 13, 192, 10, 310, 317, 309, 154, 160,
447, 12, 13, 161, 227, 12, 13, 446, 198, 227,
10, 162, 227, 320, 209, 227, 462, 384, 228, 663,
462, 626, 625, 228, 55, 460, 228, 155, 184, 228,
203, 628, 205, 633, 199, 200, 108, 632, 204, 12,
13, 222, 393, 12, 13, 86, 214, 216, 218, 90,
604, 239, 175, 10, 449, 194, 233, 88, 153, 12,
13, 176, 661, 213, 213, 213, 213, 288, 155, 282,
282, 601, 282, 537, 417, 177, 445, 280, 10, 176,
621, 528, 295, 163, 164, 165, 166, 167, 168, 169,
170, 227, 417, 177, 417, 301, 227, 227, 594, 227,
485, 88, 12, 13, 185, 228, 417, 524, 48, 308,
228, 228, 416, 228, 202, 347, 516, 90, 472, 448,
405, 428, 10, 242, 349, 171, 298, 12, 13, 345,
343, 341, 227, 581, 507, 330, 344, 507, 182, 508,
519, 397, 508, 348, 116, 175, 228, 367, 227, 334,
464, 227, 227, 360, 227, 129, 325, 355, 371, 210,
346, 90, 228, 175, 353, 228, 228, 362, 228, 182,
183, 12, 13, 54, 435, 314, 173, 10, 342, 358,
340, 13, 340, 340, 91, 379, 188, 378, 325, 380,
376, 331, 365, 375, 176, 623, 369, 394, 505, 417,
408, 183, 610, 163, 170, 12, 13, 605, 177, 410,
227, 227, 415, 238, 409, 118, 118, 602, 575, 126,
227, 569, 559, 331, 228, 228, 12, 13, 466, 465,
391, 444, 327, 443, 228, 437, 425, 12, 13, 254,
413, 388, 255, 256, 257, 258, 259, 260, 261, 262,
263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
273, 274, 129, 129, 277, 227, 440, 383, 370, 173,
366, 294, 359, 491, 227, 424, 411, 442, 175, 228,
10, 455, 493, 333, 454, 436, 100, 492, 228, 300,
99, 84, 10, 509, 176, 481, 282, 512, 474, 20,
657, 282, 656, 655, 499, 495, 614, 227, 177, 503,
654, 484, 10, 227, 340, 340, 234, 515, 520, 521,
646, 228, 620, 617, 227, 340, 608, 228, 221, 12,
13, 607, 511, 129, 526, 430, 433, 69, 228, 518,
227, 12, 13, 598, 597, 129, 596, 293, 96, 494,
525, 593, 583, 563, 228, 529, 98, 490, 540, 532,
94, 12, 13, 523, 514, 513, 510, 560, 538, 558,
97, 95, 330, 323, 329, 539, 497, 496, 175, 483,
555, 477, 227, 476, 10, 473, 441, 562, 432, 421,
227, 372, 297, 386, 565, 615, 228, 491, 491, 606,
571, 573, 173, 92, 228, 403, 493, 493, 176, 10,
403, 492, 492, 340, 574, 340, 197, 554, 10, 114,
457, 340, 177, 434, 340, 572, 580, 439, 10, 578,
354, 591, 592, 12, 13, 253, 588, 568, 251, 180,
340, 197, 586, 587, 110, 533, 197, 609, 535, 197,
432, 348, 197, 107, 117, 382, 70, 502, 12, 13,
287, 7, 5, 102, 432, 211, 24, 12, 13, 129,
16, 19, 227, 494, 494, 651, 129, 12, 13, 431,
456, 490, 490, 364, 429, 561, 228, 335, 282, 207,
206, 618, 175, 129, 129, 624, 622, 120, 481, 491,
121, 125, 173, 636, 631, 630, 188, 619, 493, 21,
340, 638, 305, 492, 642, 340, 643, 306, 641, 336,
57, 351, 352, 640, 93, 644, 252, 645, 197, 176,
26, 340, 512, 197, 197, 28, 197, 76, 158, 387,
157, 666, 653, 177, 582, 390, 159, 491, 530, 156,
498, 658, 579, 662, 418, 534, 493, 31, 22, 15,
664, 492, 23, 665, 122, 122, 201, 18, 340, 197,
668, 3, 123, 554, 667, 494, 340, 8, 9, 282,
4, 2, 1, 490, 451, 197, 215, 544, 197, 197,
56, 197, 89, 566, 545, 548, 549, 612, 488, 323,
249, 531, 189, 105, 105, 112, 115, 80, 81, 576,
577, 329, 438, 175, 119, 119, 173, 72, 119, 71,
237, 478, 340, 494, 149, 340, 403, 316, 589, 403,
403, 490, 220, 326, 150, 244, 649, 197, 151, 141,
142, 143, 144, 145, 146, 147, 148, 197, 197, 629,
650, 127, 17, 450, 595, 399, 319, 197, 25, 89,
27, 36, 37, 78, 471, 281, 49, 66, 111, 39,
38, 35, 124, 279, 278, 105, 149, 83, 79, 10,
105, 73, 217, 112, 82, 113, 150, 247, 504, 616,
151, 232, 506, 87, 188, 145, 146, 147, 148, 0,
0, 0, 197, 0, 223, 0, 0, 0, 196, 235,
197, 197, 240, 128, 231, 0, 0, 0, 634, 635,
236, 0, 0, 0, 0, 639, 77, 0, 12, 13,
225, 0, 0, 0, 292, 647, 648, 173, 0, 0,
403, 0, 0, 0, 197, 0, 0, 0, 0, 0,
197, 0, 541, 0, 543, 0, 552, 56, 0, 0,
556, 197, 0, 557, 0, 0, 0, 347, 0, 0,
0, 0, 119, 119, 0, 0, 349, 197, 0, 567,
0, 345, 343, 341, 0, 0, 0, 0, 344, 0,
0, 311, 357, 0, 0, 348, 312, 313, 105, 315,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 346, 0, 0, 56, 0, 0, 613, 197,
275, 276, 0, 283, 247, 56, 247, 197, 0, 0,
342, 0, 363, 13, 197, 197, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 599,
0, 377, 134, 149, 603, 152, 0, 135, 139, 140,
0, 0, 138, 150, 137, 136, 133, 151, 141, 142,
143, 144, 145, 146, 147, 148, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 422, 0, 0,
0, 361, 0, 0, 414, 0, 0, 0, 0, 0,
407, 0, 0, 368, 0, 0, 89, 637, 0, 197,
419, 420, 552, 0, 0, 0, 0, 0, 0, 347,
426, 0, 0, 463, 0, 0, 0, 357, 349, 0,
0, 0, 105, 345, 343, 341, 197, 0, 0, 105,
344, 0, 0, 112, 0, 486, 247, 348, 0, 0,
0, 0, 0, 0, 0, 0, 134, 149, 0, 152,
0, 135, 139, 140, 346, 407, 138, 150, 137, 136,
133, 151, 141, 142, 143, 144, 145, 146, 147, 148,
0, 0, 342, 0, 197, 13, 0, 0, 0, 0,
56, 56, 0, 0, 0, 396, 0, 0, 119, 0,
119, 0, 0, 0, 0, 0, 0, 311, 536, 0,
119, 0, 247, 522, 0, 0, 0, 0, 0, 0,
0, 547, 551, 0, 527, 0, 0, 475, 0, 0,
357, 0, 0, 463, 482, 0, 0, 463, 0, 0,
0, 0, 564, 357, 0, 0, 0, 0, 0, 0,
0, 275, 276, 0, 0, 0, 0, 0, 307, 0,
68, 0, 247, 41, 0, 78, 47, 42, 0, 0,
44, 56, 40, 50, 124, 43, 45, 53, 0, 83,
79, 10, 570, 0, 46, 52, 82, 51, 32, 30,
0, 0, 0, 65, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 60, 61, 0, 64,
58, 0, 0, 59, 0, 0, 67, 0, 0, 0,
0, 0, 0, 0, 308, 0, 62, 63, 77, 0,
12, 13, 0, 0, 0, 0, 0, 0, 0, 0,
0, 29, 105, 68, 247, 0, 41, 0, 78, 47,
42, 0, 56, 44, 0, 40, 50, 33, 43, 45,
53, 0, 83, 79, 10, 0, 0, 46, 52, 82,
51, 32, 30, 0, 0, 547, 65, 0, 551, 357,
0, 0, 463, 0, 0, 0, 357, 0, 357, 60,
61, 0, 64, 58, 0, 0, 59, 0, 68, 67,
0, 0, 0, 78, 0, 0, 0, 0, 0, 62,
63, 77, 124, 12, 13, 0, 0, 83, 79, 10,
68, 0, 0, 0, 82, 78, 0, 0, 0, 0,
0, 65, 0, 0, 124, 0, 0, 0, 0, 83,
79, 10, 0, 0, 60, 61, 82, 64, 58, 0,
0, 59, 0, 68, 67, 0, 0, 0, 78, 0,
0, 0, 404, 0, 62, 63, 77, 124, 12, 13,
0, 0, 83, 79, 10, 0, 67, 0, 0, 82,
0, 0, 0, 0, 0, 0, 65, 0, 77, 0,
12, 13, 0, 0, 0, 0, 0, 0, 0, 60,
61, 0, 64, 58, 0, 0, 59, 0, 68, 67,
0, 0, 0, 78, 0, 0, 0, 590, 0, 62,
63, 77, 124, 12, 13, 0, 0, 83, 79, 10,
0, 501, 0, 0, 82, 0, 0, 0, 0, 0,
0, 65, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 60, 61, 0, 64, 58, 0,
0, 59, 0, 68, 67, 0, 0, 0, 78, 0,
0, 0, 0, 0, 62, 63, 77, 124, 12, 13,
0, 0, 83, 79, 10, 0, 500, 0, 0, 82,
0, 0, 0, 0, 0, 0, 65, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 60,
61, 0, 64, 58, 0, 0, 59, 0, 68, 67,
0, 0, 0, 78, 0, 0, 0, 78, 0, 62,
63, 77, 124, 12, 13, 0, 124, 83, 79, 10,
0, 83, 79, 10, 82, 0, 395, 0, 82, 0,
0, 179, 0, 0, 0, 232, 0, 0, 0, 0,
0, 68, 0, 0, 60, 61, 78, 64, 178, 0,
0, 59, 196, 0, 67, 124, 0, 0, 489, 0,
83, 79, 10, 0, 62, 63, 77, 82, 12, 13,
77, 0, 12, 13, 179, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 60, 61, 0,
64, 178, 0, 0, 59, 0, 68, 67, 289, 0,
0, 78, 0, 0, 0, 0, 0, 62, 63, 77,
124, 12, 13, 0, 0, 83, 79, 10, 0, 284,
0, 0, 82, 0, 0, 0, 0, 0, 0, 65,
0, 0, 0, 0, 0, 0, 0, 0, 0, 68,
0, 0, 60, 61, 78, 64, 58, 187, 0, 59,
0, 0, 67, 124, 0, 0, 0, 0, 83, 79,
10, 0, 62, 63, 77, 82, 12, 13, 0, 0,
0, 0, 65, 0, 0, 0, 0, 0, 0, 0,
0, 0, 68, 0, 0, 60, 61, 78, 64, 58,
0, 0, 59, 0, 0, 67, 124, 0, 0, 0,
0, 83, 79, 10, 0, 62, 63, 77, 82, 12,
13, 0, 0, 0, 0, 65, 0, 0, 0, 0,
0, 0, 0, 0, 0, 68, 0, 0, 60, 61,
78, 64, 58, 0, 0, 59, 0, 0, 67, 124,
0, 0, 0, 0, 83, 79, 10, 0, 62, 63,
77, 82, 12, 13, 0, 0, 0, 0, 179, 0,
0, 0, 0, 0, 0, 0, 0, 0, 68, 0,
0, 60, 61, 299, 64, 178, 0, 0, 59, 0,
0, 67, 124, 0, 0, 0, 0, 83, 79, 10,
0, 62, 63, 77, 82, 12, 13, 0, 0, 0,
0, 65, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 60, 61, 78, 64, 58, 0,
0, 59, 0, 0, 67, 124, 0, 0, 0, 0,
83, 79, 10, 0, 62, 63, 77, 82, 12, 13,
0, 78, 0, 0, 232, 0, 0, 0, 0, 0,
124, 0, 0, 0, 0, 83, 79, 10, 0, 0,
0, 196, 82, 0, 0, 0, 0, 231, 0, 232,
0, 0, 0, 224, 0, 0, 0, 0, 0, 77,
0, 12, 13, 225, 0, 0, 196, 0, 0, 0,
0, 0, 231, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 77, 0, 12, 13, 427, 134,
149, 0, 152, 0, 135, 139, 140, 0, 0, 138,
150, 137, 136, 133, 151, 141, 142, 143, 144, 145,
146, 147, 148, 134, 149, 0, 152, 0, 135, 139,
140, 0, 660, 138, 150, 137, 136, 133, 151, 141,
142, 143, 144, 145, 146, 147, 148, 0, 78, 0,
0, 250, 78, 0, 0, 0, 659, 124, 0, 0,
0, 124, 83, 79, 10, 0, 83, 79, 10, 82,
0, 0, 0, 82, 299, 0, 232, 0, 0, 0,
232, 0, 0, 124, 0, 0, 0, 0, 83, 79,
10, 0, 0, 196, 0, 82, 0, 196, 0, 231,
0, 0, 232, 231, 0, 0, 0, 78, 0, 0,
0, 77, 0, 12, 13, 77, 124, 12, 13, 196,
0, 83, 79, 10, 0, 231, 0, 0, 82, 78,
0, 0, 0, 347, 0, 406, 0, 77, 124, 12,
13, 0, 349, 83, 79, 10, 0, 345, 343, 553,
82, 0, 196, 0, 344, 0, 0, 190, 412, 0,
0, 348, 0, 0, 0, 0, 0, 0, 0, 0,
77, 0, 12, 13, 196, 0, 0, 0, 346, 0,
195, 0, 0, 0, 0, 0, 0, 0, 347, 0,
0, 0, 77, 0, 12, 13, 342, 349, 12, 13,
0, 0, 345, 343, 341, 0, 0, 0, 347, 344,
0, 0, 0, 0, 0, 0, 453, 349, 0, 0,
0, 0, 345, 343, 341, 0, 0, 0, 0, 344,
0, 0, 0, 346, 0, 0, 348, 0, 0, 452,
0, 0, 0, 130, 0, 0, 0, 0, 0, 0,
0, 342, 0, 346, 13, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 350, 0, 0, 0, 0,
0, 342, 134, 149, 13, 152, 132, 135, 139, 140,
0, 131, 138, 150, 137, 136, 133, 151, 141, 142,
143, 144, 145, 146, 147, 148, 134, 149, 0, 152,
0, 135, 139, 140, 0, 0, 138, 150, 137, 136,
133, 151, 141, 142, 143, 144, 145, 146, 147, 148,
134, 149, 0, 0, 0, 135, 139, 140, 0, 0,
138, 150, 137, 136, 133, 151, 141, 142, 143, 144,
145, 146, 147, 148, 134, 149, 0, 0, 0, 135,
139, 140, 0, 0, 138, 150, 137, 136, 0, 151,
141, 142, 143, 144, 145, 146, 147, 148, 149, 0,
0, 0, 135, 139, 140, 0, 0, 138, 150, 137,
136, 0, 151, 141, 142, 143, 144, 145, 146, 147,
148,
}
var yyPact = [...]int{
-1000, -1000, 536, 535, -1000, 128, -1000, 545, 549, 336,
-1000, -1000, -1000, 605, -1000, -1000, 541, 1239, 328, 85,
-1000, 220, 438, 327, -1000, 323, -1000, -1000, -1000, -1000,
503, 493, 484, 459, -1000, -1000, -1000, -1000, -1000, 177,
-1000, 128, 128, 1316, 1316, 128, 1698, -1000, 2168, 92,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, 39, 1698, 1698,
1698, 1698, 1698, 1698, 1698, 1698, 157, 1741, -1000, -1000,
-1000, 479, 233, -1000, -1000, -1000, 202, 1655, 2050, 36,
-1000, -1000, 233, 233, -1000, -1000, 153, 535, -1000, 586,
585, 40, 194, -1000, 540, -11, -11, -11, 17, -1000,
-1000, -1000, 367, 1827, -1000, -1000, -1000, 355, 754, -1000,
252, 1973, -1000, 155, 1969, 478, -1000, -1000, -1000, -1000,
-1000, -1000, 39, -1000, 475, -1000, -1000, -1000, -23, 2192,
1698, -1000, -1000, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698,
1698, 1698, 1698, 1698, 1698, 1698, 1612, 1698, 524, 1698,
1557, 387, 1698, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, 431, 2192, -1000, -1000, -1000, -1000, 1741, 1784,
1698, -1000, -1000, -1000, 1156, -1000, 24, 22, 2192, -1000,
1973, -1000, -1000, -1000, -1000, 1973, 1973, 211, 1973, 27,
263, 320, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, 583, 1010, -1000, 2129, 1010, -1000, 155, 470, 128,
309, -1000, -1000, 187, 1698, 128, -1000, -1000, -1000, -1000,
-1000, 1973, 574, 307, -1000, 181, 1698, 305, -1000, -1000,
-1000, -1000, 1156, 430, -13, -1000, -1000, 1969, -1000, -1000,
1973, 1969, 1156, 1969, 2192, 2240, 2263, 689, 689, 689,
689, 689, 689, 741, 741, 741, 741, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, 2216, -23, -23, 2192, -1000, 519,
304, -1000, -1000, 51, 1698, -1000, 278, -1000, -1000, -1000,
66, -1000, -1000, 1514, 1022, 174, 1294, 152, -1000, 2028,
918, 1294, 143, -1000, -1000, -1000, -1000, -1000, -1000, 1973,
1973, -1000, 428, -1000, 128, 13, 273, -1000, -1000, 1852,
580, 525, 463, -1000, -1000, 210, 272, -1000, -1000, 467,
-1000, 539, 425, 197, -1000, 270, 268, -1000, -1000, -1000,
-1000, -1000, 103, 28, 151, 86, 1010, 2109, 571, 460,
65, 184, 266, 265, 128, -6, -1000, 206, 424, 128,
1698, -23, -1000, 422, 1973, 420, 128, 1698, -23, 418,
128, 131, 1518, 1969, -1000, -1000, -1000, -1000, 416, -1000,
415, -1000, -1000, 1698, 1459, 1404, 2192, 521, 1698, 229,
519, 405, -14, 1741, 404, 403, -1000, 1698, 147, -17,
-1000, -1000, 173, 2192, -1000, -1000, 1995, -1000, -1000, -1000,
-1000, -1000, 1973, 402, -1000, 138, -1000, 1156, 1156, -1000,
-1000, -1000, -1000, 1973, 112, 31, 580, 128, -1000, -1000,
398, 539, 210, 580, 539, 128, 104, 231, -1000, 1969,
397, -1000, -1000, -1000, -1000, 1010, 10, 1010, 128, 2054,
-1000, -1000, 514, 1010, -1000, -1000, 1010, 128, 259, -1000,
69, -1000, 581, -1000, 65, -1000, -1000, 392, -22, 128,
128, 580, 1010, -1000, -1000, -23, -1000, -1000, 258, -1000,
-1000, 754, -23, -1000, -1000, -1000, 440, -1000, -1000, 1969,
-1000, -1000, -1000, -1000, -1000, -1000, 1518, 1518, 1156, 255,
1698, 1698, -1000, -1000, -1000, -1000, -1000, 1741, 166, -1000,
-1000, 391, -1000, -1000, -1000, -1, -1000, 1294, -1000, 1349,
1294, 1294, 390, -1000, -1000, -1000, 129, -1000, -1000, -1000,
-1000, -1000, 580, 385, -1000, 383, -1000, -1000, -1000, 382,
-1000, -1000, 1010, 2, 102, 254, -1000, 1010, 81, 244,
-1000, 439, -1000, -1000, -1000, 370, -1000, -1000, 365, -1000,
497, -1000, 239, 858, 435, -1000, -1000, 580, 362, 128,
181, 1969, 361, -1000, 111, 1698, 2192, 2192, 226, 1156,
55, -1000, -1000, -1000, -1000, 1698, -1000, -1000, -1000, 2192,
-1000, 68, 64, -1000, -1000, -1000, 580, 580, 1518, -1000,
1010, -1000, 128, 580, -1000, 2054, 128, -1000, 858, 69,
-1000, -1000, -1000, 128, -1000, 128, -1000, -1000, -1000, 359,
-1000, -1000, -1000, -1000, 236, -1000, 1698, 1698, 1741, 560,
1, 1294, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, 349, -1000, 342, 341, 339, 1518, 1919, 1895, -1000,
-1000, 141, -1000, 50, 858, -1000, -1000, 858, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, 1698, 519, -1000,
}
var yyPgo = [...]int{
0, 51, 793, 672, 34, 221, 32, 700, 31, 792,
788, 1, 76, 113, 208, 16, 25, 3, 785, 782,
781, 774, 773, 771, 7, 770, 617, 30, 24, 769,
437, 45, 47, 273, 41, 19, 768, 554, 20, 620,
767, 556, 765, 762, 12, 761, 124, 760, 40, 13,
758, 46, 4, 2, 28, 756, 766, 755, 10, 18,
752, 751, 26, 750, 749, 736, 15, 35, 735, 733,
38, 732, 29, 727, 612, 48, 21, 721, 720, 719,
717, 42, 712, 708, 707, 9, 84, 702, 14, 698,
0, 67, 49, 22, 6, 23, 17, 8, 697, 5,
37, 11, 696, 695, 694, 687, 406, 36, 686, 33,
27, 684, 682, 681, 680, 677, 671, 50, 44, 667,
43, 666, 58, 662, 659, 658, 657, 654, 652, 650,
649, 646, 645, 644, 641, 640, 639, 638, 39, 637,
626, 624,
}
var yyR1 = [...]int{
0, 112, 114, 114, 116, 113, 115, 115, 119, 119,
119, 120, 120, 121, 121, 2, 2, 2, 117, 123,
123, 124, 118, 50, 50, 50, 50, 50, 74, 74,
74, 74, 74, 74, 74, 74, 74, 74, 126, 70,
70, 70, 75, 75, 76, 76, 76, 36, 48, 44,
44, 44, 44, 44, 44, 9, 9, 9, 9, 127,
11, 128, 10, 62, 62, 129, 53, 42, 42, 42,
22, 22, 22, 21, 130, 23, 24, 24, 131, 132,
133, 25, 134, 63, 64, 64, 65, 65, 135, 136,
45, 137, 43, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 46, 46, 46, 46, 46, 46,
46, 46, 46, 41, 41, 41, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
49, 28, 16, 16, 15, 15, 39, 39, 17, 17,
31, 1, 1, 33, 34, 37, 37, 3, 3, 3,
91, 91, 30, 29, 81, 81, 7, 7, 7, 7,
7, 7, 32, 32, 32, 32, 87, 87, 87, 87,
87, 79, 79, 80, 89, 89, 89, 89, 89, 12,
12, 88, 88, 88, 88, 88, 88, 88, 85, 86,
84, 84, 83, 83, 47, 18, 18, 19, 19, 90,
51, 51, 52, 52, 52, 139, 20, 20, 60, 60,
71, 71, 77, 77, 78, 78, 73, 73, 69, 69,
72, 72, 72, 72, 72, 72, 4, 4, 13, 27,
27, 27, 82, 8, 8, 8, 8, 68, 68, 67,
67, 6, 6, 6, 6, 6, 26, 26, 26, 26,
26, 140, 26, 26, 26, 26, 26, 26, 26, 26,
66, 66, 55, 55, 54, 54, 56, 56, 59, 59,
57, 57, 57, 57, 58, 58, 122, 122, 138, 138,
35, 35, 61, 61, 38, 38, 101, 101, 105, 105,
103, 103, 5, 5, 141, 141, 141, 141, 141, 141,
92, 108, 106, 106, 106, 111, 111, 107, 107, 107,
107, 107, 107, 107, 107, 107, 107, 107, 110, 109,
95, 95, 97, 96, 96, 99, 99, 98, 98, 94,
94, 94, 93, 93, 125, 125, 100, 100, 104, 104,
102, 102,
}
var yyR2 = [...]int{
0, 4, 0, 3, 0, 3, 0, 3, 2, 5,
3, 3, 2, 1, 3, 1, 2, 2, 4, 0,
1, 0, 4, 0, 1, 1, 1, 1, 2, 5,
3, 2, 5, 7, 3, 2, 5, 3, 1, 2,
4, 3, 4, 3, 1, 2, 1, 1, 2, 1,
3, 3, 3, 2, 2, 3, 5, 5, 2, 0,
4, 0, 3, 0, 2, 0, 4, 4, 4, 2,
5, 1, 1, 2, 0, 3, 1, 3, 0, 0,
0, 8, 0, 5, 0, 2, 0, 2, 0, 0,
7, 0, 5, 1, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 1, 2, 2, 2, 2, 2,
2, 2, 2, 3, 5, 6, 1, 1, 3, 5,
5, 4, 6, 8, 1, 5, 5, 5, 7, 1,
0, 3, 1, 4, 1, 4, 1, 3, 1, 1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 1,
4, 4, 1, 1, 1, 2, 1, 1, 1, 1,
1, 3, 1, 1, 1, 2, 1, 1, 1, 1,
3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3, 4, 4, 2, 3, 5, 1, 1, 2, 3,
5, 3, 5, 3, 3, 5, 8, 5, 8, 5,
0, 3, 0, 1, 3, 1, 4, 2, 0, 3,
1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
3, 2, 4, 3, 5, 5, 1, 3, 1, 2,
1, 3, 4, 1, 2, 2, 1, 1, 3, 0,
2, 0, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 4, 1, 2, 2, 2, 2, 2, 2,
1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1, 1, 3, 3, 0, 2, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 4, 4, 5, 6, 4, 4,
1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
4, 5, 4, 4, 2, 2, 4, 3, 3, 5,
3, 4, 3, 5, 1, 0, 1, 3, 1, 1,
2, 1, 1, 5, 0, 2, 1, 3, 1, 3,
1, 3,
}
var yyChk = [...]int{
-1000, -112, -113, -116, -114, 26, -117, 26, -115, -3,
25, -91, 74, 75, -118, -124, 25, -60, -119, 22,
63, 4, -125, -123, 25, -50, -74, -47, -26, 2,
33, -126, 32, 18, -44, -23, -45, -43, -25, -29,
16, 7, 11, 19, 14, 20, 28, 10, -14, -56,
17, 31, 29, 21, -33, -46, -3, -39, 54, 57,
50, 51, 70, 71, 53, 37, -40, 60, 4, -30,
-41, -79, -80, -20, -90, -88, -139, 72, 9, 24,
-84, -83, 30, 23, 63, -120, 60, -2, 4, -3,
64, 64, 65, -141, 22, 33, 10, 32, 18, 63,
63, -70, 60, -54, -34, -3, -75, 60, -54, -48,
60, -36, -3, -18, 60, -3, 67, -37, -33, -3,
-37, -41, -39, -3, 18, -41, -33, -61, -56, -14,
5, 43, 38, 48, 34, 39, 47, 46, 44, 40,
41, 50, 51, 52, 53, 54, 55, 56, 57, 35,
45, 49, 37, 66, 6, 76, -130, -135, -137, -131,
60, 64, 72, -46, -46, -46, -46, -46, -46, -46,
-46, 68, -17, -14, -32, -86, -90, -88, 54, 37,
60, -1, 36, 68, -1, 2, -35, 12, -14, -87,
37, -90, -88, -85, -12, 60, 54, -30, 72, -1,
-1, -121, 61, -120, -117, -118, 4, 4, 25, 74,
65, 25, -92, -91, -92, -108, -92, -19, -92, 60,
-71, 61, -70, -7, 66, 76, -86, -90, -88, -85,
-12, 60, 37, -75, 61, -7, 66, -78, 61, -48,
-7, -51, 68, -67, -68, -8, -31, -3, -81, -7,
12, 60, -140, 60, -14, -14, -14, -14, -14, -14,
-14, -14, -14, -14, -14, -14, -14, -14, -14, -14,
-14, -14, -14, -14, -14, -56, -56, -14, -21, -22,
-38, -42, -44, -56, 27, -24, -38, 36, -24, 61,
-59, -17, -3, 60, -14, -35, -49, 61, -32, 9,
-14, -49, -66, -6, -11, -74, -26, 2, 68, 73,
73, -7, -7, -7, 64, -7, -73, 69, -72, -55,
-13, 60, 54, -33, -4, 25, -69, 69, -27, -33,
-4, 60, -122, 63, -118, 4, -106, -107, -110, -109,
-91, 25, 72, 24, 30, 23, 54, 9, 37, 18,
66, -106, -106, -51, 60, -100, -95, -3, -122, 63,
66, -56, -34, -7, 9, -122, 63, 66, -56, -122,
63, -66, 61, 76, -138, -31, -81, -7, -67, -6,
-67, -53, 36, 63, 66, 6, -14, -136, 63, -62,
-132, -138, 12, 76, -17, 32, 73, 67, -58, -57,
-28, -16, -15, -14, 68, 68, 37, -7, -90, -88,
-85, -12, 60, -138, 76, -58, 69, 63, -127, -7,
-7, 61, -3, 73, -122, 63, -7, 76, -5, 4,
-13, 54, 25, -13, 60, 64, -122, 63, -82, 60,
-4, 61, -120, 63, 63, 73, 4, 72, 68, 68,
-106, -111, 60, 37, -107, -109, 9, 60, -93, -94,
60, 4, 51, -3, 66, 63, 63, -101, -100, 61,
76, -106, 12, 61, -70, -56, 61, 61, -77, -76,
-75, -54, -56, 61, -48, 69, -3, -52, -89, 60,
-86, -90, -88, -85, -12, -8, 61, 61, -129, -38,
27, 27, 36, -38, -10, 69, -9, 8, 13, -53,
61, -138, -17, 61, 61, -35, 69, 76, -138, 67,
-49, -49, -7, 61, 69, -6, -66, -7, 69, -72,
-5, -33, 61, -13, -5, -13, -3, 69, -27, -67,
61, -106, 73, -106, -105, -104, -97, -3, -103, -102,
-96, -3, -106, 25, -91, -110, -106, -106, -101, 63,
-94, 4, -93, 61, -3, -95, -5, -106, -122, 63,
-7, 60, -67, -52, -66, 63, -14, -14, -62, -128,
-59, 67, -133, 61, 73, 67, -28, -16, -15, -14,
68, -58, -58, 61, 69, -5, 61, 61, 61, -106,
73, 69, 63, -106, 69, 63, 60, 61, 61, 50,
63, -99, -98, 60, -106, 60, -5, 61, -76, -67,
61, 69, -38, 69, -66, 67, 66, 6, 76, -64,
-35, -49, 69, 69, -5, -5, -52, -106, -97, -5,
-96, -101, -99, -94, -101, -101, 61, -14, -14, -65,
-63, 15, 73, -58, 61, 61, 61, 61, -52, 67,
67, 21, -11, 69, -99, -99, -134, -24, -53,
}
var yyDef = [...]int{
4, -2, 2, 0, 6, 0, 21, 0, 218, 0,
157, 158, 159, 0, 5, 344, 19, -2, 0, 0,
3, 0, 0, 0, 20, 0, 24, 25, 26, 27,
0, 0, 0, 0, 256, 257, 258, 259, 260, 0,
263, 155, 155, 0, 0, 0, 292, 38, -2, 0,
74, 88, 91, 78, 163, 93, -2, 114, 0, 0,
0, 0, 0, 0, 0, 0, 146, 0, 126, 127,
134, 0, 0, 139, -2, -2, 0, 290, 0, 0,
196, 197, 0, 0, 7, 8, 0, 21, 15, 0,
0, 0, 0, 345, 0, 0, 0, 0, 0, 18,
219, 28, 0, 0, 274, 154, 31, 0, 0, 35,
0, 0, 47, 210, 249, 0, 261, 264, 156, 153,
265, -2, 0, 162, 0, -2, 268, 269, 293, 276,
0, 53, 54, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 294, 294, 0, 294,
0, 0, 290, 115, 116, 117, 118, 119, 120, 121,
122, 140, 0, 148, 149, 172, -2, -2, 0, 0,
0, 140, 151, 152, -2, 217, 0, 0, 291, 193,
0, 176, 177, 178, 179, 0, 0, 189, 0, 0,
0, 286, 10, 13, 21, 12, 16, 17, 160, 161,
22, 0, 0, 310, 0, 0, 311, 210, 0, 0,
286, 30, 220, 39, 0, 0, 166, 167, 168, 169,
170, 0, 0, 286, 34, 0, 0, 286, 37, 224,
48, 204, -2, 0, 288, 247, 243, 162, 246, 150,
164, 249, -2, 249, 50, 94, 95, 96, 97, 98,
99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
109, 110, 111, 112, 113, 51, 52, 277, 75, 0,
71, 72, 295, 0, 0, 89, 76, 63, 79, 123,
288, 278, 128, 0, 291, 0, 284, 147, 175, 0,
288, 284, 0, 270, 252, 253, 254, 255, 59, 0,
0, 194, 0, 198, 0, 0, 286, 201, 226, 0,
302, 0, 0, 272, 238, -2, 286, 203, 228, 0,
240, 0, 0, 287, 11, 0, 0, 312, 313, 314,
317, 318, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 296, 0, 346, 0, 0, 287,
0, 41, 275, 0, 0, 0, 287, 0, 43, 0,
287, 0, 212, 289, 250, 244, 245, 165, 0, 262,
0, 73, 65, 294, 0, 0, 69, 0, 294, 0,
0, 0, 288, 289, 0, 0, 131, 290, 0, 288,
280, 281, 0, -2, 140, 140, 0, 199, -2, -2,
-2, -2, 0, 0, 289, 0, 216, -2, -2, 191,
192, 180, 190, 0, 0, 287, 302, 0, 231, 303,
0, 0, 236, 302, 0, 0, 0, 287, 239, 249,
0, 9, 14, 304, 305, 0, 0, 0, 298, 300,
324, 325, 0, 0, 315, 316, 0, 296, 0, 342,
0, 339, 0, 341, 0, 308, 309, 0, 297, 0,
0, 302, 0, 29, 221, 40, 171, 32, 286, 222,
44, 46, 42, 36, 225, 211, 162, 209, 213, 249,
184, 185, 186, 187, 188, 248, 212, 212, -2, 0,
0, 0, 63, 77, 64, 92, 61, 0, 0, 80,
124, 0, 279, 129, 130, 0, 137, 289, 285, 0,
284, 284, 0, 135, 136, 271, 0, 195, 200, 227,
230, 273, 302, 0, 233, 0, 237, 202, 229, 0,
241, 319, 0, 0, 0, 299, 348, 0, 0, 301,
350, 0, 334, -2, -2, 0, 327, 328, 0, 306,
0, 340, 0, 335, 0, 347, 330, 302, 0, 287,
45, 249, 0, 205, 0, 294, 67, 68, 0, -2,
0, 58, 84, 125, 132, 290, 282, 283, 141, 144,
140, 0, 0, -2, 60, 232, 302, 302, 212, 320,
0, 322, 0, 302, 323, 0, 296, 326, 335, 0,
307, 207, 336, 296, 338, 296, 331, 33, 223, 0,
214, 66, 70, 90, 62, 55, 0, 0, 0, 86,
0, 284, -2, 138, 234, 235, 242, 321, 349, 332,
351, 0, 329, 0, 0, 0, 212, 0, 0, 81,
85, 0, 133, 0, 335, 343, 337, 335, 206, 56,
57, 82, 87, 145, 333, 208, 294, 0, 83,
}
var yyTok1 = [...]int{
1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 70, 3, 3, 65, 56, 57, 3,
60, 61, 54, 50, 76, 51, 64, 55, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 67, 63,
3, 66, 3, 74, 75, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 72, 3, 73, 53, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 68, 52, 69, 71,
}
var yyTok2 = [...]int{
2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 58, 59,
62,
}
var yyTok3 = [...]int{
0,
}
var yyErrorMessages = [...]struct {
state int
token int
msg string
}{
{332, 76, "unexpected comma during import block"},
{89, 63, "missing import path; require quoted string"},
{390, 63, "missing { after if clause"},
{387, 63, "missing { after switch clause"},
{279, 63, "missing { after for clause"},
{499, 36, "missing { after for clause"},
{17, 68, "unexpected semicolon or newline before {"},
{111, 63, "unexpected semicolon or newline in type declaration"},
{78, 69, "unexpected } in channel type"},
{78, 61, "unexpected ) in channel type"},
{78, 76, "unexpected comma in channel type"},
{417, 15, "unexpected semicolon or newline before else"},
{329, 76, "name list not allowed in interface type"},
{279, 33, "var declaration not allowed in for initializer"},
{25, 68, "unexpected { at end of statement"},
{371, 68, "unexpected { at end of statement"},
{122, 63, "argument to go/defer must be function call"},
{398, 63, "need trailing comma before newline in composite literal"},
{415, 63, "need trailing comma before newline in composite literal"},
{124, 25, "nested func not allowed"},
{651, 63, "else must be followed by if or statement block"},
}
//line yaccpar:1
/* parser for yacc output */
var (
yyDebug = 0
yyErrorVerbose = false
)
type yyLexer interface {
Lex(lval *yySymType) int
Error(s string)
}
type yyParser interface {
Parse(yyLexer) int
Lookahead() int
}
type yyParserImpl struct {
lookahead func() int
}
func (p *yyParserImpl) Lookahead() int {
return p.lookahead()
}
func yyNewParser() yyParser {
p := &yyParserImpl{
lookahead: func() int { return -1 },
}
return p
}
const yyFlag = -1000
func yyTokname(c int) string {
if c >= 1 && c-1 < len(yyToknames) {
if yyToknames[c-1] != "" {
return yyToknames[c-1]
}
}
return __yyfmt__.Sprintf("tok-%v", c)
}
func yyStatname(s int) string {
if s >= 0 && s < len(yyStatenames) {
if yyStatenames[s] != "" {
return yyStatenames[s]
}
}
return __yyfmt__.Sprintf("state-%v", s)
}
func yyErrorMessage(state, lookAhead int) string {
const TOKSTART = 4
if !yyErrorVerbose {
return "syntax error"
}
for _, e := range yyErrorMessages {
if e.state == state && e.token == lookAhead {
return "syntax error: " + e.msg
}
}
res := "syntax error: unexpected " + yyTokname(lookAhead)
// To match Bison, suggest at most four expected tokens.
expected := make([]int, 0, 4)
// Look for shiftable tokens.
base := yyPact[state]
for tok := TOKSTART; tok-1 < len(yyToknames); tok++ {
if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok {
if len(expected) == cap(expected) {
return res
}
expected = append(expected, tok)
}
}
if yyDef[state] == -2 {
i := 0
for yyExca[i] != -1 || yyExca[i+1] != state {
i += 2
}
// Look for tokens that we accept or reduce.
for i += 2; yyExca[i] >= 0; i += 2 {
tok := yyExca[i]
if tok < TOKSTART || yyExca[i+1] == 0 {
continue
}
if len(expected) == cap(expected) {
return res
}
expected = append(expected, tok)
}
// If the default action is to accept or reduce, give up.
if yyExca[i+1] != 0 {
return res
}
}
for i, tok := range expected {
if i == 0 {
res += ", expecting "
} else {
res += " or "
}
res += yyTokname(tok)
}
return res
}
func yylex1(lex yyLexer, lval *yySymType) (char, token int) {
token = 0
char = lex.Lex(lval)
if char <= 0 {
token = yyTok1[0]
goto out
}
if char < len(yyTok1) {
token = yyTok1[char]
goto out
}
if char >= yyPrivate {
if char < yyPrivate+len(yyTok2) {
token = yyTok2[char-yyPrivate]
goto out
}
}
for i := 0; i < len(yyTok3); i += 2 {
token = yyTok3[i+0]
if token == char {
token = yyTok3[i+1]
goto out
}
}
out:
if token == 0 {
token = yyTok2[1] /* unknown char */
}
if yyDebug >= 3 {
__yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char))
}
return char, token
}
func yyParse(yylex yyLexer) int {
return yyNewParser().Parse(yylex)
}
func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int {
var yyn int
var yylval yySymType
var yyVAL yySymType
var yyDollar []yySymType
_ = yyDollar // silence set and not used
yyS := make([]yySymType, yyMaxDepth)
Nerrs := 0 /* number of errors */
Errflag := 0 /* error recovery flag */
yystate := 0
yychar := -1
yytoken := -1 // yychar translated into internal numbering
yyrcvr.lookahead = func() int { return yychar }
defer func() {
// Make sure we report no lookahead when not parsing.
yystate = -1
yychar = -1
yytoken = -1
}()
yyp := -1
goto yystack
ret0:
return 0
ret1:
return 1
yystack:
/* put a state and value onto the stack */
if yyDebug >= 4 {
__yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate))
}
yyp++
if yyp >= len(yyS) {
nyys := make([]yySymType, len(yyS)*2)
copy(nyys, yyS)
yyS = nyys
}
yyS[yyp] = yyVAL
yyS[yyp].yys = yystate
yynewstate:
yyn = yyPact[yystate]
if yyn <= yyFlag {
goto yydefault /* simple state */
}
if yychar < 0 {
yychar, yytoken = yylex1(yylex, &yylval)
}
yyn += yytoken
if yyn < 0 || yyn >= yyLast {
goto yydefault
}
yyn = yyAct[yyn]
if yyChk[yyn] == yytoken { /* valid shift */
yychar = -1
yytoken = -1
yyVAL = yylval
yystate = yyn
if Errflag > 0 {
Errflag--
}
goto yystack
}
yydefault:
/* default state action */
yyn = yyDef[yystate]
if yyn == -2 {
if yychar < 0 {
yychar, yytoken = yylex1(yylex, &yylval)
}
/* look through exception table */
xi := 0
for {
if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate {
break
}
xi += 2
}
for xi += 2; ; xi += 2 {
yyn = yyExca[xi+0]
if yyn < 0 || yyn == yytoken {
break
}
}
yyn = yyExca[xi+1]
if yyn < 0 {
goto ret0
}
}
if yyn == 0 {
/* error ... attempt to resume parsing */
switch Errflag {
case 0: /* brand new error */
yylex.Error(yyErrorMessage(yystate, yytoken))
Nerrs++
if yyDebug >= 1 {
__yyfmt__.Printf("%s", yyStatname(yystate))
__yyfmt__.Printf(" saw %s\n", yyTokname(yytoken))
}
fallthrough
case 1, 2: /* incompletely recovered error ... try again */
Errflag = 3
/* find a state where "error" is a legal shift action */
for yyp >= 0 {
yyn = yyPact[yyS[yyp].yys] + yyErrCode
if yyn >= 0 && yyn < yyLast {
yystate = yyAct[yyn] /* simulate a shift of "error" */
if yyChk[yystate] == yyErrCode {
goto yystack
}
}
/* the current p has no shift on "error", pop stack */
if yyDebug >= 2 {
__yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys)
}
yyp--
}
/* there is no state on the stack with an error shift ... abort */
goto ret1
case 3: /* no shift yet; clobber input char */
if yyDebug >= 2 {
__yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken))
}
if yytoken == yyEofCode {
goto ret1
}
yychar = -1
yytoken = -1
goto yynewstate /* try again in the same state */
}
}
/* reduction by production yyn */
if yyDebug >= 2 {
__yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate))
}
yynt := yyn
yypt := yyp
_ = yypt // guard against "declared and not used"
yyp -= yyR2[yyn]
// yyp is now the index of $0. Perform the default action. Iff the
// reduced production is ε, $1 is possibly out of range.
if yyp+1 >= len(yyS) {
nyys := make([]yySymType, len(yyS)*2)
copy(nyys, yyS)
yyS = nyys
}
yyVAL = yyS[yyp+1]
/* consult goto table to find next state */
yyn = yyR1[yyn]
yyg := yyPgo[yyn]
yyj := yyg + yyS[yyp].yys + 1
if yyj >= yyLast {
yystate = yyAct[yyg]
} else {
yystate = yyAct[yyj]
if yyChk[yystate] != -yyn {
yystate = yyAct[yyg]
}
}
// dummy call; replaced with literal code
switch yynt {
case 1:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:189
{
xtop = concat(xtop, yyDollar[4].list)
}
case 2:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:195
{
prevlineno = lineno
Yyerror("package statement must be first")
errorexit()
}
case 3:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:201
{
mkpackage(yyDollar[2].sym.Name)
}
case 4:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:211
{
importpkg = Runtimepkg
if Debug['A'] != 0 {
cannedimports("runtime.Builtin", "package runtime\n\n$$\n\n")
} else {
cannedimports("runtime.Builtin", runtimeimport)
}
curio.importsafe = true
}
case 5:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:223
{
importpkg = nil
}
case 11:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:237
{
ipkg := importpkg
my := importmyname
importpkg = nil
importmyname = nil
if my == nil {
my = Lookup(ipkg.Name)
}
pack := Nod(OPACK, nil, nil)
pack.Sym = my
pack.Name.Pkg = ipkg
pack.Lineno = int32(yyDollar[1].i)
if strings.HasPrefix(my.Name, ".") {
importdot(ipkg, pack)
break
}
if my.Name == "init" {
lineno = int32(yyDollar[1].i)
Yyerror("cannot import package as init - init must be a func")
break
}
if my.Name == "_" {
break
}
if my.Def != nil {
lineno = int32(yyDollar[1].i)
redeclare(my, "as imported package name")
}
my.Def = pack
my.Lastlineno = int32(yyDollar[1].i)
my.Block = 1 // at top level
}
case 12:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:273
{
// When an invalid import path is passed to importfile,
// it calls Yyerror and then sets up a fake import with
// no package statement. This allows us to test more
// than one invalid import statement in a single file.
if nerrors == 0 {
Fatalf("phase error in import")
}
}
case 15:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:289
{
// import with original name
yyVAL.i = parserline()
importmyname = nil
importfile(&yyDollar[1].val, yyVAL.i)
}
case 16:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:296
{
// import with given name
yyVAL.i = parserline()
importmyname = yyDollar[1].sym
importfile(&yyDollar[2].val, yyVAL.i)
}
case 17:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:303
{
// import into my name space
yyVAL.i = parserline()
importmyname = Lookup(".")
importfile(&yyDollar[2].val, yyVAL.i)
}
case 18:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:312
{
if importpkg.Name == "" {
importpkg.Name = yyDollar[2].sym.Name
numImport[yyDollar[2].sym.Name]++
} else if importpkg.Name != yyDollar[2].sym.Name {
Yyerror("conflicting names %s and %s for package %q", importpkg.Name, yyDollar[2].sym.Name, importpkg.Path)
}
if incannedimport == 0 {
importpkg.Direct = true
}
importpkg.Safe = curio.importsafe
if safemode != 0 && !curio.importsafe {
Yyerror("cannot import unsafe package %q", importpkg.Path)
}
}
case 20:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:331
{
if yyDollar[1].sym.Name == "safe" {
curio.importsafe = true
}
}
case 21:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:338
{
defercheckwidth()
}
case 22:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:342
{
resumecheckwidth()
unimportfile()
}
case 23:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:351
{
Yyerror("empty top-level declaration")
yyVAL.list = nil
}
case 25:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:357
{
yyVAL.list = list1(yyDollar[1].node)
}
case 26:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:361
{
Yyerror("non-declaration statement outside function body")
yyVAL.list = nil
}
case 27:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:366
{
yyVAL.list = nil
}
case 28:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:372
{
yyVAL.list = yyDollar[2].list
}
case 29:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:376
{
yyVAL.list = yyDollar[3].list
}
case 30:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:380
{
yyVAL.list = nil
}
case 31:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:384
{
yyVAL.list = yyDollar[2].list
iota_ = -100000
lastconst = nil
}
case 32:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:390
{
yyVAL.list = yyDollar[3].list
iota_ = -100000
lastconst = nil
}
case 33:
yyDollar = yyS[yypt-7 : yypt+1]
//line go.y:396
{
yyVAL.list = concat(yyDollar[3].list, yyDollar[5].list)
iota_ = -100000
lastconst = nil
}
case 34:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:402
{
yyVAL.list = nil
iota_ = -100000
}
case 35:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:407
{
yyVAL.list = list1(yyDollar[2].node)
}
case 36:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:411
{
yyVAL.list = yyDollar[3].list
}
case 37:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:415
{
yyVAL.list = nil
}
case 38:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:421
{
iota_ = 0
}
case 39:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:427
{
yyVAL.list = variter(yyDollar[1].list, yyDollar[2].node, nil)
}
case 40:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:431
{
yyVAL.list = variter(yyDollar[1].list, yyDollar[2].node, yyDollar[4].list)
}
case 41:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:435
{
yyVAL.list = variter(yyDollar[1].list, nil, yyDollar[3].list)
}
case 42:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:441
{
yyVAL.list = constiter(yyDollar[1].list, yyDollar[2].node, yyDollar[4].list)
}
case 43:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:445
{
yyVAL.list = constiter(yyDollar[1].list, nil, yyDollar[3].list)
}
case 45:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:452
{
yyVAL.list = constiter(yyDollar[1].list, yyDollar[2].node, nil)
}
case 46:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:456
{
yyVAL.list = constiter(yyDollar[1].list, nil, nil)
}
case 47:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:462
{
// different from dclname because the name
// becomes visible right here, not at the end
// of the declaration.
yyVAL.node = typedcl0(yyDollar[1].sym)
}
case 48:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:471
{
yyVAL.node = typedcl1(yyDollar[1].node, yyDollar[2].node, true)
}
case 49:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:477
{
yyVAL.node = yyDollar[1].node
// These nodes do not carry line numbers.
// Since a bare name used as an expression is an error,
// introduce a wrapper node to give the correct line.
switch yyVAL.node.Op {
case ONAME, ONONAME, OTYPE, OPACK, OLITERAL:
yyVAL.node = Nod(OPAREN, yyVAL.node, nil)
yyVAL.node.Implicit = true
break
}
}
case 50:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:491
{
yyVAL.node = Nod(OASOP, yyDollar[1].node, yyDollar[3].node)
yyVAL.node.Etype = EType(yyDollar[2].i) // rathole to pass opcode
}
case 51:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:496
{
if yyDollar[1].list.Next == nil && yyDollar[3].list.Next == nil {
// simple
yyVAL.node = Nod(OAS, yyDollar[1].list.N, yyDollar[3].list.N)
break
}
// multiple
yyVAL.node = Nod(OAS2, nil, nil)
yyVAL.node.List = yyDollar[1].list
yyVAL.node.Rlist = yyDollar[3].list
}
case 52:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:508
{
if yyDollar[3].list.N.Op == OTYPESW {
yyVAL.node = Nod(OTYPESW, nil, yyDollar[3].list.N.Right)
if yyDollar[3].list.Next != nil {
Yyerror("expr.(type) must be alone in list")
}
if yyDollar[1].list.Next != nil {
Yyerror("argument count mismatch: %d = %d", count(yyDollar[1].list), 1)
} else if (yyDollar[1].list.N.Op != ONAME && yyDollar[1].list.N.Op != OTYPE && yyDollar[1].list.N.Op != ONONAME && (yyDollar[1].list.N.Op != OLITERAL || yyDollar[1].list.N.Name == nil)) || isblank(yyDollar[1].list.N) {
Yyerror("invalid variable name %s in type switch", yyDollar[1].list.N)
} else {
yyVAL.node.Left = dclname(yyDollar[1].list.N.Sym)
} // it's a colas, so must not re-use an oldname.
break
}
yyVAL.node = colas(yyDollar[1].list, yyDollar[3].list, int32(yyDollar[2].i))
}
case 53:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:526
{
yyVAL.node = Nod(OASOP, yyDollar[1].node, Nodintconst(1))
yyVAL.node.Implicit = true
// TODO(marvin): Fix Node.EType type union.
yyVAL.node.Etype = EType(OADD)
}
case 54:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:533
{
yyVAL.node = Nod(OASOP, yyDollar[1].node, Nodintconst(1))
yyVAL.node.Implicit = true
// TODO(marvin): Fix Node.EType type union.
yyVAL.node.Etype = EType(OSUB)
}
case 55:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:542
{
var n, nn *Node
// will be converted to OCASE
// right will point to next case
// done in casebody()
markdcl()
yyVAL.node = Nod(OXCASE, nil, nil)
yyVAL.node.List = yyDollar[2].list
if typesw != nil && typesw.Right != nil {
n = typesw.Right.Left
if n != nil {
// type switch - declare variable
nn = newname(n.Sym)
declare(nn, dclcontext)
yyVAL.node.Rlist = list1(nn)
// keep track of the instances for reporting unused
nn.Name.Defn = typesw.Right
}
}
}
case 56:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:565
{
var n *Node
// will be converted to OCASE
// right will point to next case
// done in casebody()
markdcl()
yyVAL.node = Nod(OXCASE, nil, nil)
if yyDollar[2].list.Next == nil {
n = Nod(OAS, yyDollar[2].list.N, yyDollar[4].node)
} else {
n = Nod(OAS2, nil, nil)
n.List = yyDollar[2].list
n.Rlist = list1(yyDollar[4].node)
}
yyVAL.node.List = list1(n)
}
case 57:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:583
{
// will be converted to OCASE
// right will point to next case
// done in casebody()
markdcl()
yyVAL.node = Nod(OXCASE, nil, nil)
yyVAL.node.List = list1(colas(yyDollar[2].list, list1(yyDollar[4].node), int32(yyDollar[3].i)))
}
case 58:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:592
{
var n, nn *Node
markdcl()
yyVAL.node = Nod(OXCASE, nil, nil)
if typesw != nil && typesw.Right != nil {
n = typesw.Right.Left
if n != nil {
// type switch - declare variable
nn = newname(n.Sym)
declare(nn, dclcontext)
yyVAL.node.Rlist = list1(nn)
// keep track of the instances for reporting unused
nn.Name.Defn = typesw.Right
}
}
}
case 59:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:613
{
markdcl()
}
case 60:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:617
{
if yyDollar[3].list == nil {
yyVAL.node = Nod(OEMPTY, nil, nil)
} else {
yyVAL.node = liststmt(yyDollar[3].list)
}
popdcl()
}
case 61:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:628
{
// If the last token read by the lexer was consumed
// as part of the case, clear it (parser has cleared yychar).
// If the last token read by the lexer was the lookahead
// leave it alone (parser has it cached in yychar).
// This is so that the stmt_list action doesn't look at
// the case tokens if the stmt_list is empty.
yylast = yychar
yyDollar[1].node.Xoffset = int64(block)
}
case 62:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:639
{
// This is the only place in the language where a statement
// list is not allowed to drop the final semicolon, because
// it's the only place where a statement list is not followed
// by a closing brace. Handle the error for pedantry.
// Find the final token of the statement list.
// yylast is lookahead; yyprev is last of stmt_list
last := yyprev
if last > 0 && last != ';' && yychar != '}' {
Yyerror("missing statement after label")
}
yyVAL.node = yyDollar[1].node
yyVAL.node.Nbody = yyDollar[3].list
popdcl()
}
case 63:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:658
{
yyVAL.list = nil
}
case 64:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:662
{
yyVAL.list = list(yyDollar[1].list, yyDollar[2].node)
}
case 65:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:668
{
markdcl()
}
case 66:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:672
{
yyVAL.list = yyDollar[3].list
popdcl()
}
case 67:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:679
{
yyVAL.node = Nod(ORANGE, nil, yyDollar[4].node)
yyVAL.node.List = yyDollar[1].list
yyVAL.node.Etype = 0 // := flag
}
case 68:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:685
{
yyVAL.node = Nod(ORANGE, nil, yyDollar[4].node)
yyVAL.node.List = yyDollar[1].list
yyVAL.node.Colas = true
colasdefn(yyDollar[1].list, yyVAL.node)
}
case 69:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:692
{
yyVAL.node = Nod(ORANGE, nil, yyDollar[2].node)
yyVAL.node.Etype = 0 // := flag
}
case 70:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:699
{
// init ; test ; incr
if yyDollar[5].node != nil && yyDollar[5].node.Colas {
Yyerror("cannot declare in the for-increment")
}
yyVAL.node = Nod(OFOR, nil, nil)
if yyDollar[1].node != nil {
yyVAL.node.Ninit = list1(yyDollar[1].node)
}
yyVAL.node.Left = yyDollar[3].node
yyVAL.node.Right = yyDollar[5].node
}
case 71:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:712
{
// normal test
yyVAL.node = Nod(OFOR, nil, nil)
yyVAL.node.Left = yyDollar[1].node
}
case 73:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:721
{
yyVAL.node = yyDollar[1].node
yyVAL.node.Nbody = concat(yyVAL.node.Nbody, yyDollar[2].list)
}
case 74:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:728
{
markdcl()
}
case 75:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:732
{
yyVAL.node = yyDollar[3].node
popdcl()
}
case 76:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:739
{
// test
yyVAL.node = Nod(OIF, nil, nil)
yyVAL.node.Left = yyDollar[1].node
}
case 77:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:745
{
// init ; test
yyVAL.node = Nod(OIF, nil, nil)
if yyDollar[1].node != nil {
yyVAL.node.Ninit = list1(yyDollar[1].node)
}
yyVAL.node.Left = yyDollar[3].node
}
case 78:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:757
{
markdcl()
}
case 79:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:761
{
if yyDollar[3].node.Left == nil {
Yyerror("missing condition in if statement")
}
}
case 80:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:767
{
yyDollar[3].node.Nbody = yyDollar[5].list
}
case 81:
yyDollar = yyS[yypt-8 : yypt+1]
//line go.y:771
{
var n *Node
var nn *NodeList
yyVAL.node = yyDollar[3].node
n = yyDollar[3].node
popdcl()
for nn = concat(yyDollar[7].list, yyDollar[8].list); nn != nil; nn = nn.Next {
if nn.N.Op == OIF {
popdcl()
}
n.Rlist = list1(nn.N)
n = nn.N
}
}
case 82:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:789
{
markdcl()
}
case 83:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:793
{
if yyDollar[4].node.Left == nil {
Yyerror("missing condition in if statement")
}
yyDollar[4].node.Nbody = yyDollar[5].list
yyVAL.list = list1(yyDollar[4].node)
}
case 84:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:802
{
yyVAL.list = nil
}
case 85:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:806
{
yyVAL.list = concat(yyDollar[1].list, yyDollar[2].list)
}
case 86:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:811
{
yyVAL.list = nil
}
case 87:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:815
{
l := &NodeList{N: yyDollar[2].node}
l.End = l
yyVAL.list = l
}
case 88:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:823
{
markdcl()
}
case 89:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:827
{
var n *Node
n = yyDollar[3].node.Left
if n != nil && n.Op != OTYPESW {
n = nil
}
typesw = Nod(OXXX, typesw, n)
}
case 90:
yyDollar = yyS[yypt-7 : yypt+1]
//line go.y:836
{
yyVAL.node = yyDollar[3].node
yyVAL.node.Op = OSWITCH
yyVAL.node.List = yyDollar[6].list
typesw = typesw.Left
popdcl()
}
case 91:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:846
{
typesw = Nod(OXXX, typesw, nil)
}
case 92:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:850
{
yyVAL.node = Nod(OSELECT, nil, nil)
yyVAL.node.Lineno = typesw.Lineno
yyVAL.node.List = yyDollar[4].list
typesw = typesw.Left
}
case 94:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:863
{
yyVAL.node = Nod(OOROR, yyDollar[1].node, yyDollar[3].node)
}
case 95:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:867
{
yyVAL.node = Nod(OANDAND, yyDollar[1].node, yyDollar[3].node)
}
case 96:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:871
{
yyVAL.node = Nod(OEQ, yyDollar[1].node, yyDollar[3].node)
}
case 97:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:875
{
yyVAL.node = Nod(ONE, yyDollar[1].node, yyDollar[3].node)
}
case 98:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:879
{
yyVAL.node = Nod(OLT, yyDollar[1].node, yyDollar[3].node)
}
case 99:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:883
{
yyVAL.node = Nod(OLE, yyDollar[1].node, yyDollar[3].node)
}
case 100:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:887
{
yyVAL.node = Nod(OGE, yyDollar[1].node, yyDollar[3].node)
}
case 101:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:891
{
yyVAL.node = Nod(OGT, yyDollar[1].node, yyDollar[3].node)
}
case 102:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:895
{
yyVAL.node = Nod(OADD, yyDollar[1].node, yyDollar[3].node)
}
case 103:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:899
{
yyVAL.node = Nod(OSUB, yyDollar[1].node, yyDollar[3].node)
}
case 104:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:903
{
yyVAL.node = Nod(OOR, yyDollar[1].node, yyDollar[3].node)
}
case 105:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:907
{
yyVAL.node = Nod(OXOR, yyDollar[1].node, yyDollar[3].node)
}
case 106:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:911
{
yyVAL.node = Nod(OMUL, yyDollar[1].node, yyDollar[3].node)
}
case 107:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:915
{
yyVAL.node = Nod(ODIV, yyDollar[1].node, yyDollar[3].node)
}
case 108:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:919
{
yyVAL.node = Nod(OMOD, yyDollar[1].node, yyDollar[3].node)
}
case 109:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:923
{
yyVAL.node = Nod(OAND, yyDollar[1].node, yyDollar[3].node)
}
case 110:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:927
{
yyVAL.node = Nod(OANDNOT, yyDollar[1].node, yyDollar[3].node)
}
case 111:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:931
{
yyVAL.node = Nod(OLSH, yyDollar[1].node, yyDollar[3].node)
}
case 112:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:935
{
yyVAL.node = Nod(ORSH, yyDollar[1].node, yyDollar[3].node)
}
case 113:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:940
{
yyVAL.node = Nod(OSEND, yyDollar[1].node, yyDollar[3].node)
}
case 115:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:947
{
yyVAL.node = Nod(OIND, yyDollar[2].node, nil)
}
case 116:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:951
{
if yyDollar[2].node.Op == OCOMPLIT {
// Special case for &T{...}: turn into (*T){...}.
yyVAL.node = yyDollar[2].node
yyVAL.node.Right = Nod(OIND, yyVAL.node.Right, nil)
yyVAL.node.Right.Implicit = true
} else {
yyVAL.node = Nod(OADDR, yyDollar[2].node, nil)
}
}
case 117:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:962
{
yyVAL.node = Nod(OPLUS, yyDollar[2].node, nil)
}
case 118:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:966
{
yyVAL.node = Nod(OMINUS, yyDollar[2].node, nil)
}
case 119:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:970
{
yyVAL.node = Nod(ONOT, yyDollar[2].node, nil)
}
case 120:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:974
{
Yyerror("the bitwise complement operator is ^")
yyVAL.node = Nod(OCOM, yyDollar[2].node, nil)
}
case 121:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:979
{
yyVAL.node = Nod(OCOM, yyDollar[2].node, nil)
}
case 122:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:983
{
yyVAL.node = Nod(ORECV, yyDollar[2].node, nil)
}
case 123:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:993
{
yyVAL.node = Nod(OCALL, yyDollar[1].node, nil)
}
case 124:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:997
{
yyVAL.node = Nod(OCALL, yyDollar[1].node, nil)
yyVAL.node.List = yyDollar[3].list
}
case 125:
yyDollar = yyS[yypt-6 : yypt+1]
//line go.y:1002
{
yyVAL.node = Nod(OCALL, yyDollar[1].node, nil)
yyVAL.node.List = yyDollar[3].list
yyVAL.node.Isddd = true
}
case 126:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1010
{
yyVAL.node = nodlit(yyDollar[1].val)
}
case 128:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1015
{
if yyDollar[1].node.Op == OPACK {
var s *Sym
s = restrictlookup(yyDollar[3].sym.Name, yyDollar[1].node.Name.Pkg)
yyDollar[1].node.Used = true
yyVAL.node = oldname(s)
break
}
yyVAL.node = Nod(OXDOT, yyDollar[1].node, newname(yyDollar[3].sym))
}
case 129:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1026
{
yyVAL.node = Nod(ODOTTYPE, yyDollar[1].node, yyDollar[4].node)
}
case 130:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1030
{
yyVAL.node = Nod(OTYPESW, nil, yyDollar[1].node)
}
case 131:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1034
{
yyVAL.node = Nod(OINDEX, yyDollar[1].node, yyDollar[3].node)
}
case 132:
yyDollar = yyS[yypt-6 : yypt+1]
//line go.y:1038
{
yyVAL.node = Nod(OSLICE, yyDollar[1].node, Nod(OKEY, yyDollar[3].node, yyDollar[5].node))
}
case 133:
yyDollar = yyS[yypt-8 : yypt+1]
//line go.y:1042
{
if yyDollar[5].node == nil {
Yyerror("middle index required in 3-index slice")
}
if yyDollar[7].node == nil {
Yyerror("final index required in 3-index slice")
}
yyVAL.node = Nod(OSLICE3, yyDollar[1].node, Nod(OKEY, yyDollar[3].node, Nod(OKEY, yyDollar[5].node, yyDollar[7].node)))
}
case 135:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1053
{
// conversion
yyVAL.node = Nod(OCALL, yyDollar[1].node, nil)
yyVAL.node.List = list1(yyDollar[3].node)
}
case 136:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1059
{
yyVAL.node = yyDollar[3].node
yyVAL.node.Right = yyDollar[1].node
yyVAL.node.List = yyDollar[4].list
fixlbrace(yyDollar[2].i)
}
case 137:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1066
{
yyVAL.node = yyDollar[3].node
yyVAL.node.Right = yyDollar[1].node
yyVAL.node.List = yyDollar[4].list
}
case 138:
yyDollar = yyS[yypt-7 : yypt+1]
//line go.y:1072
{
Yyerror("cannot parenthesize type in composite literal")
yyVAL.node = yyDollar[5].node
yyVAL.node.Right = yyDollar[2].node
yyVAL.node.List = yyDollar[6].list
}
case 140:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1081
{
// composite expression.
// make node early so we get the right line number.
yyVAL.node = Nod(OCOMPLIT, nil, nil)
}
case 141:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1089
{
yyVAL.node = Nod(OKEY, yyDollar[1].node, yyDollar[3].node)
}
case 142:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1095
{
// These nodes do not carry line numbers.
// Since a composite literal commonly spans several lines,
// the line number on errors may be misleading.
// Introduce a wrapper node to give the correct line.
yyVAL.node = yyDollar[1].node
switch yyVAL.node.Op {
case ONAME, ONONAME, OTYPE, OPACK, OLITERAL:
yyVAL.node = Nod(OPAREN, yyVAL.node, nil)
yyVAL.node.Implicit = true
}
}
case 143:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1108
{
yyVAL.node = yyDollar[2].node
yyVAL.node.List = yyDollar[3].list
}
case 145:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1116
{
yyVAL.node = yyDollar[2].node
yyVAL.node.List = yyDollar[3].list
}
case 147:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1124
{
yyVAL.node = yyDollar[2].node
// Need to know on lhs of := whether there are ( ).
// Don't bother with the OPAREN in other cases:
// it's just a waste of memory and time.
switch yyVAL.node.Op {
case ONAME, ONONAME, OPACK, OTYPE, OLITERAL, OTYPESW:
yyVAL.node = Nod(OPAREN, yyVAL.node, nil)
}
}
case 151:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1145
{
yyVAL.i = LBODY
}
case 152:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1149
{
yyVAL.i = '{'
}
case 153:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1160
{
if yyDollar[1].sym == nil {
yyVAL.node = nil
} else {
yyVAL.node = newname(yyDollar[1].sym)
}
}
case 154:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1170
{
yyVAL.node = dclname(yyDollar[1].sym)
}
case 155:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1175
{
yyVAL.node = nil
}
case 157:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1182
{
yyVAL.sym = yyDollar[1].sym
// during imports, unqualified non-exported identifiers are from builtinpkg
if importpkg != nil && !exportname(yyDollar[1].sym.Name) {
yyVAL.sym = Pkglookup(yyDollar[1].sym.Name, builtinpkg)
}
}
case 159:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1191
{
yyVAL.sym = nil
}
case 160:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1197
{
var p *Pkg
if yyDollar[2].val.U.(string) == "" {
p = importpkg
} else {
if isbadimport(yyDollar[2].val.U.(string)) {
errorexit()
}
p = mkpkg(yyDollar[2].val.U.(string))
}
yyVAL.sym = Pkglookup(yyDollar[4].sym.Name, p)
}
case 161:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1211
{
var p *Pkg
if yyDollar[2].val.U.(string) == "" {
p = importpkg
} else {
if isbadimport(yyDollar[2].val.U.(string)) {
errorexit()
}
p = mkpkg(yyDollar[2].val.U.(string))
}
yyVAL.sym = Pkglookup("?", p)
}
case 162:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1227
{
yyVAL.node = oldname(yyDollar[1].sym)
if yyVAL.node.Name != nil && yyVAL.node.Name.Pack != nil {
yyVAL.node.Name.Pack.Used = true
}
}
case 164:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1248
{
Yyerror("final argument in variadic function missing type")
yyVAL.node = Nod(ODDD, typenod(typ(TINTER)), nil)
}
case 165:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1253
{
yyVAL.node = Nod(ODDD, yyDollar[2].node, nil)
}
case 171:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1264
{
yyVAL.node = yyDollar[2].node
}
case 175:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1273
{
yyVAL.node = Nod(OIND, yyDollar[2].node, nil)
}
case 180:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1283
{
yyVAL.node = yyDollar[2].node
}
case 190:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1304
{
if yyDollar[1].node.Op == OPACK {
var s *Sym
s = restrictlookup(yyDollar[3].sym.Name, yyDollar[1].node.Name.Pkg)
yyDollar[1].node.Used = true
yyVAL.node = oldname(s)
break
}
yyVAL.node = Nod(OXDOT, yyDollar[1].node, newname(yyDollar[3].sym))
}
case 191:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1317
{
yyVAL.node = Nod(OTARRAY, yyDollar[2].node, yyDollar[4].node)
}
case 192:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1321
{
// array literal of nelem
yyVAL.node = Nod(OTARRAY, Nod(ODDD, nil, nil), yyDollar[4].node)
}
case 193:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1326
{
yyVAL.node = Nod(OTCHAN, yyDollar[2].node, nil)
yyVAL.node.Etype = Cboth
}
case 194:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1331
{
yyVAL.node = Nod(OTCHAN, yyDollar[3].node, nil)
yyVAL.node.Etype = Csend
}
case 195:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1336
{
yyVAL.node = Nod(OTMAP, yyDollar[3].node, yyDollar[5].node)
}
case 198:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1344
{
yyVAL.node = Nod(OIND, yyDollar[2].node, nil)
}
case 199:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1350
{
yyVAL.node = Nod(OTCHAN, yyDollar[3].node, nil)
yyVAL.node.Etype = Crecv
}
case 200:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1357
{
yyVAL.node = Nod(OTSTRUCT, nil, nil)
yyVAL.node.List = yyDollar[3].list
fixlbrace(yyDollar[2].i)
}
case 201:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1363
{
yyVAL.node = Nod(OTSTRUCT, nil, nil)
fixlbrace(yyDollar[2].i)
}
case 202:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1370
{
yyVAL.node = Nod(OTINTER, nil, nil)
yyVAL.node.List = yyDollar[3].list
fixlbrace(yyDollar[2].i)
}
case 203:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1376
{
yyVAL.node = Nod(OTINTER, nil, nil)
fixlbrace(yyDollar[2].i)
}
case 204:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1387
{
yyVAL.node = yyDollar[2].node
if yyVAL.node == nil {
break
}
if noescape && yyDollar[3].list != nil {
Yyerror("can only use //go:noescape with external func implementations")
}
yyVAL.node.Nbody = yyDollar[3].list
yyVAL.node.Func.Endlineno = lineno
yyVAL.node.Noescape = noescape
yyVAL.node.Func.Norace = norace
yyVAL.node.Func.Nosplit = nosplit
yyVAL.node.Func.Noinline = noinline
yyVAL.node.Func.Nowritebarrier = nowritebarrier
yyVAL.node.Func.Nowritebarrierrec = nowritebarrierrec
yyVAL.node.Func.Systemstack = systemstack
funcbody(yyVAL.node)
}
case 205:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1409
{
var t *Node
yyVAL.node = nil
yyDollar[3].list = checkarglist(yyDollar[3].list, 1)
if yyDollar[1].sym.Name == "init" {
yyDollar[1].sym = renameinit()
if yyDollar[3].list != nil || yyDollar[5].list != nil {
Yyerror("func init must have no arguments and no return values")
}
}
if localpkg.Name == "main" && yyDollar[1].sym.Name == "main" {
if yyDollar[3].list != nil || yyDollar[5].list != nil {
Yyerror("func main must have no arguments and no return values")
}
}
t = Nod(OTFUNC, nil, nil)
t.List = yyDollar[3].list
t.Rlist = yyDollar[5].list
yyVAL.node = Nod(ODCLFUNC, nil, nil)
yyVAL.node.Func.Nname = newfuncname(yyDollar[1].sym)
yyVAL.node.Func.Nname.Name.Defn = yyVAL.node
yyVAL.node.Func.Nname.Name.Param.Ntype = t // TODO: check if nname already has an ntype
declare(yyVAL.node.Func.Nname, PFUNC)
funchdr(yyVAL.node)
}
case 206:
yyDollar = yyS[yypt-8 : yypt+1]
//line go.y:1440
{
var rcvr, t *Node
yyVAL.node = nil
yyDollar[2].list = checkarglist(yyDollar[2].list, 0)
yyDollar[6].list = checkarglist(yyDollar[6].list, 1)
if yyDollar[2].list == nil {
Yyerror("method has no receiver")
break
}
if yyDollar[2].list.Next != nil {
Yyerror("method has multiple receivers")
break
}
rcvr = yyDollar[2].list.N
if rcvr.Op != ODCLFIELD {
Yyerror("bad receiver in method")
break
}
t = Nod(OTFUNC, rcvr, nil)
t.List = yyDollar[6].list
t.Rlist = yyDollar[8].list
yyVAL.node = Nod(ODCLFUNC, nil, nil)
yyVAL.node.Func.Shortname = newfuncname(yyDollar[4].sym)
yyVAL.node.Func.Nname = methodname1(yyVAL.node.Func.Shortname, rcvr.Right)
yyVAL.node.Func.Nname.Name.Defn = yyVAL.node
yyVAL.node.Func.Nname.Name.Param.Ntype = t
yyVAL.node.Func.Nname.Nointerface = nointerface
declare(yyVAL.node.Func.Nname, PFUNC)
funchdr(yyVAL.node)
}
case 207:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1478
{
var s *Sym
var t *Type
yyVAL.node = nil
s = yyDollar[1].sym
t = functype(nil, yyDollar[3].list, yyDollar[5].list)
importsym(s, ONAME)
if s.Def != nil && s.Def.Op == ONAME {
if Eqtype(t, s.Def.Type) {
dclcontext = PDISCARD // since we skip funchdr below
break
}
Yyerror("inconsistent definition for func %v during import\n\t%v\n\t%v", s, s.Def.Type, t)
}
yyVAL.node = newfuncname(s)
yyVAL.node.Type = t
declare(yyVAL.node, PFUNC)
funchdr(yyVAL.node)
}
case 208:
yyDollar = yyS[yypt-8 : yypt+1]
//line go.y:1503
{
yyVAL.node = methodname1(newname(yyDollar[4].sym), yyDollar[2].list.N.Right)
yyVAL.node.Type = functype(yyDollar[2].list.N, yyDollar[6].list, yyDollar[8].list)
checkwidth(yyVAL.node.Type)
addmethod(yyDollar[4].sym, yyVAL.node.Type, false, nointerface)
nointerface = false
funchdr(yyVAL.node)
// inl.C's inlnode in on a dotmeth node expects to find the inlineable body as
// (dotmeth's type).Nname.Inl, and dotmeth's type has been pulled
// out by typecheck's lookdot as this $$.ttype. So by providing
// this back link here we avoid special casing there.
yyVAL.node.Type.Nname = yyVAL.node
}
case 209:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1521
{
yyDollar[3].list = checkarglist(yyDollar[3].list, 1)
yyVAL.node = Nod(OTFUNC, nil, nil)
yyVAL.node.List = yyDollar[3].list
yyVAL.node.Rlist = yyDollar[5].list
}
case 210:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1529
{
yyVAL.list = nil
}
case 211:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1533
{
yyVAL.list = yyDollar[2].list
if yyVAL.list == nil {
yyVAL.list = list1(Nod(OEMPTY, nil, nil))
}
}
case 212:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1542
{
yyVAL.list = nil
}
case 213:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1546
{
yyVAL.list = list1(Nod(ODCLFIELD, nil, yyDollar[1].node))
}
case 214:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1550
{
yyDollar[2].list = checkarglist(yyDollar[2].list, 0)
yyVAL.list = yyDollar[2].list
}
case 215:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1557
{
closurehdr(yyDollar[1].node)
}
case 216:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1563
{
yyVAL.node = closurebody(yyDollar[3].list)
fixlbrace(yyDollar[2].i)
}
case 217:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1568
{
yyVAL.node = closurebody(nil)
}
case 218:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1579
{
yyVAL.list = nil
}
case 219:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1583
{
yyVAL.list = concat(yyDollar[1].list, yyDollar[2].list)
if nsyntaxerrors == 0 {
testdclstack()
}
noescape = false
noinline = false
nointerface = false
norace = false
nosplit = false
nowritebarrier = false
nowritebarrierrec = false
systemstack = false
}
case 221:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1601
{
yyVAL.list = concat(yyDollar[1].list, yyDollar[3].list)
}
case 223:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1608
{
yyVAL.list = concat(yyDollar[1].list, yyDollar[3].list)
}
case 224:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1614
{
yyVAL.list = list1(yyDollar[1].node)
}
case 225:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1618
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 227:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1625
{
yyVAL.list = concat(yyDollar[1].list, yyDollar[3].list)
}
case 228:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1631
{
yyVAL.list = list1(yyDollar[1].node)
}
case 229:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1635
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 230:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1641
{
var l *NodeList
var n *Node
l = yyDollar[1].list
if l == nil || l.N.Sym.Name == "?" {
// ? symbol, during import (list1(nil) == nil)
n = yyDollar[2].node
if n.Op == OIND {
n = n.Left
}
n = embedded(n.Sym, importpkg)
n.Right = yyDollar[2].node
n.SetVal(yyDollar[3].val)
yyVAL.list = list1(n)
break
}
for l = yyDollar[1].list; l != nil; l = l.Next {
l.N = Nod(ODCLFIELD, l.N, yyDollar[2].node)
l.N.SetVal(yyDollar[3].val)
}
}
case 231:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1665
{
yyDollar[1].node.SetVal(yyDollar[2].val)
yyVAL.list = list1(yyDollar[1].node)
}
case 232:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1670
{
yyDollar[2].node.SetVal(yyDollar[4].val)
yyVAL.list = list1(yyDollar[2].node)
Yyerror("cannot parenthesize embedded type")
}
case 233:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1676
{
yyDollar[2].node.Right = Nod(OIND, yyDollar[2].node.Right, nil)
yyDollar[2].node.SetVal(yyDollar[3].val)
yyVAL.list = list1(yyDollar[2].node)
}
case 234:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1682
{
yyDollar[3].node.Right = Nod(OIND, yyDollar[3].node.Right, nil)
yyDollar[3].node.SetVal(yyDollar[5].val)
yyVAL.list = list1(yyDollar[3].node)
Yyerror("cannot parenthesize embedded type")
}
case 235:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:1689
{
yyDollar[3].node.Right = Nod(OIND, yyDollar[3].node.Right, nil)
yyDollar[3].node.SetVal(yyDollar[5].val)
yyVAL.list = list1(yyDollar[3].node)
Yyerror("cannot parenthesize embedded type")
}
case 236:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1698
{
var n *Node
yyVAL.sym = yyDollar[1].sym
n = oldname(yyDollar[1].sym)
if n.Name != nil && n.Name.Pack != nil {
n.Name.Pack.Used = true
}
}
case 237:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1708
{
var pkg *Pkg
if yyDollar[1].sym.Def == nil || yyDollar[1].sym.Def.Op != OPACK {
Yyerror("%v is not a package", yyDollar[1].sym)
pkg = localpkg
} else {
yyDollar[1].sym.Def.Used = true
pkg = yyDollar[1].sym.Def.Name.Pkg
}
yyVAL.sym = restrictlookup(yyDollar[3].sym.Name, pkg)
}
case 238:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1723
{
yyVAL.node = embedded(yyDollar[1].sym, localpkg)
}
case 239:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1729
{
yyVAL.node = Nod(ODCLFIELD, yyDollar[1].node, yyDollar[2].node)
ifacedcl(yyVAL.node)
}
case 240:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1734
{
yyVAL.node = Nod(ODCLFIELD, nil, oldname(yyDollar[1].sym))
}
case 241:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1738
{
yyVAL.node = Nod(ODCLFIELD, nil, oldname(yyDollar[2].sym))
Yyerror("cannot parenthesize embedded type")
}
case 242:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1745
{
// without func keyword
yyDollar[2].list = checkarglist(yyDollar[2].list, 1)
yyVAL.node = Nod(OTFUNC, fakethis(), nil)
yyVAL.node.List = yyDollar[2].list
yyVAL.node.Rlist = yyDollar[4].list
}
case 244:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1759
{
yyVAL.node = Nod(ONONAME, nil, nil)
yyVAL.node.Sym = yyDollar[1].sym
yyVAL.node = Nod(OKEY, yyVAL.node, yyDollar[2].node)
}
case 245:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1765
{
yyVAL.node = Nod(ONONAME, nil, nil)
yyVAL.node.Sym = yyDollar[1].sym
yyVAL.node = Nod(OKEY, yyVAL.node, yyDollar[2].node)
}
case 247:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1774
{
yyVAL.list = list1(yyDollar[1].node)
}
case 248:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1778
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 249:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1783
{
yyVAL.list = nil
}
case 250:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1787
{
yyVAL.list = yyDollar[1].list
}
case 251:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1795
{
yyVAL.node = nil
}
case 253:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1800
{
yyVAL.node = liststmt(yyDollar[1].list)
}
case 255:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1805
{
yyVAL.node = nil
}
case 261:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1816
{
yyDollar[1].node = Nod(OLABEL, yyDollar[1].node, nil)
yyDollar[1].node.Sym = dclstack // context, for goto restrictions
}
case 262:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:1821
{
var l *NodeList
yyDollar[1].node.Name.Defn = yyDollar[4].node
l = list1(yyDollar[1].node)
if yyDollar[4].node != nil {
l = list(l, yyDollar[4].node)
}
yyVAL.node = liststmt(l)
}
case 263:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1832
{
// will be converted to OFALL
yyVAL.node = Nod(OXFALL, nil, nil)
yyVAL.node.Xoffset = int64(block)
}
case 264:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1838
{
yyVAL.node = Nod(OBREAK, yyDollar[2].node, nil)
}
case 265:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1842
{
yyVAL.node = Nod(OCONTINUE, yyDollar[2].node, nil)
}
case 266:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1846
{
yyVAL.node = Nod(OPROC, yyDollar[2].node, nil)
}
case 267:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1850
{
yyVAL.node = Nod(ODEFER, yyDollar[2].node, nil)
}
case 268:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1854
{
yyVAL.node = Nod(OGOTO, yyDollar[2].node, nil)
yyVAL.node.Sym = dclstack // context, for goto restrictions
}
case 269:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1859
{
yyVAL.node = Nod(ORETURN, nil, nil)
yyVAL.node.List = yyDollar[2].list
if yyVAL.node.List == nil && Curfn != nil {
var l *NodeList
for l = Curfn.Func.Dcl; l != nil; l = l.Next {
if l.N.Class == PPARAM {
continue
}
if l.N.Class != PPARAMOUT {
break
}
if l.N.Sym.Def != l.N {
Yyerror("%s is shadowed during return", l.N.Sym.Name)
}
}
}
}
case 270:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1881
{
yyVAL.list = nil
if yyDollar[1].node != nil {
yyVAL.list = list1(yyDollar[1].node)
}
}
case 271:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1888
{
yyVAL.list = yyDollar[1].list
if yyDollar[3].node != nil {
yyVAL.list = list(yyVAL.list, yyDollar[3].node)
}
}
case 272:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1897
{
yyVAL.list = list1(yyDollar[1].node)
}
case 273:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1901
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 274:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1907
{
yyVAL.list = list1(yyDollar[1].node)
}
case 275:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1911
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 276:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1917
{
yyVAL.list = list1(yyDollar[1].node)
}
case 277:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1921
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 278:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1927
{
yyVAL.list = list1(yyDollar[1].node)
}
case 279:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1931
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 280:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1940
{
yyVAL.list = list1(yyDollar[1].node)
}
case 281:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:1944
{
yyVAL.list = list1(yyDollar[1].node)
}
case 282:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1948
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 283:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:1952
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 284:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1957
{
yyVAL.list = nil
}
case 285:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:1961
{
yyVAL.list = yyDollar[1].list
}
case 290:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1975
{
yyVAL.node = nil
}
case 292:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1981
{
yyVAL.list = nil
}
case 294:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1987
{
yyVAL.node = nil
}
case 296:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1993
{
yyVAL.list = nil
}
case 298:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:1999
{
yyVAL.list = nil
}
case 300:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:2005
{
yyVAL.list = nil
}
case 302:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:2011
{
yyVAL.val.U = nil
}
case 304:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2021
{
importimport(yyDollar[2].sym, yyDollar[3].val.U.(string))
}
case 305:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2025
{
importvar(yyDollar[2].sym, yyDollar[3].typ)
}
case 306:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2029
{
importconst(yyDollar[2].sym, Types[TIDEAL], yyDollar[4].node)
}
case 307:
yyDollar = yyS[yypt-6 : yypt+1]
//line go.y:2033
{
importconst(yyDollar[2].sym, yyDollar[3].typ, yyDollar[5].node)
}
case 308:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2037
{
importtype(yyDollar[2].typ, yyDollar[3].typ)
}
case 309:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2041
{
if yyDollar[2].node == nil {
dclcontext = PEXTERN // since we skip the funcbody below
break
}
yyDollar[2].node.Func.Inl = yyDollar[3].list
funcbody(yyDollar[2].node)
importlist = append(importlist, yyDollar[2].node)
if Debug['E'] > 0 {
fmt.Printf("import [%q] func %v \n", importpkg.Path, yyDollar[2].node)
if Debug['m'] > 2 && yyDollar[2].node.Func.Inl != nil {
fmt.Printf("inl body:%v\n", yyDollar[2].node.Func.Inl)
}
}
}
case 310:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2062
{
yyVAL.sym = yyDollar[1].sym
structpkg = yyVAL.sym.Pkg
}
case 311:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2069
{
yyVAL.typ = pkgtype(yyDollar[1].sym)
importsym(yyDollar[1].sym, OTYPE)
}
case 317:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2089
{
yyVAL.typ = pkgtype(yyDollar[1].sym)
}
case 318:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2093
{
// predefined name like uint8
yyDollar[1].sym = Pkglookup(yyDollar[1].sym.Name, builtinpkg)
if yyDollar[1].sym.Def == nil || yyDollar[1].sym.Def.Op != OTYPE {
Yyerror("%s is not a type", yyDollar[1].sym.Name)
yyVAL.typ = nil
} else {
yyVAL.typ = yyDollar[1].sym.Def.Type
}
}
case 319:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2104
{
yyVAL.typ = aindex(nil, yyDollar[3].typ)
}
case 320:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2108
{
yyVAL.typ = aindex(nodlit(yyDollar[2].val), yyDollar[4].typ)
}
case 321:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2112
{
yyVAL.typ = maptype(yyDollar[3].typ, yyDollar[5].typ)
}
case 322:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2116
{
yyVAL.typ = tostruct(yyDollar[3].list)
}
case 323:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2120
{
yyVAL.typ = tointerface(yyDollar[3].list)
}
case 324:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:2124
{
yyVAL.typ = Ptrto(yyDollar[2].typ)
}
case 325:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:2128
{
yyVAL.typ = typ(TCHAN)
yyVAL.typ.Type = yyDollar[2].typ
yyVAL.typ.Chan = Cboth
}
case 326:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2134
{
yyVAL.typ = typ(TCHAN)
yyVAL.typ.Type = yyDollar[3].typ
yyVAL.typ.Chan = Cboth
}
case 327:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2140
{
yyVAL.typ = typ(TCHAN)
yyVAL.typ.Type = yyDollar[3].typ
yyVAL.typ.Chan = Csend
}
case 328:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2148
{
yyVAL.typ = typ(TCHAN)
yyVAL.typ.Type = yyDollar[3].typ
yyVAL.typ.Chan = Crecv
}
case 329:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2156
{
yyVAL.typ = functype(nil, yyDollar[3].list, yyDollar[5].list)
}
case 330:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2162
{
yyVAL.node = Nod(ODCLFIELD, nil, typenod(yyDollar[2].typ))
if yyDollar[1].sym != nil {
yyVAL.node.Left = newname(yyDollar[1].sym)
}
yyVAL.node.SetVal(yyDollar[3].val)
}
case 331:
yyDollar = yyS[yypt-4 : yypt+1]
//line go.y:2170
{
var t *Type
t = typ(TARRAY)
t.Bound = -1
t.Type = yyDollar[3].typ
yyVAL.node = Nod(ODCLFIELD, nil, typenod(t))
if yyDollar[1].sym != nil {
yyVAL.node.Left = newname(yyDollar[1].sym)
}
yyVAL.node.Isddd = true
yyVAL.node.SetVal(yyDollar[4].val)
}
case 332:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2187
{
var s *Sym
var p *Pkg
if yyDollar[1].sym != nil && yyDollar[1].sym.Name != "?" {
yyVAL.node = Nod(ODCLFIELD, newname(yyDollar[1].sym), typenod(yyDollar[2].typ))
yyVAL.node.SetVal(yyDollar[3].val)
} else {
s = yyDollar[2].typ.Sym
if s == nil && Isptr[yyDollar[2].typ.Etype] {
s = yyDollar[2].typ.Type.Sym
}
p = importpkg
if yyDollar[1].sym != nil {
p = yyDollar[1].sym.Pkg
}
yyVAL.node = embedded(s, p)
yyVAL.node.Right = typenod(yyDollar[2].typ)
yyVAL.node.SetVal(yyDollar[3].val)
}
}
case 333:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2211
{
yyVAL.node = Nod(ODCLFIELD, newname(yyDollar[1].sym), typenod(functype(fakethis(), yyDollar[3].list, yyDollar[5].list)))
}
case 334:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2215
{
yyVAL.node = Nod(ODCLFIELD, nil, typenod(yyDollar[1].typ))
}
case 335:
yyDollar = yyS[yypt-0 : yypt+1]
//line go.y:2220
{
yyVAL.list = nil
}
case 337:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2227
{
yyVAL.list = yyDollar[2].list
}
case 338:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2231
{
yyVAL.list = list1(Nod(ODCLFIELD, nil, typenod(yyDollar[1].typ)))
}
case 339:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2241
{
yyVAL.node = nodlit(yyDollar[1].val)
}
case 340:
yyDollar = yyS[yypt-2 : yypt+1]
//line go.y:2245
{
yyVAL.node = nodlit(yyDollar[2].val)
switch yyVAL.node.Val().Ctype() {
case CTINT, CTRUNE:
mpnegfix(yyVAL.node.Val().U.(*Mpint))
break
case CTFLT:
mpnegflt(yyVAL.node.Val().U.(*Mpflt))
break
case CTCPLX:
mpnegflt(&yyVAL.node.Val().U.(*Mpcplx).Real)
mpnegflt(&yyVAL.node.Val().U.(*Mpcplx).Imag)
break
default:
Yyerror("bad negated constant")
}
}
case 341:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2263
{
yyVAL.node = oldname(Pkglookup(yyDollar[1].sym.Name, builtinpkg))
if yyVAL.node.Op != OLITERAL {
Yyerror("bad constant %v", yyVAL.node.Sym)
}
}
case 343:
yyDollar = yyS[yypt-5 : yypt+1]
//line go.y:2273
{
if yyDollar[2].node.Val().Ctype() == CTRUNE && yyDollar[4].node.Val().Ctype() == CTINT {
yyVAL.node = yyDollar[2].node
mpaddfixfix(yyDollar[2].node.Val().U.(*Mpint), yyDollar[4].node.Val().U.(*Mpint), 0)
break
}
yyDollar[4].node.Val().U.(*Mpcplx).Real = yyDollar[4].node.Val().U.(*Mpcplx).Imag
Mpmovecflt(&yyDollar[4].node.Val().U.(*Mpcplx).Imag, 0.0)
yyVAL.node = nodcplxlit(yyDollar[2].node.Val(), yyDollar[4].node.Val())
}
case 346:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2289
{
yyVAL.list = list1(yyDollar[1].node)
}
case 347:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2293
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 348:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2299
{
yyVAL.list = list1(yyDollar[1].node)
}
case 349:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2303
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
case 350:
yyDollar = yyS[yypt-1 : yypt+1]
//line go.y:2309
{
yyVAL.list = list1(yyDollar[1].node)
}
case 351:
yyDollar = yyS[yypt-3 : yypt+1]
//line go.y:2313
{
yyVAL.list = list(yyDollar[1].list, yyDollar[3].node)
}
}
goto yystack /* stack new state and value */
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment