1
0
mirror of https://github.com/golang/go synced 2024-11-12 10:00:25 -07:00
Commit Graph

431 Commits

Author SHA1 Message Date
Robert Griesemer
a893db8767 gofmt (final resting place TBD):
- replacement for pretty; app to format a single .go file

printer.go (pkg/go/printer):
- replacement for astprinter.go; implements AST printing
- also replaces pkg/go/ast/format.go for now

cleanups:
- removed/saved away old code

R=r,rsc,iant
DELTA=2833  (1183 added, 1628 deleted, 22 changed)
OCL=30226
CL=30306
2009-06-15 16:23:16 -07:00
Rob Pike
d90e7cbac6 mv src/lib to src/pkg
tests: all.bash passes, gobuild still works, godoc still works.

R=rsc
OCL=30096
CL=30102
2009-06-09 09:53:44 -07:00
Robert Griesemer
bbc2c03852 - godoc periodic sync for Linux and Darwin
- support debug/sync (if automatic sync is enabled in the first place)
- removed debug/restart feature

R=rsc
DELTA=97  (37 added, 27 deleted, 33 changed)
OCL=30068
CL=30079
2009-06-08 18:09:33 -07:00
Robert Griesemer
80ca2afd08 issue http redirect when needed
R=rsc
DELTA=31  (6 added, 8 deleted, 17 changed)
OCL=30046
CL=30051
2009-06-08 11:49:29 -07:00
Robert Griesemer
b71598f704 set reasonable initial time stamp (instead of begin of epoch)
R=rsc
DELTA=1  (1 added, 0 deleted, 0 changed)
OCL=29970
CL=29973
2009-06-05 23:54:44 -07:00
Robert Griesemer
bd61c4e56e disable automatic p4 sync (new default)
TBR=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29969
CL=29969
2009-06-05 23:28:02 -07:00
Robert Griesemer
ebf38bf33f - cleanup: remove use of local ReadFile in favor of io.ReadFile
- don't show p4 sync output if -verbose is not set

R=rsc
DELTA=25  (5 added, 15 deleted, 5 changed)
OCL=29962
CL=29962
2009-06-05 17:55:55 -07:00
Robert Griesemer
42cf59a752 show remote addr instead of host in log lines
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29961
CL=29961
2009-06-05 17:08:22 -07:00
Robert Griesemer
8604e18093 - added goroutine to automatically p4 sync the current workspace
- set "Updated" timestamp on served pages to p4 sync time

R=rsc
DELTA=72  (66 added, 3 deleted, 3 changed)
OCL=29959
CL=29959
2009-06-05 16:48:20 -07:00
Russ Cox
6609d2f88d restructure makefiles, scripts to factor out O= logic.
remove a few hardcoded paths elsewhere too.

R=r,gri
DELTA=123  (44 added, 15 deleted, 64 changed)
OCL=29914
CL=29945
2009-06-05 10:59:55 -07:00
Robert Griesemer
aa9ce6148a change datafmt syntax to use '@' instead of '^' (to match
convention used in template.go)

R=rsc
DELTA=22  (3 added, 1 deleted, 18 changed)
OCL=29780
CL=29782
2009-06-02 18:03:47 -07:00
Robert Griesemer
8083467d62 - renamed format -> datafmt
- factored out datafmt-specifics from pretty to ast

R=rsc
DELTA=3580  (1810 added, 1763 deleted, 7 changed)
OCL=29770
CL=29774
2009-06-02 17:18:27 -07:00
Robert Griesemer
d7acfc75cd format package
R=r,rsc
DELTA=2871  (1712 added, 1118 deleted, 41 changed)
OCL=29222
CL=29704
2009-06-01 19:13:44 -07:00
Russ Cox
99128fc7ab move pretty/comment.go into go/doc.
extract comment text code out of go/doc/doc.go into comment.go.
no code changes, just rearrangement.

first step so i can write tests.

R=gri
DELTA=633  (318 added, 301 deleted, 14 changed)
OCL=29269
CL=29293
2009-05-22 21:42:16 -07:00
Robert Griesemer
7d4765e2d3 show subdirectories if present in a package dir
R=rsc
DELTA=184  (69 added, 73 deleted, 42 changed)
OCL=29178
CL=29253
2009-05-22 10:24:28 -07:00
Robert Griesemer
787dd4d3f3 semi-weekly snapshot:
- format.go implementation complete
- lots of documentation added (not quite complete)

TBR=r
OCL=29130
CL=29130
2009-05-20 17:09:59 -07:00
Robert Griesemer
500f6b8e84 fix typo
TBR=rsc
OCL=29010
CL=29010
2009-05-18 16:48:38 -07:00
Robert Griesemer
7ff2536633 - make godoc restart feature work properly
R=rsc
DELTA=11  (10 added, 0 deleted, 1 changed)
OCL=29007
CL=29009
2009-05-18 16:26:34 -07:00
Robert Griesemer
1ed725d7cd - changed parser to return os.Error, removed ErrorHandler
- added IsValid predicate to token.Position
- updated pretty, godoc, gobuild
- updated/expanded test cases

R=rsc
DELTA=265  (97 added, 78 deleted, 90 changed)
OCL=28961
CL=29005
2009-05-18 14:59:16 -07:00
Robert Griesemer
e8c1e2b93a get rid of unused files in my home dir
TBR=r
DELTA=9270  (0 added, 9270 deleted, 0 changed)
OCL=28958
CL=28958
2009-05-15 19:15:45 -07:00
Robert Griesemer
b7585a31b7 weekly snapshot:
format.go:
- better error handling, indentation, support for defaults,
  environments for custom formatters, cleanups (more functionality, less code)

pretty.go:
- better comment printing using format.go

made test script more robust

TBR=r
DELTA=622  (175 added, 305 deleted, 142 changed)
OCL=28956
CL=28956
2009-05-15 18:52:59 -07:00
Robert Griesemer
8ee8fdea3c restart functionality
R=rsc
DELTA=21  (19 added, 0 deleted, 2 changed)
OCL=28938
CL=28941
2009-05-15 15:45:35 -07:00
Robert Griesemer
05851636f3 godoc fix: relative paths were incorrect
R=r
DELTA=13  (1 added, 6 deleted, 6 changed)
OCL=28840
CL=28844
2009-05-14 14:59:51 -07:00
Robert Griesemer
f3b08744a2 Simplified AST:
- one node for array and slice types
- one node for index and slice expressions
- simplified parser, astprinter, and ast.txt

R=r
DELTA=71  (0 added, 43 deleted, 28 changed)
OCL=28768
CL=28768
2009-05-13 15:18:05 -07:00
David Symonds
6c384d2268 Allow http.Redirect to do both temporary (307) and permanent (301) redirects.
This also adds a missing 'return' when a malformed URL is passed to it.

R=rsc
APPROVED=rsc
DELTA=30  (13 added, 2 deleted, 15 changed)
OCL=28598
CL=28710
2009-05-12 15:41:19 -07:00
Robert Griesemer
c6da3e5a69 A couple of godoc improvements:
- sort directories before printing
- apply filtering to factory functions and methods
- remove a couple of unused files

R=r
DELTA=84  (34 added, 40 deleted, 10 changed)
OCL=28657
CL=28657
2009-05-11 16:52:59 -07:00
Robert Griesemer
5a11a46e2d weekly snapshot
- godoc updated to work w/new directory structure

TBR=r
OCL=28624
CL=28624
2009-05-11 09:47:53 -07:00
Russ Cox
917aa35f8f implications of stricter type equality:
if both types are named, they must be
the same type (arising from the same
declaration).

R=r,gri
DELTA=44  (21 added, 4 deleted, 19 changed)
OCL=28436
CL=28577
2009-05-08 15:40:14 -07:00
Russ Cox
918afd9491 move things out of sys into os and runtime
R=r
OCL=28569
CL=28573
2009-05-08 15:21:41 -07:00
Rob Pike
01712ae7d3 embeddability: change bufio.BufRead to bufio.Reader etc.
R=rsc
DELTA=112  (0 added, 4 deleted, 108 changed)
OCL=28537
CL=28543
2009-05-08 11:52:39 -07:00
Rob Pike
c8b47c6fce Name change to improve embeddability:
io.Read->io.Reader
	io.Write,Close,etc.->io.Writer,Closer etc.

R=rsc
DELTA=190  (0 added, 0 deleted, 190 changed)
OCL=28525
CL=28535
2009-05-08 11:22:57 -07:00
Russ Cox
63629d5307 minor cleanup, not required by compiler changes
R=r
DELTA=14  (1 added, 4 deleted, 9 changed)
OCL=28447
CL=28509
2009-05-08 10:14:55 -07:00
Robert Griesemer
d76f095750 semi-weekly snapshot:
- format-driven pretty printing now handles all of Go code
- better error handling

R=r
OCL=28370
CL=28372
2009-05-06 16:28:18 -07:00
Robert Griesemer
19c239c9af - remove wrong fix
(this corresponds to the currently running version of godoc)

R=r
DELTA=11  (0 added, 10 deleted, 1 changed)
OCL=28238
CL=28238
2009-05-04 15:04:32 -07:00
Robert Griesemer
0d6a5f417f weekly snapshot:
- template-driven ast printing now can successfully
  reproduce entire Go programs

next steps:
- fine-tuning of output
- print interspersed comments
- cleanup and testing against all Go programs
- replace astprinter

R=r
OCL=28181
CL=28181
2009-05-01 19:32:41 -07:00
Robert Griesemer
22301e8cea Some adjustments to godoc:
- work-around for incorrect import path
- added tmpl root in order to run against a goroot w/o templates
- clarifications

Daily snapshot of syntax-driven formatter. Some progress.

Updated gccgo Makefile.

TBR=r
OCL=28004
CL=28004
2009-04-28 19:11:37 -07:00
Robert Griesemer
bf53e16f6d - install doc in lib/go
- adjust dependent files

R=rsc
DELTA=1132  (567 added, 562 deleted, 3 changed)
OCL=27862
CL=27862
2009-04-25 17:01:41 -07:00
Robert Griesemer
9b6009b651 - minor formatting and capitalization (export) changes
TBR=rsc
OCL=27861
CL=27861
2009-04-25 16:52:30 -07:00
Robert Griesemer
af8036aa6b - renamed docprinter.go -> doc.go
- adjusted dependent files
  (no changes in doc.go)

TBR=rsc
OCL=27860
CL=27860
2009-04-25 16:48:00 -07:00
Robert Griesemer
f8ff3b1055 daily snapshot:
- more work on template-driven ast formatting
- added preliminary test suite
- added documentation

TBR=r
OCL=27858
CL=27858
2009-04-25 16:36:17 -07:00
Robert Griesemer
3aa892c4f9 daily snapshot:
- more work on template-driven ast printing

R=r
OCL=27851
CL=27851
2009-04-24 17:22:58 -07:00
Robert Griesemer
448a7b46a9 daily snapshot:
- minor bug fixes in pretty, godoc
- first cut at template-driven printing of ast

TBR=r
OCL=27825
CL=27825
2009-04-23 21:53:01 -07:00
Rob Pike
9d70646fcf allow godoc to match on regular expressions.
if the name contains a metacharacter, use regexp matching;
otherwise require strict equality.

now
	godoc flag '.*Var'
can give you all the FooVar functions.

R=gri
DELTA=19  (19 added, 0 deleted, 0 changed)
OCL=27711
CL=27713
2009-04-21 22:46:19 -07:00
Rob Pike
4b62e8d7ef fix template.
.or works in .repeated so remove the comment.
the bug was in the template: .section executes iff the field is non-empty.

R=gri
DELTA=13  (6 added, 7 deleted, 0 changed)
OCL=27710
CL=27712
2009-04-21 22:26:08 -07:00
Robert Griesemer
dc08ad4f37 remove lots of accumulated crud:
- delete utility files which contained functionality that is now elsewhere
  (or saved the files away for now)
- cleanup Makefile (remove unnecessary deps)
- minor adjustments to godoc, fixed a couple of bugs
- make pretty.go self-contained

TBR=r
DELTA=625  (81 added, 510 deleted, 34 changed)
OCL=27700
CL=27702
2009-04-21 18:37:48 -07:00
David Symonds
8e4b65d041 Move iterable package to usr/dsymonds/.
R=r
APPROVED=r
DELTA=598  (330 added, 266 deleted, 2 changed)
OCL=27627
CL=27649
2009-04-20 18:13:14 -07:00
Rob Pike
7e1cfa7432 Readn is a silly name when there's no n. Change to FullRead.
R=gri
DELTA=15  (0 added, 0 deleted, 15 changed)
OCL=27619
CL=27619
2009-04-19 21:02:29 -07:00
Rob Pike
aaf63f8d06 Step 1 of the Big Error Shift: make os.Error an interface and replace *os.Errors with os.Errors.
lib/template updated to use new setup; its clients also updated.

Step 2 will make os's error support internally much cleaner.

R=rsc
OCL=27586
CL=27586
2009-04-17 00:08:24 -07:00
Russ Cox
1f6463f823 Convert go tree to hierarchical pkg directory:
import (
		"vector" -> "container/vector"
		"ast" -> "go/ast"
		"sha1" -> "hash/sha1"
		etc.
	)

and update Makefiles.  Because I did the conversion
semi-automatically, I sorted all the import blocks
as a post-processing.  Some files have therefore
changed that didn't strictly need to.

Rename local packages to lower case.
The upper/lower distinction doesn't work on OS X
and complicates the "single-package directories
with the same package name as directory name"
heuristic used by gobuild and godoc to create
the correlation between source and binary locations.
Now that we have a plan to avoid globally unique
names, the upper/lower is unnecessary.

The renamings will cause trouble for a few users,
but so will the change in import paths.
This way, the two maintenance fixes are rolled into
one inconvenience.

R=r
OCL=27573
CL=27575
2009-04-16 20:52:37 -07:00
Russ Cox
60ce95d7a1 code changes for array conversion.
as a reminder, the old conversion
was that you could write

	var arr [10]byte;
	var slice []byte;
	slice = arr;

but now you have to write

	slice = &arr;

the change eliminates an implicit &, so that
the only implicit &s left are in the . operator
and in string(arr).

also, removed utf8.EncodeRuneToString
in favor of string(rune).

R=r
DELTA=83  (1 added, 23 deleted, 59 changed)
OCL=27531
CL=27534
2009-04-15 20:27:45 -07:00
Russ Cox
1605176e25 godoc: use data-driven templates for html, text generation
R=gri
DELTA=1341  (668 added, 282 deleted, 391 changed)
OCL=27485
CL=27526
2009-04-15 18:53:43 -07:00
Russ Cox
457b0030f7 godoc: supporting data
R=gri
DELTA=252  (240 added, 3 deleted, 9 changed)
OCL=27482
CL=27521
2009-04-15 18:38:37 -07:00
Rob Pike
ff12f2effd add (stub) parser to template code, enabling rewrite.
update pretty to use it.
change stdout to stderr in pretty.

R=rsc
DELTA=173  (52 added, 24 deleted, 97 changed)
OCL=27405
CL=27409
2009-04-14 00:06:49 -07:00
Russ Cox
3d0e4741eb godoc: switch to go library template system
R=gri
DELTA=272  (38 added, 139 deleted, 95 changed)
OCL=27372
CL=27390
2009-04-13 15:25:50 -07:00
Russ Cox
e97121a187 working checkpoint.
add comment describing new web server tree.
make room for command line interface.
use new path package to get rid of doubled slashes.
use new Chdir function to avoid goroot + everything.

implement new /pkg/ tree instead of using regexps.

R=gri
DELTA=267  (103 added, 72 deleted, 92 changed)
OCL=27150
CL=27367
2009-04-13 13:28:53 -07:00
Robert Griesemer
2a9f1ee215 Daily snapshot.
- godoc now supports the following url prefixes:
  /doc/ for package documentation
  /file/ for files (directories, html, and .go files)
  /spec for the spec
  /mem for the memory model
- formatting of comments has been fixed
- tons of minor cleanups (still more to do)

Still missing:
- pretty printing of source is not as pretty as it used to be
(still a relict from the massive AST cleanup which has't quite made it's way everywhere)
- documentation entries should be sorted
- comments in code is not printed or not properly printed

TBR=r
DELTA=416  (182 added, 100 deleted, 134 changed)
OCL=27078
CL=27078
2009-04-03 16:19:22 -07:00
Robert Griesemer
bfea141ca8 - don't show methods of non-exported types
(even if the methods are exported)

R=rsc
OCL=27056
CL=27056
2009-04-02 22:39:52 -07:00
Robert Griesemer
184c623e6b - renamed hasPostfix -> hasSuffix
- fixed printing of function literals (require separating ";")

R=rsc
OCL=27055
CL=27055
2009-04-02 22:24:52 -07:00
Robert Griesemer
91238c5bfe - moved functions before types in doc output (per rsc)
- use /src and /doc prefix in URL to distinguish output type (per rsc)
- fixed a bug in an internal string function
- ignore files ending in _test.go (consider them test files)

R=rsc
OCL=27054
CL=27054
2009-04-02 21:59:37 -07:00
Robert Griesemer
9ef3d8e2e7 Daily snapshot:
first round of cleanups:
- removed extra .html templates (reduced to one)
- removed dependencies on various local files
- minor fixes throughout

Basic docserver is now operational: Automatically finds all
(multi-file) packages under a root and serves either file
or package documentation.

R=r
OCL=27049
CL=27049
2009-04-02 18:25:18 -07:00
Robert Griesemer
695c90daa0 - adjustments for changed AST
- renamed gds -> godoc
- functionality to find and serve packages
  (to get a list of packages provide dir path + "?p")

Next steps: cleanups, better formatting, fine-tuning of output

R=r
OCL=27037
CL=27039
2009-04-02 15:58:58 -07:00
Robert Griesemer
2d543d0c14 Adjustements related to AST changes.
R=r
OCL=27026
CL=27028
2009-04-02 10:16:17 -07:00
Robert Griesemer
6d5bba5148 More gds functionality:
- package headers
- constants
- variables
- formatted comments

Next steps:
- sorted output
- collection of all files belonging to a package
- fine-tuning of output

R=r
OCL=26997
CL=26997
2009-04-01 15:00:22 -07:00
Russ Cox
a9c1a3b620 change smoketest from parser.go to astprinter.go,
the largest remaining source file in this directory.

TBR=gri
OCL=26984
CL=26984
2009-04-01 03:32:44 -07:00
Robert Griesemer
78f7063d9d - also associate factory methods to a type in documentation
R=r
OCL=26974
CL=26976
2009-03-31 18:46:21 -07:00
Robert Griesemer
8f628f4955 daily snapshot:
- adjustments to match new ast/parser interface
- removed printer.go; functionality now in astprinter.go and docprinter.go
  (more cleanups pending)
- enabled new doc printing in gds
  (lots of fine tuning missing, but pieces falling into place; e.g. methods
  associated with types. Consts, Vars, to come. Collection of all files
  belonging to a package to come)

R=r
OCL=26970
CL=26972
2009-03-31 16:53:58 -07:00
Robert Griesemer
3f42f44227 - incorporation of suggestions by rsc
R=rsc
OCL=26959
CL=26959
2009-03-31 13:28:01 -07:00
Robert Griesemer
8971cf2354 daily snapshot:
- separating printing of AST and documentation
- astprinter: will subsume ast printing functionality of printer
- docprinter: will subsume doc printing functionality of printer
        also: more logic to collect all the documentation pertaining
	      to all files of a package
- parser: some cleanups, stricter syntax checks
- gds: hooks to test new doc printer (disabled)

R=r
OCL=26915
CL=26915
2009-03-30 17:13:11 -07:00
Robert Griesemer
de9cf52835 - receiver syntax verification
- removed left-over panic() call
- fixed a couple of bugs

R=r
OCL=26856
CL=26856
2009-03-27 23:11:54 -07:00
Robert Griesemer
75a5d6cd2d Significant parser cleanup:
- commented public interface
- much better and very precise error messages
- much better tracing output
- many more checks (still permits more than just syntactically legal
  programs, but much more is checked that can be checked w/o semantic information)
- updated with respect to updated AST
- general cleanup throughout

Parser almost ready for move into lib/go.

R=r
OCL=26853
CL=26855
2009-03-27 19:27:09 -07:00
Robert Griesemer
34050ca8de - adjustments to match slightly changed scanner interface
- more comments on parser, various cleanups

TBR=r
OCL=26813
CL=26813
2009-03-26 22:16:06 -07:00
Robert Griesemer
b499da48a4 move AST into src/lib/go
R=r
DELTA=1509  (756 added, 751 deleted, 2 changed)
OCL=26799
CL=26801
2009-03-26 17:51:44 -07:00
Robert Griesemer
eeddc8e73b - adjustments to match new token/scanner/ast
R=r
OCL=26794
CL=26794
2009-03-26 16:10:07 -07:00
Robert Griesemer
5a72ca45fb - renamed scanner.Location to token.Position
- by moving Position into token, scanner dependencies
  are removed from several files
- clearer field names in token.Position, now possible to
  have a Pos() accessor w/o naming conflicts
- added Pos() accessor
- use anonymous token.Position field in AST nodes

R=r
DELTA=244  (28 added, 55 deleted, 161 changed)
OCL=26786
CL=26793
2009-03-26 16:08:44 -07:00
Robert Griesemer
cc8e4fb485 - introduce explicit Token type
- convert some functions into methods
- corresponding changes in pretty

R=r
DELTA=57  (3 added, 0 deleted, 54 changed)
OCL=26764
CL=26777
2009-03-26 10:53:14 -07:00
Robert Griesemer
ba620d5027 adjustments matching updated ast
R=r
OCL=26746
CL=26746
2009-03-25 12:45:06 -07:00
Robert Griesemer
bafd8c390a AST for Go programs
R=rsc,r
DELTA=309  (67 added, 51 deleted, 191 changed)
OCL=26611
CL=26745
2009-03-25 12:44:18 -07:00
Robert Griesemer
808341dd6e - completed AST cleanup
- implemented support for type switches

R=r
OCL=26608
CL=26608
2009-03-20 17:18:48 -07:00
Robert Griesemer
592dbb2d0a daily snapshot:
- first part of AST cleaned up and documented
- tons of related cleanups and adjustments

R=r
OCL=26430
CL=26430
2009-03-17 18:41:35 -07:00
Robert Griesemer
3cfd91f85b daily snapshot:
- use explicit expression lists instead of binary trees to represent lists of the form a, b, c
(per discussion w/ Russ)
- use explicit nodes for various language constructs for better readability
- various adjustments in parsing and printing

next steps:
- clean up AST fully so it can be checked in as library

R=r
OCL=26371
CL=26371
2009-03-16 20:29:31 -07:00
Robert Griesemer
ec77e75e5d daily snapshot:
- various parser fixes to match updated spec (&&, &^=, label decls, const decls)
- using html template for directory and error page in doc server
- show compile errors inplace in the source
- cleanups

R=rsc
OCL=26287
CL=26287
2009-03-13 16:59:51 -07:00
Robert Griesemer
e06a654ce1 daily snapshot:
- correctly associate comments with declarations
  (available through AST)
- very raw printing of interface
- much more functionality, now needs some formatting, sorting, etc.

R=r
OCL=26213
CL=26213
2009-03-12 17:24:03 -07:00
Russ Cox
4eb7ceba58 complain when trying to put T into an interface
if T has pointer methods.  this is just a heuristic
but it catches the problem robert ran into and
lets me put the larger interface issues aside for
now.  found one bug in pretty.

R=ken
OCL=26141
CL=26141
2009-03-11 16:06:17 -07:00
Robert Griesemer
40e204b9eb - update pretty sources to match new scanner interface
R=r
OCL=26129
CL=26131
2009-03-11 12:52:11 -07:00
Russ Cox
7a706fb3d7 Rename os.FD to os.File.
Make Fstat, Readdirnames, and Readdir methods
on os.File.

R=r
DELTA=281  (79 added, 3 deleted, 199 changed)
OCL=25891
CL=26130
2009-03-11 12:51:10 -07:00
Robert Griesemer
61815b8316 snapshot of today
(little progress with interface printing, but now shows a
list of exported function names)

R=r
OCL=26082
CL=26082
2009-03-10 18:20:08 -07:00
Robert Griesemer
47ba59ddb0 - adjustments due to changed tabwriter interface
- more comments in parser

R=r
OCL=26060
CL=26060
2009-03-10 16:31:19 -07:00
Robert Griesemer
6309076158 weekend snapshot
- fixed a minor bug
- some initial code to extract interface of a package

R=r
OCL=25866
CL=25866
2009-03-06 16:54:26 -08:00
Robert Griesemer
5e400ebf18 - wrote simple template substitution package
- use template in pretty printing now instead of hand-coded mechanism

R=r
OCL=25863
CL=25863
2009-03-06 16:11:40 -08:00
Robert Griesemer
42b49b1907 - using doc template for gds now
- no interface extraction yet

R=r
OCL=25808
CL=25808
2009-03-05 18:44:21 -08:00
Robert Griesemer
83af3229db Lots of cleanups in prep. for checking in parser and ast into lib:
- removed any symbol table stuff
- some interface cleanup
- removed lot's of dead wood
- half the support for type switches (simple form)
- name capitalization
Several rounds to come.

R=r
OCL=25797
CL=25797
2009-03-05 17:15:36 -08:00
Russ Cox
0793c88371 fix build
TBR=gri
OCL=25719
CL=25719
2009-03-04 17:37:47 -08:00
Robert Griesemer
b4802dd568 Created new directory lib/lang:
- move scanner to into lib/lang
- added test
- adjusted various make and build files

R=r
DELTA=1731  (973 added, 753 deleted, 5 changed)
OCL=25668
CL=25713
2009-03-04 17:13:12 -08:00
Robert Griesemer
77567265a8 Preparation for moving scanner into a lib:
- separated out token definition from scanner
- cleaned up token and scanner implementation
- added comments to exported interfaces

R=r
OCL=25665
CL=25665
2009-03-03 18:25:07 -08:00
Robert Griesemer
63b332eddd - allow ()'s and {}'s for now when parsing calls/composite literals
- require ()'s around composite literals at the if/for/switch control clause level
- fixed a nasty bug: passing a value instead of a pointer to a value to an interface
  variable - and not noticing that the value is copied

R=r
OCL=25649
CL=25649
2009-03-03 16:00:06 -08:00
Russ Cox
be2edb5761 Automated g4 rollback of changelist 25024,
plus significant hand editing.

Back to T{x} for composite literals.

R=r
OCL=25612
CL=25632
2009-03-03 08:39:12 -08:00
Robert Griesemer
d169268a1a scanner cleanup - getting it ready to as a library
- removed unneeded code that accumulated over time
- change src from string to []byte (perhaps should be io.Read
but that has some other disadvantages)
- simplified interface

R=r
OCL=25615
CL=25615
2009-03-02 20:27:09 -08:00
Robert Griesemer
fadf159a81 fix a bug: do not print a ';' after a label if there wasn't one
R=r
OCL=25526
CL=25528
2009-02-27 16:28:36 -08:00
Robert Griesemer
3689e221e8 Steps towards a general scanner/parser library for Go:
- converted more of AST and parser to use interfaces and explicit
structs for individual Go constructs (can be replaced now with
interface calls such that the parser becomes AST structure
independent, as suggested by rsc)
- added more tests (find all .go files under GOROOT)
- (temporarily) lost html links for identifiers when generating
html output
- TODO: lots of cleanups

R=r
OCL=25518
CL=25518
2009-02-27 15:40:17 -08:00
Robert Griesemer
6ddc48b84a - fixed a bug with //-comment parsing
R=r
OCL=25343
CL=25343
2009-02-23 17:16:55 -08:00
Robert Griesemer
4137f02bb7 - permit ()'s in types (TODO: update spec)
- accept embedded interfaces in interfaces
- missing: output incorrect, but at least all source code is accepted again

R=r
OCL=25223
CL=25223
2009-02-19 16:47:58 -08:00
Robert Griesemer
18ed7e690a - accept new composite literal syntax
- remove all parsing heuristics
- as a result, accept a wider syntax, but parser is simpler

R=r
OCL=25029
CL=25029
2009-02-13 16:27:53 -08:00
Robert Griesemer
127526649f - vector package (identical to array except for names)
- updated some file (but not all - left array package in place for now)

R=rsc
DELTA=530  (483 added, 0 deleted, 47 changed)
OCL=25025
CL=25025
2009-02-13 15:07:56 -08:00
Russ Cox
9f8f2e6130 convert composite literals from { } to ( ).
only non-trivial changes are in
	convlit1.go
	golden.out

R=gri
OCL=25019
CL=25024
2009-02-13 14:48:32 -08:00
Robert Griesemer
8e7873672e - fixed bugs related to the empty statement
(now in sync with the spec and with 6g)
- fixed incorrect logging statement in gds

R=r
OCL=24970
CL=24970
2009-02-12 16:06:21 -08:00
Russ Cox
49e2087848 insert type assertions when narrowing.
R=r
OCL=24349
CL=24913
2009-02-11 17:55:16 -08:00
Robert Griesemer
e08cc15251 Some real GDS functionality:
- directory listings w/ working links
- some links working in source code (most don't do the right thing yet)
- use of logging

R=r
OCL=24728
CL=24728
2009-02-09 21:05:14 -08:00
Robert Griesemer
9acd2a9731 snapshot:
- first stab at a Go Documentation Server (gds)
- various fixes to make initial version of gds work

R=r
OCL=24588
CL=24588
2009-02-06 15:26:30 -08:00
Robert Griesemer
187cf78a7c - preparation for setting up types
- moved Object, Type, Scope  out of AST into symboltable
  - moved universe into symboltable
  - removed dead code
- fixed dependency computation (pretty -d filename.go)
- lots of cleanups
- removed tocken channel connection between parser and scanner
  (was cute, but not really needed)

R=r
OCL=24545
CL=24545
2009-02-06 11:10:25 -08:00
Robert Griesemer
89fc8465a8 - caseify parser functions (all but a few should not be exported)
- more elegant tracing code
- removed some dead code, cleanups

R=r
OCL=24452
CL=24452
2009-02-05 14:22:09 -08:00
Robert Griesemer
5d571cc67e snapshot:
- ast statements now use interfaces
- deleted old (now unused) code

R=r
OCL=24422
CL=24422
2009-02-05 11:05:02 -08:00
Robert Griesemer
1595a1947c today's snapshot: steps towards using interfaces for statements in ast
R=r
OCL=24380
CL=24380
2009-02-04 18:28:41 -08:00
Robert Griesemer
c048ee21ad - converted expr representation of ast into a new representation
using interfaces properly => much cleaner code
- converted tracing code to use 'defer' statement
- next steps: convert rest of ast as well

R=r
OCL=24277
CL=24277
2009-02-03 17:44:01 -08:00
Robert Griesemer
b67603dfef - added experimental flag '-def': will print (not parse!)
'def' instead of 'func', 'const', or 'type'

R=r
OCL=24092
CL=24094
2009-02-02 11:51:07 -08:00
Robert Griesemer
6dd93bbfbc - changed pretty parser to parse and print new function type syntax
- added more test cases
- fixed a bug in test script which prevented errors to show up...

R=r
OCL=23832
CL=23974
2009-01-30 15:31:04 -08:00
Robert Griesemer
699721a0ea - removed obsolete files from repository
(most of this has been integrated into pretty,
the rest has been archived).

R=r
OCL=23842
CL=23842
2009-01-29 17:00:18 -08:00
Robert Griesemer
eecce5f130 - make test work with 6g
R=r
OCL=23821
CL=23823
2009-01-29 15:16:22 -08:00
Robert Griesemer
3d4d5ad04c defer statement
R=r
OCL=23542
CL=23542
2009-01-26 17:48:27 -08:00
Robert Griesemer
88da39feea - snapshot before making larger change
R=r
OCL=23403
CL=23403
2009-01-23 13:50:14 -08:00
Robert Griesemer
9e3b0f444a snapshot before making more changes:
- fine-tuning of ast
- more accurate block pos info (improved printing in some cases)
- collecting local variables and fields
- more work on type checking
- lots of minor tweaks

R=r
OCL=23375
CL=23375
2009-01-23 09:44:01 -08:00
Robert Griesemer
96c20204a7 - updated pretty (removed "export")
R=r
OCL=23134
CL=23134
2009-01-20 15:22:33 -08:00
Russ Cox
839a68469b delete export
TBR=r
OCL=23121
CL=23127
2009-01-20 14:40:40 -08:00
Robert Griesemer
626d25065d casify struct fields
R=r
OCL=22998
CL=22998
2009-01-16 15:31:34 -08:00
Russ Cox
360962420c casify, cleanup sys
R=r
OCL=22978
CL=22984
2009-01-16 14:58:14 -08:00
Robert Griesemer
2527bba993 casify pretty
R=r
OCL=22899
CL=22899
2009-01-15 17:16:41 -08:00
Robert Griesemer
2ab55776b5 - fixed untab.go to compile again
R=r
OCL=22871
CL=22871
2009-01-15 15:14:19 -08:00
Robert Griesemer
aa1264472e - added mechanism to detect capitalization issues
Use: pretty -naming files

R=r
OCL=22859
CL=22859
2009-01-15 14:19:35 -08:00
Rob Pike
61f3302044 printf->Printf etc.
the raw fmt routines will be another, smaller but subtler pass.

R=rsc
DELTA=157  (0 added, 0 deleted, 157 changed)
OCL=22851
CL=22851
2009-01-15 13:48:11 -08:00
Robert Griesemer
a0c709bef8 - use new letter definition for pretty
- fixed a bug with error column reporting in the presence of utf-8 chars
- fixed an assertion failure

R=r
OCL=22762
CL=22762
2009-01-14 15:19:34 -08:00
Russ Cox
8b8ff164b3 delete playpen copy of malloc
R=r
DELTA=905  (0 added, 905 deleted, 0 changed)
OCL=22663
CL=22690
2009-01-13 16:32:40 -08:00
Robert Griesemer
ba556a8818 - removed an unnecessary field from AST.Expr nodes
R=r
OCL=22601
CL=22601
2009-01-12 17:44:10 -08:00
Robert Griesemer
0a0ee89f8b - remove obsolete files (missed before)
R=r
OCL=22475
CL=22475
2009-01-09 16:30:00 -08:00
Robert Griesemer
c620dd9759 - preparation to add type info to ast
- consolidation of files, cleanup
- more success producing idempotent output for some files with comments
  containing tabs
- snapshot of the day

R=r
OCL=22474
CL=22474
2009-01-09 16:28:09 -08:00
Rob Pike
c45d2a767c simplify flag interface. no more BVal etc. you just get a pointer.
fixed everything except the tutorial.

R=rsc
DELTA=404  (94 added, 139 deleted, 171 changed)
OCL=22414
CL=22422
2009-01-09 13:42:46 -08:00
Robert Griesemer
d54abad06f - first (global) idents with proper links to declarations in html output
(e.g. pretty -html source.go > source.html; then look at the html.file in a browser)

R=r
OCL=22331
CL=22331
2009-01-08 14:43:56 -08:00
Robert Griesemer
4dc3d74a36 - fixed a bug with building right-recursive trees iteratively
- moving scope handling into parser (simpler)
- snapshot of work today so far

R=r
OCL=22301
CL=22301
2009-01-08 12:04:00 -08:00
Robert Griesemer
cb13c4d552 - more steps towards tracking idents in scopes
- snapshot of today

R=r
OCL=22247
CL=22247
2009-01-07 16:54:03 -08:00
Robert Griesemer
a3ddf4cfd1 - enabling tracking of declarations
- removed dead code
- snapshot before making a lareger structural change

R=r
OCL=22226
CL=22226
2009-01-07 13:58:56 -08:00
Robert Griesemer
5bd3c3b755 - support for [...] parsing and pretty printing
R=r
OCL=22185
CL=22185
2009-01-06 17:39:25 -08:00
Robert Griesemer
af065a0c77 - make code in gosrc compile again, check in all pending changes
(this code doesn't match the existing language at this point,
  but it's a large code base which compiles - will eventually go
  away)
- enable compilation of it again in run.bash

R=r
DELTA=1147  (534 added, 311 deleted, 302 changed)
OCL=22176
CL=22176
2009-01-06 16:26:45 -08:00
Robert Griesemer
e286260686 - fix parse heuristic: make(x) must accept a type for x
R=r
OCL=22171
CL=22171
2009-01-06 15:30:26 -08:00
Robert Griesemer
9662e7b2db - adjusted pretty to use old new, make
R=r
OCL=22160
CL=22160
2009-01-06 15:01:04 -08:00
Robert Griesemer
215eb7eb7f - steps towards augmenting ast with declaration info
(will help produce html output where we can click on identifiers and
  get to the declaration)
- snapshot before changing back to old new

R=r
OCL=22159
CL=22159
2009-01-06 14:54:18 -08:00
Ian Lance Taylor
4f3506b4ee Update for source code changes.
R=gri
DELTA=15  (13 added, 1 deleted, 1 changed)
OCL=21632
CL=21639
2008-12-19 14:32:00 -08:00
Russ Cox
08ca30bbfa change *map to map; *chan to chan; new(T) to new(*T)
fix bugs left over from *[] to [] conversion.

TBR=r
OCL=21576
CL=21581
2008-12-19 03:05:37 -08:00
Robert Griesemer
e9741e7dbd fix syntax error (syntax accepted by 6g, but not by pretty printer)
R=r
OCL=21385
CL=21385
2008-12-16 18:08:16 -08:00
Robert Griesemer
003f0ad6af - added missing file
R=r
OCL=21384
CL=21384
2008-12-16 18:03:18 -08:00
Robert Griesemer
b86359073e Snapshot.
Preparations to track identifiers and declarations so that we can
generate good html links as pretty printer output:
- brought over old code and adjusted it
- initial hookups, nothing really running yet

R=r
OCL=21383
CL=21383
2008-12-16 18:02:22 -08:00
Robert Griesemer
c9859e7bc6 - support for range clauses
R=r
OCL=21030
CL=21030
2008-12-11 17:45:45 -08:00
Robert Griesemer
4873bb217c Snapshot:
- fixed html tag generation
- simplified html escaping machinery
  (not 100% correct for strings yet)
- can now produce the first mostly correct formatted html pages from source
  with (fake) links: e.g. pretty -html srcfile.go > srcfile.html
  R=r

OCL=20915
CL=20915
2008-12-10 13:51:19 -08:00