summaryrefslogtreecommitdiff
path: root/src/pkg/go
AgeCommit message (Collapse)AuthorFilesLines
2010-02-25go/printer, gofmt: correct indentation after certain /*-style commentsRobert Griesemer3-28/+45
- applied gofmt to src and misc Note: This fix improved formatting of src/pkg/math/all_test.go but leads to a degradation in src/pkg/exp/4s/xs.go. The latter happened to "work" before accidentally. Fixing the alignment in that case in general will be a separate CL. Fixes issue 628. R=rsc CC=golang-dev http://codereview.appspot.com/223054
2010-02-24go/scanner: support for complex (imaginary) constantsRobert Griesemer6-2/+106
R=rsc CC=golang-dev http://codereview.appspot.com/223044
2010-02-24go/ast: streamline representation of field listsRobert Griesemer8-74/+118
- 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-24gofmt: don't print ()'s around function-typed results (not needed anymore)Robert Griesemer3-9/+17
- add extra test cases to go/printer tests - apply gofmt to src and misc R=rsc CC=golang-dev http://codereview.appspot.com/223041
2010-02-24go/printer: use general comment intersperse mechanism everywhereRobert Griesemer5-69/+77
- remove several TODOs - as a side-effect, comment stylers are now used always and comments will be properly colored in godoc pkg documentation pages (and not only when looking at source text) R=rsc CC=golang-dev http://codereview.appspot.com/222041
2010-02-22go/printer (gofmt): remove more residue from semicolon transitionRobert Griesemer1-79/+14
minor unrelated cleanups R=rsc CC=golang-dev http://codereview.appspot.com/217086
2010-02-19go/ast: use a slice instead of a linked list for the list of commentsRobert Griesemer7-42/+38
(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 Griesemer4-40/+12
- 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-17gofmt: make sure certain 2-line comments are stableRobert Griesemer3-10/+205
under repeated application of gofmt R=agl, agl1 CC=golang-dev http://codereview.appspot.com/212046
2010-02-16go/scanner: comply with spec changes (do not allow NUL chars)Robert Griesemer2-16/+24
and complain about illegal UTF-8 code sequences R=rsc CC=golang-dev http://codereview.appspot.com/209043
2010-02-16remove assumption that all files belonging to a package are in the same ↵Robert Griesemer3-23/+42
directory: - adjust ast.Package node and doc.PackageDoc correspondingly - introduce parser.ParseFiles R=rsc CC=golang-dev http://codereview.appspot.com/207087
2010-02-16Don't print ()'s around a range clause's expression.Robert Griesemer3-1/+6
Fixes issue 605. R=rsc CC=golang-dev http://codereview.appspot.com/207108
2010-02-01update printer tests to use new syntaxRobert Griesemer9-590/+466
R=rsc CC=golang-dev http://codereview.appspot.com/198048
2010-02-02Change type of Printf's args to ... interface{}Rob Pike2-2/+2
R=rsc CC=golang-dev http://codereview.appspot.com/197043
2010-01-28support for ...T parameters (go/* packages)Robert Griesemer7-10/+64
R=rsc CC=golang-dev http://codereview.appspot.com/194126
2010-01-27go/parser: disable scoping code alwaysRuss Cox1-1/+4
Seems to be enabled spuriously during godoc (can't see why), producing errors like: parser.parseDir: src/pkg/http/server.go:159:16: 'Write' declared already at src/pkg/http/request.go:140:21 (and 4 more errors) R=r CC=golang-dev http://codereview.appspot.com/194119
2010-01-27More steps towards tracking of identifier scopes.Robert Griesemer6-57/+89
- 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-26Allow func() func().Robert Griesemer2-2/+2
Update gofmt test script. R=rsc CC=golang-dev http://codereview.appspot.com/195044
2010-01-26Bug in go/parser when coverting identifier lists.Robert Griesemer2-1/+2
Fixes issue 567. R=rsc CC=golang-dev http://codereview.appspot.com/195041
2010-01-25steps towards a simplified parser interfaceRobert Griesemer2-12/+30
minor cleanups (which I did at home before but missed this morning at work) R=rsc CC=golang-dev http://codereview.appspot.com/193095
2010-01-25A <- token in an expression may introduce a channel type.Robert Griesemer2-2/+17
Fixes issue 530. R=rsc CC=golang-dev http://codereview.appspot.com/193091
2010-01-25Scoping snapshot.Robert Griesemer2-74/+134
- separate parsing from declaration - setup of correct scopes R=rsc CC=golang-dev http://codereview.appspot.com/189098
2010-01-15Urgent parser/gofmt fix.Robert Griesemer1-1/+1
Wrong position information for identifier could lead to destructive reformatting of source via hg gofmt. R=rsc CC=golang-dev http://codereview.appspot.com/189100
2010-01-15 Steps towards tracking scopes for identifiers.Robert Griesemer8-135/+178
- 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-11Remove -oldprinter flag from gofmt; all code isRobert Griesemer9-721/+682
now printed using the semicolon-free style. Removed NoSemis flag and mechanism dealing with optional semicolons from go/printer. Updated all go/printer output files using the semi-colon free style. Changes have no formatting impact on checked in go code under src and misc. R=rsc, r CC=golang-dev http://codereview.appspot.com/184068
2010-01-11Partial work-around for gofmt bug.Robert Griesemer5-26/+109
Addresses some cases and respects position of closing parenthesis; but doesn't work yet in all cases. Heuristic; will need to be replaced by a real solution eventually. Does not cause existing code to be reformatted. R=r CC=golang-dev, rsc http://codereview.appspot.com/186043
2010-01-04Simplified parser interface.Robert Griesemer2-50/+27
R=rsc, r CC=golang-dev, rog http://codereview.appspot.com/183116
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-28simplify some code that is using vectorsRobert Griesemer1-37/+37
R=agl, agl1 CC=golang-dev http://codereview.appspot.com/181080
2009-12-18report an error for illegal octal numbers instead of treating them as floatsRobert Griesemer2-23/+95
added more test cases some capitalization cleanups R=rsc CC=golang-dev http://codereview.appspot.com/180085
2009-12-18removed semantic check from parsersRobert Griesemer1-3/+0
R=rsc CC=golang-dev http://codereview.appspot.com/179099
2009-12-16Don't ignore flags controlling the amount of source code parsedRobert Griesemer1-5/+5
in parser's ParsePkgFile and ParsePackage functions. R=rsc CC=golang-dev, rog http://codereview.appspot.com/180070
2009-12-15Fix for scanner bug (introduced with most recent change).Robert Griesemer2-2/+8
Fixes issue 433. R=rsc CC=golang-dev http://codereview.appspot.com/179072
2009-12-151) Change default gofmt default settings forRobert Griesemer16-2425/+2425
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-15fix TODO: insert semicolons before any sequence of commentsRobert Griesemer2-45/+72
that introduce the newline (important for correct placement of comments with gofmt when parsing new syntax) R=rsc http://codereview.appspot.com/179055
2009-12-14improved formatting of import declarations andRobert Griesemer6-7/+110
multi-line expressions with comments Fixes issue 414. R=rsc http://codereview.appspot.com/179047
2009-12-11Various cleanups:Robert Griesemer2-21/+16
- no need to replace comments for stand-alone blocks - always print string concatenations with interspersed "+" (remove option) - minor cleanups R=rsc http://codereview.appspot.com/174076
2009-12-11parser changed to reflect new semicolon rulesRobert Griesemer2-229/+167
R=rsc http://codereview.appspot.com/175046 Committer: Robert Griesemer <gri@golang.org>
2009-12-11fix printer test for new syntaxRobert Griesemer9-105/+277
R=rsc http://codereview.appspot.com/175048
2009-12-10implement NoSemis and NoStringConcat mode for go/printerRobert Griesemer2-5/+22
R=rsc http://codereview.appspot.com/174050
2009-12-10implemented InsertSemis mode for go/scannerRobert Griesemer2-20/+236
R=rsc http://codereview.appspot.com/175047
2009-12-09remove uses of string concatenation from src and misc directoryRobert Griesemer2-11/+10
R=rsc http://codereview.appspot.com/172041
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-12-03- include type-associated consts and vars when filtering a PackageDocRobert Griesemer1-7/+9
- fixes a godoc issue (for instance, "godoc os EOF" now shows an entry) R=r CC=rsc http://codereview.appspot.com/165042
2009-12-02move ReadFile, WriteFile, and ReadDir into a separate io/ioutil package.Rob Pike2-5/+6
this breaks the dependency of package io on package bytes. R=rsc CC=golang-dev http://codereview.appspot.com/163085
2009-12-02Add flag -tabindent to gofmt: forces use ofRobert Griesemer1-2/+11
tabs for indentation even if -spaces is set. Changes to gofmt: - added -tabindent flag - don't recompute parser and printer mode repeatedly Changes to go/printer: - provide new printing mode TabIndent Changes to tabwriter: - implement new mode TabIndent to use tabs independent of the actual padding character for leading empty columns - distinguish between minimal cell width and tab width (tabwidth is only used if the output contains tabs, minwidth and padding are always considered) - fixed and added more comments - some additional factoring By default, -tabindent is disabled and the default gofmt behavior is unchanged. By setting -spaces and -tabindent, gofmt will use tabs for indentation but do any other alignment with spaces. This permits a user to change the visible indentation by simply changing the editor's tab width and the code will remain properly aligned without the need to rerun gofmt. R=rsc http://codereview.appspot.com/163068
2009-11-29Correct expression level for argument lists.Robert Griesemer2-0/+3
Fixes issue 352. R=rsc http://codereview.appspot.com/161073
2009-11-24Handle presence of illegal semicolon after package clause better.Robert Griesemer1-0/+8
R=r, r1 http://codereview.appspot.com/157167
2009-11-24Change to container/vector interface:Robert Griesemer4-36/+27
- 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. Correia6-12/+12
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>