Example #1
0
File: parser.go Project: h12w/gombi
func (p *parser) parseValueSpec(n *parse.Node) *ast.ValueSpec {
	n = n.Child(0)
	spec := ast.ValueSpec{}
	if n.Is(identifierList) {
		spec.Names = p.parseIdentList(n)
	} else {
		spec.Names = p.parseIdentList(n.Child(0))
		if n.Child(1).Is(type_) {
			spec.Type = p.parseType(n.Child(1))
		}
		spec.Values = p.parseExprList(n.LastChild())
	}
	return &spec
}