Commit b57b10f9 authored by Robert Griesemer's avatar Robert Griesemer

go/parser: consume auto-inserted semi when calling ParseExpr()

Fixes #1170.

R=rsc
CC=golang-dev
https://golang.org/cl/2622041
parent 49084db3
......@@ -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()
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment