summaryrefslogtreecommitdiff
path: root/src/pkg/go/parser/parser.go
AgeCommit message (Collapse)AuthorFilesLines
2009-09-03add ParseDeclListRuss Cox1-0/+14
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 Cox1-9/+0
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-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-16ast:Robert Griesemer1-172/+80
- 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 Griesemer1-79/+14
- 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-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 Pike1-0/+1975
tests: all.bash passes, gobuild still works, godoc still works. R=rsc OCL=30096 CL=30102