Skip to content

Commit

Permalink
go/parser: imaginary constants and ! may start an expression
Browse files Browse the repository at this point in the history
Complete list of tokens that can start a top-level expression.

R=rsc
CC=golang-dev
https://golang.org/cl/5671074
  • Loading branch information
griesemer committed Feb 16, 2012
1 parent 3908467 commit f43d2b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pkg/go/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1861,10 +1861,10 @@ func (p *parser) parseStmt() (s ast.Stmt) {
case token.CONST, token.TYPE, token.VAR:
s = &ast.DeclStmt{Decl: p.parseDecl()}
case
// tokens that may start a top-level expression
token.IDENT, token.INT, token.FLOAT, token.CHAR, token.STRING, token.FUNC, token.LPAREN, // operand
token.LBRACK, token.STRUCT, // composite type
token.MUL, token.AND, token.ARROW, token.ADD, token.SUB, token.XOR: // unary operators
// tokens that may start an expression
token.IDENT, token.INT, token.FLOAT, token.IMAG, token.CHAR, token.STRING, token.FUNC, token.LPAREN, // operands
token.LBRACK, token.STRUCT, // composite types
token.ADD, token.SUB, token.MUL, token.AND, token.XOR, token.ARROW, token.NOT: // unary operators
s, _ = p.parseSimpleStmt(labelOk)
// because of the required look-ahead, labeled statements are
// parsed by parseSimpleStmt - don't expect a semicolon after
Expand Down

0 comments on commit f43d2b7

Please sign in to comment.