summaryrefslogtreecommitdiff
path: root/src/pkg/go/ast/ast.go
AgeCommit message (Collapse)AuthorFilesLines
2011-09-13Imported Upstream version 60upstream/60Ondřej Surý1-0/+914
2011-09-13Imported Upstream version 60Ondřej Surý1-956/+0
2011-06-30Imported Upstream version 58upstream/58Ondřej Surý1-12/+12
2011-04-28Imported Upstream version 2011.04.27upstream/2011.04.27Ondřej Surý1-2/+2
2011-04-26Imported Upstream version 2011.04.13upstream/2011.04.13Ondřej Surý1-35/+23
2011-04-20Imported Upstream version 2011.03.07.1upstream/2011.03.07.1Ondřej Surý1-1/+1
2011-02-14Imported Upstream version 2011-02-01.1upstream/2011-02-01.1Ondřej Surý1-5/+14
2011-01-17Imported Upstream version 2011.01.12upstream/2011.01.12Ondřej Surý1-171/+391
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-03-29go/ast: generalized ast filteringRobert Griesemer1-0/+2
R=rsc CC=golang-dev http://codereview.appspot.com/788041
2010-02-24go/ast: streamline representation of field listsRobert Griesemer1-14/+34
- 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 Griesemer1-6/+9
(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 Griesemer1-16/+3
- 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 Griesemer1-0/+1
- 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-15 Steps towards tracking scopes for identifiers.Robert Griesemer1-7/+25
- 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 Peppe1-2/+7
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 Griesemer1-360/+360
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-11-19Permit omission of hi bound in slices.Robert Griesemer1-2/+10
R=r, rsc http://codereview.appspot.com/157082
2009-11-09 - replaced gofmt expression formatting algorithm withRobert Griesemer1-1/+1
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 Griesemer1-2/+2
R=rsc, r http://go/go-review/1025029
2009-11-06- fine-tuning of one-line func heuristic (nodes.go)Robert Griesemer1-156/+69
- 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 Griesemer1-69/+118
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-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-06apply gofmt to go, gob, hash, http, image, io, json, logRuss Cox1-233/+264
R=gri DELTA=1359 (138 added, 32 deleted, 1189 changed) OCL=35408 CL=35420
2009-09-17- don't add "..." anonymous field to structs/interfaces if entries are strippedRobert Griesemer1-4/+6
- 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 Griesemer1-30/+10
- 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-10remove unnecessary pkg. referencesRuss Cox1-2/+2
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-28Intersperse comments nicely when printing an AST.Robert Griesemer1-7/+7
gofmt formatted source code looks pretty good already; with a bit more fine-tuning it should be great. printer.go: - Implemented comment intersperse algorithm. The approach is a result of many trial-and-error experiments but at this point reasonably simple and open to arbitrary fine-tuning. parser.go: - Simplified handling of lead and line comments (formerly called leading and trailing comments). - Use a comments list instead of an array (I may change this back - this is not obviously better and uses more space). doc.go: - Remove comments from AST nodes that have been 'consumed' in the documentation to avoid duplicate printing of them. Allows for better control of what is printed w/o use of printing control flags (which are hard to use and not fine-grained enough). Corresponding adjustments to various clients of these files. R=rsc DELTA=478 (275 added, 108 deleted, 95 changed) OCL=32185 CL=32380
2009-07-16ast:Robert Griesemer1-5/+14
- 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
2009-07-09Show BUG comments in godoc:Robert Griesemer1-16/+18
ast.go: - rename Comments -> CommentGroup (less confusion) - change all comments/docs to be *CommentGroup filter.go: - do not remove unassociated comments from program as part of export filtering (they are needed by doc.go for BUG comments) scanner.go: - exclude '\n' from //-style comments parser.go: - rewrote collection of comments: now all collected comments are *ast.CommentGroups - clarified distinction between leading and trailing comments - fixed a bug in comment collection (parseGenDecl); corresponding test case is in printer/testdata - extra documentation doc.go: - collect BUG comments - corresponding fix for parser bug in comment collection comment.go: - simplified regex printer.go: - adjust comment printing to new representation printer_test.go, testdata/*: - enable printing of doc comments - extended tests package.html, package.txt: - added Bugs section gofmt: - enable printing of doc comments R=rsc DELTA=339 (126 added, 38 deleted, 175 changed) OCL=31403 CL=31416
2009-06-15Support for line comments trailing a field or declaration:Robert Griesemer1-3/+7
- ast: added extra fields - parser: extended comment parsing to capture potential trailing comments Cleanups: - parser: more documentation, changed various identifiers from _-style to camelCase R=r,rsc DELTA=214 (84 added, 13 deleted, 117 changed) OCL=30259 CL=30299
2009-06-09mv src/lib to src/pkgRob Pike1-0/+772
tests: all.bash passes, gobuild still works, godoc still works. R=rsc OCL=30096 CL=30102