Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/cmd/goyacc: goyacc generates a parser routine $$Tokname that doesn't work #44556

Open
danswartzendruber opened this issue Feb 23, 2021 · 5 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@danswartzendruber
Copy link

What version of Go are you using (go version)?

$ go version

1.15

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/dswartz/.cache/go-build" GOENV="/home/dswartz/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/dswartz/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/dswartz/go" GOPRIVATE="" GOPROXY="direct" GOROOT="/usr/lib/golang" GOSUMDB="off" GOTMPDIR="" GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build943484181=/tmp/go-build -gno-record-gcc-switches"
$ go env

What did you do?

A trivial yacc grammar with the following tokens:

%token ABLE
%token BAKER
%token CHARLIE

The main function call fmt.Printf with the output of yyTokname (passing in the token const)

What did you expect to see?

ABLE => "ABLE"
BAKER => "BAKER"
CHARLIE => "CHARLIE"

What did you see instead?

ABLE => "tok-57346"
BAKER => "tok-57347"
CHARLIE => "tok-57348"

@danswartzendruber
Copy link
Author

This is due to said routine assuming that tokens start at 1. They don't.

@danswartzendruber
Copy link
Author

Opened against wrong directory.

@danswartzendruber danswartzendruber changed the title goyacc generates a parser routine yyTokname (yy default) that doesn't work tools/cmd/goyacc: goyacc generates a parser routine yyTokname (yy default) that doesn't work Feb 23, 2021
@danswartzendruber danswartzendruber changed the title tools/cmd/goyacc: goyacc generates a parser routine yyTokname (yy default) that doesn't work tools/cmd/goyacc: goyacc generates a parser routine $$Tokname that doesn't work Feb 23, 2021
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 23, 2021
@danswartzendruber
Copy link
Author

danswartzendruber commented Feb 23, 2021

golang/tools#279.

@ianlancetaylor
Copy link
Contributor

All the Go repos shared a single Gerrit instance. If you use a GitHub pull request, it needs to be against the right repo, but then it will be automatically pulled into the shared Gerrit.

@danswartzendruber
Copy link
Author

danswartzendruber commented Feb 23, 2021 via email

@seankhliao seankhliao added this to the Unplanned milestone Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants