Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/parser: ParseExpr ignores text after certain tokens #8207

Closed
gordonklaus opened this issue Jun 14, 2014 · 6 comments
Closed

go/parser: ParseExpr ignores text after certain tokens #8207

gordonklaus opened this issue Jun 14, 2014 · 6 comments
Assignees
Milestone

Comments

@gordonklaus
Copy link
Contributor

@gordonklaus gordonklaus commented Jun 14, 2014

parser.ParseExpr(expr+sep+whatever) yields an ast.Expr and no error for sep in
"!)]};,", whereas I expect an error "unexpected token" or something.

http://play.golang.org/p/QhO66r2d5j
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 14, 2014

Comment 1:

Labels changed: added repo-main, release-go1.4.

Owner changed to @griesemer.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jun 14, 2014

Comment 2:

I cannot reproduce this at tip. Instead I get:
$ go run x.go
<nil> 1:6: expected 'EOF', found '!'
<nil> 1:6: expected 'EOF', found ')'
<nil> 1:6: expected 'EOF', found ']'
<nil> 1:6: expected 'EOF', found '}'
<nil> 1:7: expected 'EOF', found 'IDENT' dh3
<nil> 1:6: expected 'EOF', found ','
Please verify your setup and confirm.

Status changed to WaitingForReply.

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 14, 2014

Comment 3:

CL https://golang.org/cl/106010046 mentions this issue.
@gordonklaus
Copy link
Contributor Author

@gordonklaus gordonklaus commented Jun 14, 2014

Comment 4:

Sorry, I thought I was on tip but actually was not.  I see the same results as you do.
However, the case of semicolon doesn't look right:  ParseExpr("a+b;") should return an
error, no?
@griesemer
Copy link
Contributor

@griesemer griesemer commented Jun 16, 2014

Comment 5:

ParseExpr("a+b;") should indeed report an error. See updated CL.

Status changed to Accepted.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jun 17, 2014

Comment 6:

This issue was closed by revision 4f14d15.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Fixes golang#8207.

LGTM=gordon.klaus, bradfitz
R=golang-codereviews, wandakkelly, gordon.klaus, bradfitz
CC=golang-codereviews
https://golang.org/cl/106010046
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.