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

fix #1644: parse println x... #1659

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions parser/_testdata/printvariadic/parser.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

file printv.gop
noEntrypoint
ast.FuncDecl:
Name:
ast.Ident:
Name: main
Type:
ast.FuncType:
Params:
ast.FieldList:
Body:
ast.BlockStmt:
List:
ast.ExprStmt:
X:
ast.CallExpr:
Fun:
ast.Ident:
Name: println
Args:
ast.Ident:
Name: x
1 change: 1 addition & 0 deletions parser/_testdata/printvariadic/printv.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
println x...
4 changes: 2 additions & 2 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ func (p *parser) expectClosing(tok token.Token, context string) token.Pos {
}

func (p *parser) expectSemi() {
// semicolon is optional before a closing ')' or '}'
if p.tok != token.RPAREN && p.tok != token.RBRACE {
// semicolon is optional before a closing ')' or '}' or EOF
if p.tok != token.RPAREN && p.tok != token.RBRACE && p.tok != token.EOF {
switch p.tok {
case token.COMMA:
// permit a ',' instead of a ';' but complain
Expand Down