1
0
mirror of https://github.com/golang/go synced 2024-09-29 17:14:29 -06:00

cmd/yacc: error rather than panic when TEMPSIZE is too small

I tried simply increasing the size of the slice but then I got an error
because NSTATES was too small. Leaving a real fix for after 1.7.

Update #16144.

Change-Id: I8676772cb79845dd4ca1619977d4d54a2ce6de59
Reviewed-on: https://go-review.googlesource.com/24321
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-06-22 06:27:31 -07:00
parent 0dae2fd149
commit b31ec5c564

View File

@ -683,6 +683,10 @@ outer:
levprd[nprod] = 0
}
if TEMPSIZE < ntokens+nnonter+1 {
errorf("too many tokens (%d) or non-terminals (%d)", ntokens, nnonter)
}
//
// end of all rules
// dump out the prefix code