1
0
mirror of https://github.com/golang/go synced 2024-09-30 16:08:36 -06:00
Commit Graph

16 Commits

Author SHA1 Message Date
Jamie Wilkinson
9eb9690e39 cmd/goyacc: put //line annotations on the first column.
This appears to have broken since go1.11, and "go doc compile" and
https://golang.org/issue/24183 documents this new convention (point
2)

Change-Id: I6a4bc0fc51a18c17ac9a72a67d9a8eb4c879e0f9
Reviewed-on: https://go-review.googlesource.com/137515
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-26 03:27:08 +00:00
Jim Minter
4735f53fb3 cmd/goyacc: append trailing newline to text "Code generated by goyacc"
Fixes golang/go#26478

Change-Id: Ieaf7dcaf639b277555580964acfff034393284e2
GitHub-Last-Rev: f2a6ab2a513d4938cda62f46de7f5314714b5325
GitHub-Pull-Request: golang/tools#39
Reviewed-on: https://go-review.googlesource.com/124995
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-19 18:26:00 +00:00
Rob Pike
e2be0f7276 cmd/goyacc: include arguments in DO NOT EDIT marker
A follow-on to CL122095, which normalized the marker but
did not include the arguments.

Output now looks like this:

	// Code generated by goyacc -o expr.go -p expr expr.y. DO NOT EDIT.

Change-Id: I20577ea90943516f45478d778353b5bd2f485dfa
Reviewed-on: https://go-review.googlesource.com/122540
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-09 04:37:16 +00:00
Jonathan Pentecost
16f8f9bb72 cmd/goyacc: add header to generated go output file
Add "// Code generated by goyacc. DO NOT EDIT." to the top of the
generated go output file.

Fixes golang/go#26158

Change-Id: I5dd66af9cd8ccccd27440886c55cd604686472e3
Reviewed-on: https://go-review.googlesource.com/122095
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2018-07-05 09:00:07 +00:00
Nikhil Benesch
836e0f611e cmd/goyacc: fix an off-by-one error in lineno tracking
Previously, goyacc's line number tracking would run off by one whenever
a multiline comment was used inside of an action, like so:

    expr:
        TOKEN
        {
            /* Hello. */
        }

This is because the character after the multi-line comment close marker
(i.e., the character immediately after `*/`) was blindly printed out
instead of properly accounted for. A newline character after a
multi-line comment would fail to increment lineno, for example, and any
error messages generated after that point would refer to the wrong line.
Similarly, a variable reference after a multi-line comment, like

    $$.val = &someStruct{Value: /* oops */$1}

would copy the $ literally into the resulting Go code. (This was not a
problem in practice because multi-line comments are typically followed
by whitespace.)

Adjust the control flow so the character after the multi-line comment
close marker character gets run through the relevant switch statement
and accounted for.

Change-Id: I276b6ffdb7626101f76811b7ee4804bacc6ef740
Reviewed-on: https://go-review.googlesource.com/110495
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-01 01:19:15 +00:00
Tamir Duberstein
6185cb1f31 cmd/goyacc: remove empty branch
Found with honnef.co/go/tools/cmd/staticcheck.

Change-Id: I39e23936e01543db62b7b0919a3b58b65cd40099
Reviewed-on: https://go-review.googlesource.com/38174
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 21:33:42 +00:00
Tamir Duberstein
43bc42d6f5 cmd/goyacc: remove unused functions
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Ie7ee9f687bcec1faa40c890a84666ef6c27d9b77
Reviewed-on: https://go-review.googlesource.com/38176
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 21:33:35 +00:00
Tamir Duberstein
d332283808 cmd/goyacc: remove ineffective break statement
Found with honnef.co/go/tools/cmd/staticcheck.

Change-Id: I7f765ef1710d151ebda5716c99587acd3a90db1f
Reviewed-on: https://go-review.googlesource.com/38173
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 15:30:16 +00:00
Tamir Duberstein
1f5953e340 cmd/goyacc: use a constant instead of zero value
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I373d710e0f5f98dcf591826a26541d1d12696e14
Reviewed-on: https://go-review.googlesource.com/38175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 15:28:09 +00:00
Tamir Duberstein
ab34c5f581 cmd/goyacc: remove unused generated bindings
Found with honnef.co/go/tools/cmd/unused (in CockroachDB).

Change-Id: I0e2f7ac6ad2a0fdc724928f316060f06c3261ece
Reviewed-on: https://go-review.googlesource.com/38178
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-03-14 23:14:11 +00:00
Tamir Duberstein
f2e43688df cmd/goyacc: merge variable declaration with assignment
Found with honnef.co/go/tools/cmd/simple.

Change-Id: I04c65394f1c6404f57bb2088353325899f35011f
Reviewed-on: https://go-review.googlesource.com/38177
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-03-14 23:13:33 +00:00
David R. Jenni
43de7a390a x/tools/cmd/goyacc: remove unused function.
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Iad26e1ae1dbeb29a3223279eccc4ba6f6bb48bd6
Reviewed-on: https://go-review.googlesource.com/37631
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:38:58 +00:00
Jordan Lewis
ebf631f917 cmd/goyacc: quadruple the max states and actions
This commit quadruples the maximum number of states and the size of the
action table to allow for larger grammars.

Fixes golang/go#11517

Change-Id: Ieb64efa8e3402ae1a5a9190710f98a44195ecd1b
Reviewed-on: https://go-review.googlesource.com/33585
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-28 18:37:26 +00:00
Tamir Duberstein
4c4edc0bec cmd/goyacc: remove hardcoded NTYPES
Updates #16144.

Change-Id: I196dd4e871c88792ea95c02b31c54f269fdc505f
Reviewed-on: https://go-review.googlesource.com/27350
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-07 17:45:45 +00:00
Tamir Duberstein
df703d6484 cmd/goyacc: remove unused constants
Change-Id: I48002d39de6d32ee9410fd4271f623b5661f0081
Reviewed-on: https://go-review.googlesource.com/27328
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-18 16:45:58 +00:00
Brad Fitzpatrick
f1ba7e38e5 cmd/goyacc: move go tool yacc from the go repo
This moves the 'go tool yacc' command from the main Go repo
to x/tools.

Copied from go rev 795ad07b3 + doc changes from "go tool yacc" to "goyacc".

Updates golang/go#11229

Change-Id: I6d17911a3bf64724c090c4fe4903238e3bce3b8c
Reviewed-on: https://go-review.googlesource.com/27324
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-18 15:37:45 +00:00