mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: move Io state into lexer and remove Io type
Pass lexer around so state is accessible and dependency is explicit. In the process remove EOF -> '\n' conversion that has to be corrected for when reporting errors. Change-Id: If95564b70e7484dedc1f5348e585cd19acbc1243 Reviewed-on: https://go-review.googlesource.com/19819 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
0784e6918e
commit
e7524d51fd
4 changed files with 119 additions and 141 deletions
|
|
@ -116,12 +116,6 @@ func Yyerror(format string, args ...interface{}) {
|
|||
if strings.HasPrefix(msg, "syntax error") {
|
||||
nsyntaxerrors++
|
||||
|
||||
// An unexpected EOF caused a syntax error. Use the previous
|
||||
// line number since getc generated a fake newline character.
|
||||
if curio.eofnl {
|
||||
lexlineno = prevlineno
|
||||
}
|
||||
|
||||
// only one syntax error per line
|
||||
if int32(yyerror_lastsyntax) == lexlineno {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue