summaryrefslogtreecommitdiff
path: root/src/pkg/go/ast
AgeCommit message (Collapse)AuthorFilesLines
2011-04-28Imported Upstream version 2011.04.27upstream/2011.04.27Ondřej Surý2-3/+3
2011-04-26Imported Upstream version 2011.04.13upstream/2011.04.13Ondřej Surý8-260/+443
2011-04-20Imported Upstream version 2011.03.07.1upstream/2011.03.07.1Ondřej Surý2-4/+2
2011-02-14Imported Upstream version 2011-02-01.1upstream/2011-02-01.1Ondřej Surý2-10/+20
2011-01-17Imported Upstream version 2011.01.12upstream/2011.01.12Ondřej Surý6-372/+1011
2010-04-15go/ast: Update comment to mention imaginary literalsEvan Shaw1-1/+1
R=gri CC=golang-dev http://codereview.appspot.com/846050 Committer: Robert Griesemer <gri@golang.org>
2010-04-15"godoc -src pkg_name" excludes duplicates entriesAndrei Vieru1-9/+15
$ godoc xml | grep Copy\(\) func (c CharData) Copy() CharData func (c Comment) Copy() Comment func (d Directive) Copy() Directive func (p ProcInst) Copy() ProcInst func (e StartElement) Copy() StartElement -------------------------------------------- $ godoc -src xml | grep Copy\(\) func (c CharData) Copy() CharData -------------------------------------------- $ godoc -src xml Copy func (c CharData) Copy() CharData { return CharData(makeCopy(c)) } -------------------------------------------- The command "godoc -src pkg_name" should output the interface of the named package, but it excludes all duplicate entries. Also the command "godoc -src pkg_name method_name" will output the source code only for one method even if there are more of them with the same name in the same package. This patch set fixes this issue. R=gri CC=golang-dev http://codereview.appspot.com/883051 Committer: Robert Griesemer <gri@golang.org>
2010-03-30single argument panicRuss Cox1-1/+1
note that sortmain.go has been run through hg gofmt; only the formatting of the day initializers changed. i'm happy to revert that formatting if you'd prefer. stop on error in doc/progs/run R=r CC=golang-dev http://codereview.appspot.com/850041
2010-03-29go/ast: generalized ast filteringRobert Griesemer2-26/+129
R=rsc CC=golang-dev http://codereview.appspot.com/788041
2010-03-16gofmt: more consistent formatting of const/var declsRobert Griesemer1-5/+5
- gofmt -w src misc - only manually modified file: src/pkg/go/printer/nodes.go R=rsc CC=golang-dev, r http://codereview.appspot.com/606041
2010-03-16godoc: initial support for showing popup informationRobert Griesemer1-0/+13
for identifiers in Go source code - at the moment just show identifier kind (var, func, etc.) and name (eventually should show declaration, type, etc.) - JavaScript parts by adg R=rsc CC=adg, golang-dev http://codereview.appspot.com/578042
2010-03-11ast/filter.go: missing nil-check causes crashRobert Griesemer1-1/+1
R=rsc CC=golang-dev http://codereview.appspot.com/461041
2010-03-11godoc: fix formatting of -src outputRobert Griesemer1-9/+99
- go/filter.go: make MergePackageFiles smarter - go/printer.go: handle positions from multiple files R=rsc CC=golang-dev http://codereview.appspot.com/460042
2010-02-25use []byte("abc") in place of []byte{'a', 'b', 'c'}Russ Cox1-1/+1
R=gri CC=golang-dev http://codereview.appspot.com/223059
2010-02-24go/ast: streamline representation of field listsRobert Griesemer3-26/+55
- always include position information about opening/closing parens/braces - replace uses of []*ast.Field with *ast.FieldList Fixes issue 473. R=rsc CC=golang-dev http://codereview.appspot.com/223043
2010-02-19go/ast: use a slice instead of a linked list for the list of commentsRobert Griesemer3-21/+14
(this will simplify some further changes) removed several TODOs R=rsc CC=golang-dev http://codereview.appspot.com/216059
2010-02-19- removed exp/parser (support for old semicolon syntax)Robert Griesemer2-27/+5
- go/ast: removed StringList (not needed anymore) - go/ast: changed import path and field list tag to a single string - updated all dependencies R=rsc CC=golang-dev http://codereview.appspot.com/217056
2010-02-16remove assumption that all files belonging to a package are in the same ↵Robert Griesemer1-2/+1
directory: - adjust ast.Package node and doc.PackageDoc correspondingly - introduce parser.ParseFiles R=rsc CC=golang-dev http://codereview.appspot.com/207087
2010-01-28support for ...T parameters (go/* packages)Robert Griesemer1-1/+2
R=rsc CC=golang-dev http://codereview.appspot.com/194126
2010-01-27More steps towards tracking of identifier scopes.Robert Griesemer2-13/+13
- provide scope to parse functions; if non-nil, parser uses the scope to declare and lookup identifiers - resolve forward references where possible R=rsc CC=golang-dev http://codereview.appspot.com/194098
2010-01-25Scoping snapshot.Robert Griesemer1-1/+1
- separate parsing from declaration - setup of correct scopes R=rsc CC=golang-dev http://codereview.appspot.com/189098
2010-01-15 Steps towards tracking scopes for identifiers.Robert Griesemer3-74/+81
- Identifiers refer now to the language entity (Object) that they denote. At the moment this is at best an approximation. - Initial data structures for language entities (Objects) and expression types (Type) independent of the actual type notations. - Initial support for declaring and looking up identifiers. - Updated various dependent files and added support functions. - Extensively tested to avoid breakage. This is an AST change. R=rsc CC=golang-dev, rog http://codereview.appspot.com/189080
2010-01-04Allow a nil Ident to print without crashing.Roger Peppe2-6/+14
Allow Walk of []Decl R=gri CC=golang-dev, rsc http://codereview.appspot.com/183112 Committer: Robert Griesemer <gri@golang.org>
2009-12-151) Change default gofmt default settings forRobert Griesemer4-504/+504
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 3rd set of files. R=rsc CC=golang-dev http://codereview.appspot.com/180048
2009-12-07the AST walker currently provides no way to find out how theRoger Peppe1-54/+55
nodes in the tree are nested with respect to one another. a simple change to the Visitor interface makes it possible to do this (for example to maintain a current node-depth, or a knowledge of the name of the current function). Visit(nil) is called at the end of a node's children; this make possible the channel-based interface below, amongst other possibilities. It is still just as simple to get the original behaviour - just return the same Visitor from Visit. Here are a couple of possible Visitor types. // closure-based type FVisitor func(n interface{}) FVisitor func (f FVisitor) Visit(n interface{}) Visitor { return f(n); } // channel-based type CVisitor chan Visit; type Visit struct { node interface{}; reply chan CVisitor; }; func (v CVisitor) Visit(n interface{}) Visitor { if n == nil { close(v); } else { reply := make(chan CVisitor); v <- Visit{n, reply}; r := <-reply; if r == nil { return nil; } return r; } return nil; } R=gri CC=rsc http://codereview.appspot.com/166047 Committer: Robert Griesemer <gri@golang.org>
2009-11-23go: makes it build for the case $GOROOT has whitespacesSergio Luis O. B. Correia1-2/+2
the bash scripts and makefiles for building go didn't take into account the fact $GOROOT / $GOBIN could both be directories containing whitespaces, and was not possible to build it in such a situation. this commit adjusts the various makefiles/scripts to make it aware of that possibility, and now it builds successfully when using a path with whitespaces as well. Fixes issue 115. R=rsc, dsymonds1 http://codereview.appspot.com/157067 Committer: Russ Cox <rsc@golang.org>
2009-11-19Permit omission of hi bound in slices.Robert Griesemer2-2/+14
R=r, rsc http://codereview.appspot.com/157082
2009-11-09 - replaced gofmt expression formatting algorithm withRobert Griesemer2-3/+3
rsc's algorithm - applied gofmt -w misc src - partial CL (remaining files in other CLs) R=rsc, r http://go/go-review/1026036
2009-11-09remove semis after statements in one-statement statement listsRobert Griesemer4-51/+51
R=rsc, r http://go/go-review/1025029
2009-11-06- fine-tuning of one-line func heuristic (nodes.go)Robert Griesemer2-159/+70
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006
2009-11-04gofmt-ify src/pkg/go (excluding printer directory due to pending CL,Robert Griesemer2-73/+122
and parser.go and scanner_test.go which have minor formatting issues) R=rsc http://go/go-review/1016042
2009-11-04- respect source line breaks in grouped declarationsRobert Griesemer1-0/+18
- made ast.Spec nodes implement Node interface - added extra test cases R=rsc http://go/go-review/1016038
2009-11-03Note: This is an exact replica and replacement of CL 1018027Robert Griesemer1-0/+18
(which I uploaded at home and thus can't upload from here). CL 1018027 was reviewed. - added comments to scope.go - commented out some code that is not yet needed (and which showed up prominently in the documentation) R=rsc http://go/go-review/1017017
2009-11-03- don't loose extra line breaks in struct/interface declarationsRobert Griesemer1-0/+8
- start new sections if a field/method declaration spans multiple lines; this avoids tabs from the previous line affecting the next field/method R=rsc http://go/go-review/1017015
2009-10-26- gofmt-ify walk.goRobert Griesemer1-44/+67
- fixed several bugs R=rsc http://go/go-review/1015015
2009-10-22minor changes to walkRobert Griesemer1-59/+52
R=rsc http://go/go-review/1012008
2009-10-22simple AST walking supportRobert Griesemer2-0/+310
R=rsc http://go/go-review/1014006
2009-10-08more lgtm files from gofmtRuss Cox1-2/+2
R=gri OCL=35485 CL=35488
2009-10-06apply gofmt to go, gob, hash, http, image, io, json, logRuss Cox2-244/+275
R=gri DELTA=1359 (138 added, 32 deleted, 1189 changed) OCL=35408 CL=35420
2009-09-17unused importsRuss Cox1-3/+0
R=r OCL=34731 CL=34731
2009-09-17- don't add "..." anonymous field to structs/interfaces if entries are strippedRobert Griesemer2-33/+16
- don't print any optional semicolons after declarations inside functions - indicate non-exported fields/methods in exported types with a comment so that the "exported source" is legal Go code - more tests R=rsc DELTA=300 (227 added, 25 deleted, 48 changed) OCL=34697 CL=34730
2009-09-15go/printer:Robert Griesemer3-30/+90
- printing of expressions: put spaces only where "needed" - printing of import statements: no double indentation if there are no renames - print labels on separate lines - added extra test files go/ast: - unified basic literal nodes and as a result deleted duplicated code - added initial code to track scopes (not fully used yet) replaces CL 34553 R=rsc DELTA=881 (579 added, 223 deleted, 79 changed) OCL=34623 CL=34651
2009-09-15more "declared and not used".Russ Cox1-1/+1
the last round omitted := range and only checked 1 out of N vars in a multi-var := R=r OCL=34624 CL=34638
2009-08-27Cleanups:Robert Griesemer1-158/+79
- remove visitor pattern interface (not used) - added non-exported "branding" methods to enforce node hierarchy R=rsc DELTA=174 (13 added, 92 deleted, 69 changed) OCL=33838 CL=33963
2009-08-12delete forward type declarationsRuss Cox1-25/+11
R=r DELTA=163 (1 added, 149 deleted, 13 changed) OCL=33106 CL=33111
2009-08-12convert non-low-level non-google pkg codeRuss Cox2-65/+5
to whole-package compilation. R=r OCL=33070 CL=33101
2009-08-10remove unnecessary pkg. referencesRuss Cox2-3/+3
R=r DELTA=95 (0 added, 0 deleted, 95 changed) OCL=33012 CL=33012
2009-08-06- allow more general type switch syntaxRobert Griesemer1-2/+2
- support for reverse printing of AST (for compiler testing) - added -reverse flag to gofmt R=rsc DELTA=163 (125 added, 11 deleted, 27 changed) OCL=32808 CL=32853
2009-07-30go/ast/filter.go:Robert Griesemer1-22/+37
- more orthogonal functionality of filter functions for better re-use go/doc/doc.go: - simplified interface - collect filenames of packages so that they can be shown godoc: - removed TODO, show list of package (linked) files used to create documentation R=rsc DELTA=130 (68 added, 24 deleted, 38 changed) OCL=32549 CL=32552
2009-07-29parser:Robert Griesemer1-24/+55
- Changed filter function for parser.ParsePackage to take an *os.Dir instead of a filename for more powerful filters - Removed TODO in ast.PackageInterface: Now collect package comments from all package files - Cleanups in godoc: Use the new ParsePackage and PackageInterface functions; as a result computing package information is much simpler now. R=rsc DELTA=285 (80 added, 110 deleted, 95 changed) OCL=32473 CL=32486