}
}
-func (p *parser) seesComma(context string) bool {
+func (p *parser) atComma(context string) bool {
if p.tok == token.COMMA {
return true
}
- /*
- if p.tok == token.SEMICOLON && p.lit == "\n" {
- p.error(p.pos, "missing ',' before newline in "+context)
- return true // "insert" the comma and continue
+ if p.tok == token.SEMICOLON && p.lit == "\n" {
+ p.error(p.pos, "missing ',' before newline in "+context)
+ return true // "insert" the comma and continue
- }
- */
+ }
return false
}
// accept them all for more robust parsing and complain later
for typ := p.parseVarType(isParam); typ != nil; {
list = append(list, typ)
- if !p.seesComma("variable list") {
+ if p.tok != token.COMMA {
break
}
p.next()
// Go spec: The scope of an identifier denoting a function
// parameter or result variable is the function body.
p.declare(field, nil, scope, ast.Var, idents...)
- if !p.seesComma("parameter list") {
+ if !p.atComma("parameter list") {
break
}
p.next()
ellipsis = p.pos
p.next()
}
- if !p.seesComma("argument list") {
+ if !p.atComma("argument list") {
break
}
p.next()
for p.tok != token.RBRACE && p.tok != token.EOF {
list = append(list, p.parseElement(true))
- if !p.seesComma("composite literal") {
+ if !p.atComma("composite literal") {
break
}
p.next()