summaryrefslogtreecommitdiff
path: root/src/pkg/go/doc/doc.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-07-16 17:11:18 -0700
committerRobert Griesemer <gri@golang.org>2009-07-16 17:11:18 -0700
commit0355b4a281c8d3236b6c4c16bbe9bc5117397f10 (patch)
treeac8e22f1a710a97c4cbd785b5b8bb2f16efb1d44 /src/pkg/go/doc/doc.go
parentce55e24da294995932c7ed313d88d5167705bd88 (diff)
downloadgolang-0355b4a281c8d3236b6c4c16bbe9bc5117397f10.tar.gz
ast:
- renamed Program -> SourceFile - added Package node representing the AST for an entire package - added filter function to create a source file mimicking the interface of an entire package parser: - parser entry to parse entire packages - unified naming of parser entry points - factored out entry points into new file (interface.go) gofmt: - extended to accept single .go files, and package paths: gofmt file.go // formatting of a single file gofmt -x file.go // interface of a single file gofmt -x ./MyPackage // interface of a local package gofmt -x math // interface of a $GOROOT relative package Various adjustments in dependent files, documentation. R=rsc DELTA=634 (369 added, 153 deleted, 112 changed) OCL=31743 CL=31748
Diffstat (limited to 'src/pkg/go/doc/doc.go')
-rw-r--r--src/pkg/go/doc/doc.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pkg/go/doc/doc.go b/src/pkg/go/doc/doc.go
index 0e09a4d5d..860d6d54c 100644
--- a/src/pkg/go/doc/doc.go
+++ b/src/pkg/go/doc/doc.go
@@ -181,32 +181,32 @@ var (
)
-// AddProgram adds the AST for a source file to the DocReader.
+// AddFile adds the AST for a source file to the DocReader.
// Adding the same AST multiple times is a no-op.
//
-func (doc *DocReader) AddProgram(prog *ast.Program) {
+func (doc *DocReader) AddFile(src *ast.File) {
if bug_markers == nil {
bug_markers = makeRex("^/[/*][ \t]*BUG\\(.*\\):[ \t]*"); // BUG(uid):
bug_content = makeRex("[^ \n\r\t]+"); // at least one non-whitespace char
}
- if doc.name != prog.Name.Value {
+ if doc.name != src.Name.Value {
panic("package names don't match");
}
// add package documentation
// TODO(gri) what to do if there are multiple files?
- if prog.Doc != nil {
- doc.doc = prog.Doc
+ if src.Doc != nil {
+ doc.doc = src.Doc
}
// add all declarations
- for _, decl := range prog.Decls {
+ for _, decl := range src.Decls {
doc.addDecl(decl);
}
// collect BUG(...) comments
- for _, c := range prog.Comments {
+ for _, c := range src.Comments {
text := c.List[0].Text;
cstr := string(text);
if m := bug_markers.Execute(cstr); len(m) > 0 {