Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions goyacc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,6 @@ func %[1]sParse(yylex %[1]sLexer, parser *Parser) int {
yyEx, _ := yylex.(%[1]sLexerEx)
var yyn int
parser.yylval = %[1]sSymType{}
parser.yyVAL = %[1]sSymType{}
yyS := parser.cache

Nerrs := 0 /* number of errors */
Expand Down Expand Up @@ -580,13 +579,13 @@ ret1:
yystack:
/* put a state and value onto the stack */
yyp++
if yyp >= len(yyS) {
if yyp+1 >= len(yyS) {
nyys := make([]%[1]sSymType, len(yyS)*2)
copy(nyys, yyS)
yyS = nyys
parser.cache = yyS
}
yyS[yyp] = parser.yyVAL
parser.yyVAL = &yyS[yyp+1]
yyS[yyp].yys = yystate

yynewstate:
Expand Down Expand Up @@ -614,7 +613,7 @@ yynewstate:
switch {
case yyn > 0: // shift
yychar = -1
parser.yyVAL = parser.yylval
*parser.yyVAL = parser.yylval
yystate = yyn
yyshift = yyn
if %[1]sDebug >= 2 {
Expand Down Expand Up @@ -712,7 +711,7 @@ yynewstate:
yyS = nyys
parser.cache = yyS
}
parser.yyVAL = yyS[yyp+1]
parser.yyVAL = &yyS[yyp+1]

/* consult goto table to find next state */
exState := yystate
Expand Down Expand Up @@ -781,7 +780,7 @@ yynewstate:
mustFormat(f, `%u
}

if yyEx != nil && yyEx.Reduced(r, exState, &parser.yyVAL) {
if yyEx != nil && yyEx.Reduced(r, exState, parser.yyVAL) {
return -1
}
goto yystack /* stack new state and value */
Expand Down
11 changes: 5 additions & 6 deletions parser.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion yy_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ type Parser struct {
// the following fields are used by yyParse to reduce allocation.
cache []yySymType
yylval yySymType
yyVAL yySymType
yyVAL *yySymType
}

type stmtTexter interface {
Expand Down