summaryrefslogtreecommitdiff
path: root/src/pkg/go/parser
AgeCommit message (Collapse)AuthorFilesLines
2009-11-24Change to container/vector interface:Robert Griesemer1-19/+18
- removed New(len int) in favor of new(Vector).Resize(len, cap) - removed Init(len int) in favor of Resize(len, cap) - runs all.bash Fixes issue 294. R=rsc, r, r1 http://codereview.appspot.com/157143
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 Griesemer1-7/+13
R=r, rsc http://codereview.appspot.com/157082
2009-11-09 - replaced gofmt expression formatting algorithm withRobert Griesemer2-11/+11
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 Griesemer3-211/+211
R=rsc, r http://go/go-review/1025029
2009-11-08assorted cleanupRuss Cox1-8/+4
R=r, iant CC=go-dev http://go/go-review/1025024
2009-11-06- fine-tuning of one-line func heuristic (nodes.go)Robert Griesemer2-9/+3
- 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-05gofmt the last outstanding files in src/pkgRobert Griesemer1-73/+91
- added a list of issues to printer/nodes.go R=rsc http://go/go-review/1024002
2009-11-04gofmt-ify src/pkg/go (excluding printer directory due to pending CL,Robert Griesemer1-8/+8
and parser.go and scanner_test.go which have minor formatting issues) R=rsc http://go/go-review/1016042
2009-11-02- collect line comments for methods in interfacesRobert Griesemer1-9/+8
(previously not shown in godoc) - simplify parsing of struct types (match code structure for parsing interface types) R=rsc, r http://go/go-review/1016019
2009-11-01reverse the arguments to io.Copy so the destination is on theRob Pike1-1/+1
left, like an assignment, like strcpy, etc. R=rsc CC=go-dev http://go/go-review/1016011
2009-10-15close file after useRobert Griesemer1-0/+1
R=rsc DELTA=1 (1 added, 0 deleted, 0 changed) OCL=35778 CL=35780
2009-10-06apply gofmt to go, gob, hash, http, image, io, json, logRuss Cox2-16/+16
R=gri DELTA=1359 (138 added, 32 deleted, 1189 changed) OCL=35408 CL=35420
2009-10-02- allow parenthesized [...]T types as in: ([...]int){}Robert Griesemer1-14/+16
- added extra tests R=rsc DELTA=55 (37 added, 0 deleted, 18 changed) OCL=35250 CL=35276
2009-09-28permit only one method name per method signature in interface typesRobert Griesemer1-11/+8
(in sync with spec CL 35047) R=rsc DELTA=44 (4 added, 8 deleted, 32 changed) OCL=35048 CL=35054
2009-09-17unused importsRuss Cox3-7/+0
R=r OCL=34731 CL=34731
2009-09-17- don't add "..." anonymous field to structs/interfaces if entries are strippedRobert Griesemer1-2/+2
- 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-16rename bytes.Buffer.Data() to bytes.Buffer.Bytes()Rob Pike1-2/+2
R=rsc DELTA=152 (6 added, 0 deleted, 146 changed) OCL=34695 CL=34701
2009-09-15bug fix: allow function types as operandsRobert Griesemer1-4/+9
R=rsc DELTA=10 (5 added, 0 deleted, 5 changed) OCL=34662 CL=34666
2009-09-15go/printer:Robert Griesemer1-39/+83
- 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 Cox3-5/+5
the last round omitted := range and only checked 1 out of N vars in a multi-var := R=r OCL=34624 CL=34638
2009-09-03add ParseDeclListRuss Cox2-0/+34
R=austin DELTA=34 (34 added, 0 deleted, 0 changed) OCL=34280 CL=34352
2009-09-03parse expression statements beginning withRuss Cox1-1/+1
arithmetic unary operators + - ^ R=r DELTA=1 (0 added, 0 deleted, 1 changed) OCL=34338 CL=34350
2009-08-27Cleanups:Robert Griesemer1-1/+1
- 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-14- do not accept forward-declarations for structs and interfaces anymoreRobert Griesemer1-45/+31
R=r DELTA=49 (0 added, 14 deleted, 35 changed) OCL=33272 CL=33272
2009-08-12convert non-low-level non-google pkg codeRuss Cox4-73/+5
to whole-package compilation. R=r OCL=33070 CL=33101
2009-08-06- allow more general type switch syntaxRobert Griesemer1-18/+48
- 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-29parser:Robert Griesemer2-12/+18
- 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
2009-07-28Intersperse comments nicely when printing an AST.Robert Griesemer1-79/+38
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-24If we can't parse the package, call Fatalf so that the testIan Lance Taylor1-1/+1
fails without crashing. R=gri DELTA=1 (0 added, 0 deleted, 1 changed) OCL=32164 CL=32171
2009-07-16ast:Robert Griesemer4-185/+311
- 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-14- interface and comments cleanupRobert Griesemer1-28/+26
R=rsc DELTA=33 (1 added, 3 deleted, 29 changed) OCL=31620 CL=31642
2009-07-14- adjust to new scanner interface (pass filename to Init)Robert Griesemer2-82/+17
- delete error handling code which is not needed anymore R=rsc DELTA=83 (0 added, 65 deleted, 18 changed) OCL=31572 CL=31602
2009-07-10fix error messagesRobert Griesemer1-2/+2
R=rsc DELTA=2 (0 added, 0 deleted, 2 changed) OCL=31449 CL=31451
2009-07-09Show BUG comments in godoc:Robert Griesemer1-101/+100
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-07-07Add entry points for parsing statements and expressions.Austin Clements1-20/+68
R=gri APPROVED=gri DELTA=73 (48 added, 0 deleted, 25 changed) OCL=31302 CL=31308
2009-07-07- ast.FilterExports: filter non-exported anonymous fieldsRobert Griesemer1-1/+1
- fixed typo in parser.go - removed test w/ syntax errors from gofmt test script R=rsc DELTA=25 (21 added, 0 deleted, 4 changed) OCL=31296 CL=31298
2009-07-02- store trailing comments after top-level declarations in astRobert Griesemer1-41/+79
- remove a test case w/ syntax errors from test suite R=rsc DELTA=104 (44 added, 5 deleted, 55 changed) OCL=31078 CL=31085
2009-06-29io.StringBytes -> strings.BytesRuss Cox1-5/+7
io.ByteBuffer -> bytes.Buffer left io.ByteBuffer stub around for now, for protocol compiler. R=r OCL=30861 CL=30872
2009-06-15fixed typo (slipped in with previous submit)Robert Griesemer1-1/+1
TBR=rsc OCL=30300 CL=30300
2009-06-15Support for line comments trailing a field or declaration:Robert Griesemer1-119/+186
- 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-12removed bogus if-statementRobert Griesemer1-3/+0
R=iant DELTA=3 (0 added, 3 deleted, 0 changed) OCL=30251 CL=30251
2009-06-10- parser bug: return keyword may be followed by case or default keyword as wellRobert Griesemer1-2/+2
- fixed unrelated typo R=rsc DELTA=2 (0 added, 0 deleted, 2 changed) OCL=30175 CL=30175
2009-06-09mv src/lib to src/pkgRob Pike3-0/+2103
tests: all.bash passes, gobuild still works, godoc still works. R=rsc OCL=30096 CL=30102