mirror of
https://github.com/golang/go
synced 2024-11-18 15:24:41 -07:00
836e0f611e
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> |
||
---|---|---|
.. | ||
testdata/expr | ||
doc.go | ||
yacc.go |