MCPcopy Create free account
hub / github.com/nsf/gocode / parse_decl

Method parse_decl

package_text.go:647–667  ·  view source on GitHub ↗

Decl = [ ImportDecl | ConstDecl | TypeDecl | VarDecl | FuncDecl | MethodDecl ] "\n" .

()

Source from the content-addressed store, hash-verified

645
646// Decl = [ ImportDecl | ConstDecl | TypeDecl | VarDecl | FuncDecl | MethodDecl ] "\n" .
647func (p *gc_parser) parse_decl() (pkg string, decl ast.Decl) {
648 switch p.lit {
649 case "import":
650 p.parse_import_decl()
651 case "const":
652 pkg, decl = p.parse_const_decl()
653 case "type":
654 pkg, decl = p.parse_type_decl()
655 case "var":
656 pkg, decl = p.parse_var_decl()
657 case "func":
658 p.next()
659 if p.tok == '(' {
660 pkg, decl = p.parse_method_decl()
661 } else {
662 pkg, decl = p.parse_func_decl()
663 }
664 }
665 p.expect('\n')
666 return
667}
668
669// Export = PackageClause { Decl } "$$" .
670// PackageClause = "package" identifier [ "safe" ] "\n" .

Callers 1

parse_exportMethod · 0.95

Calls 8

parse_import_declMethod · 0.95
parse_const_declMethod · 0.95
parse_type_declMethod · 0.95
parse_var_declMethod · 0.95
nextMethod · 0.95
parse_method_declMethod · 0.95
parse_func_declMethod · 0.95
expectMethod · 0.95

Tested by

no test coverage detected