Commits

Sean Russell committed 13fade5 Merge

Merge

  • Participants
  • Parent commits 676f3b5, 8704eb4

Comments (0)

Files changed (2)

 )
 
 func output_tag(fset *token.FileSet, name *ast.Ident, kind byte) {
-	position := fset.Position(name.NamePos)
-	tags = append(tags, fmt.Sprintf("%s\t%s\t%d;\"\t%c",
-		name.Name, position.Filename, position.Line, kind))
+	switch kind {
+	case PKG:
+		append(tags, fmt.Sprintf("%s\t%s\t/\\m^\\s*package.*%s/;\"\t%c",
+			name.Name, position.Filename, name.Name, kind))
+	case FUNC:
+		append(tags, fmt.Sprintf("%s\t%s\t/\\m^\\s*func.*%s(.*{/;\"\t%c",
+			name.Name, position.Filename, name.Name, kind))
+	default:
+		position := fset.Position(name.NamePos)
+		append(tags, fmt.Sprintf("%s\t%s\t%d;\"\t%c",
+			name.Name, position.Filename, position.Line, kind))
+	}
 }
 
 func main() {
 	}
 }
 
-const FUNC, TYPE, VAR = 'f', 't', 'v'
+const FUNC, TYPE, VAR, PKG = 'f', 't', 'v', 'p'
 
 func parse_files() {
 	for _, f := range os.Args[1:] {
 		tree, err := parser.ParseFile(fileset, f, nil, 0)
 		if err != nil {
 		}
+		output_tag(fileset, tree.Name, PKG);
 
 		for _, node := range tree.Decls {
 			switch n := node.(type) {
+!_TAG_FILE_SORTED	1	
+FUNC	gotags.go	67;"	v
+PKG	gotags.go	67;"	v
+TYPE	gotags.go	67;"	v
+VAR	gotags.go	67;"	v
+do_gen_decl	gotags.go	/\m^\s*func.*do_gen_decl(.*{/;"	f
+main	gotags.go	/\m^\s*func.*main(.*{/;"	f
+main	gotags.go	/\m^\s*package.*main/;"	p
+output_tag	gotags.go	/\m^\s*func.*output_tag(.*{/;"	f
+parse_files	gotags.go	/\m^\s*func.*parse_files(.*{/;"	f
+tags	gotags.go	38;"	v