FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com,

I'd like you to review this change to
https://code.google.com/p/go/


Description:
cmd/yacc: fix debug print of token name

The array skips the first TOKSTART entries.

Fixes issue 4410.

Please review this at https://codereview.appspot.com/6999054/

Affected files:
M src/cmd/yacc/yacc.go


Index: src/cmd/yacc/yacc.go
===================================================================
--- a/src/cmd/yacc/yacc.go
+++ b/src/cmd/yacc/yacc.go
@@ -3228,9 +3228,10 @@
const $$Flag = -1000

func $$Tokname(c int) string {
- if c > 0 && c <= len($$Toknames) {
- if $$Toknames[c-1] != "" {
- return $$Toknames[c-1]
+ // 4 is TOKSTART above
+ if c >= 4 && c-4 < len($$Toknames) {
+ if $$Toknames[c-4] != "" {
+ return $$Toknames[c-4]
}
}
return __yyfmt__.Sprintf("tok-%v", c)

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedDec 22, '12 at 4:29p
activeDec 22, '12 at 10:31p
posts4
users2
websitegolang.org

2 users in discussion

Rsc: 3 posts Ken: 1 post

People

Translate

site design / logo © 2022 Grokbase