mirror of
https://github.com/golang/go
synced 2024-11-21 22:24:40 -07:00
go/parser: consume auto-inserted semi when calling ParseExpr()
Fixes #1170. R=rsc CC=golang-dev https://golang.org/cl/2622041
This commit is contained in:
parent
49084db386
commit
b57b10f992
@ -69,7 +69,11 @@ func ParseExpr(filename string, src interface{}) (ast.Expr, os.Error) {
|
||||
|
||||
var p parser
|
||||
p.init(filename, data, 0)
|
||||
return p.parseExpr(), p.parseEOF()
|
||||
x := p.parseExpr()
|
||||
if p.tok == token.SEMICOLON {
|
||||
p.next() // consume automatically inserted semicolon, if any
|
||||
}
|
||||
return x, p.parseEOF()
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user