1
0
mirror of https://github.com/golang/go synced 2024-10-04 06:31:22 -06:00
Commit Graph

375 Commits

Author SHA1 Message Date
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
Robert Griesemer
4ad804679d - snapshot if current state
- fix pretty printer to work with new tabwriter interface

R=r
OCL=20854
CL=20854
2008-12-09 15:29:15 -08:00
Russ Cox
3f8aa662e9 add support for ref counts to memory allocator.
mark and sweep, stop the world garbage collector
(intermediate step in the way to ref counting).
can run pretty with an explicit gc after each file.

R=r
DELTA=502  (346 added, 143 deleted, 13 changed)
OCL=20630
CL=20635
2008-12-05 15:24:18 -08:00
Russ Cox
c1868bc89d malloc fixes.
can run peano 10 in 100 MB (instead of 1+ GB) of memory
when linking against this.
can run peano 11 in 1 GB of memory now.

R=r
DELTA=100  (44 added, 44 deleted, 12 changed)
OCL=20504
CL=20553
2008-12-04 21:04:26 -08:00
Robert Griesemer
77aaf4f3a2 - adjusted const decl grammar to reflect spec changes
- first cut at html writer (will do html escaping, html tag production)
- first cut at generating basic html output via pretty
- some cleanups

R=r
OCL=20550
CL=20550
2008-12-04 18:18:41 -08:00
Robert Griesemer
2dba9a66e2 - fixed a bug with import printing (missing separator between alias and string)
- rewrote declaration printing - was unreadable before
- no semicolons after closing "}" for types

R=r
OCL=20379
CL=20379
2008-12-03 15:47:30 -08:00
Robert Griesemer
acfd1fd443 - oversight: extra allow source-level line breaks inside statement lists
- fixed printing of empty structs/interfaces
- enable two more tests

R=r
OCL=20296
CL=20296
2008-12-02 17:01:31 -08:00
Robert Griesemer
cb67a8324b - fine-tuning of white space
- by default consider extra newlines in src for better formatting
- additional flags for control (-newlines, -maxnewlines, -optsemicolons)
- don't print ()'s around single anonymous result types

Status: Comparing the output of pretty with the input for larger files
shows mostly whitespace/formatting differences, which is what is desired.

TODO:
- Handling of overlong lines
- some esoteric cases which look funny

R=r
OCL=20293
CL=20293
2008-12-02 16:49:44 -08:00
Ian Lance Taylor
748287d49e The flag and fmt libraries are now available from gccgo by
default.  Fix PRETTY_OBJS to include compilation.o rather than
compilation.go.

R=gri
DELTA=10  (0 added, 8 deleted, 2 changed)
OCL=20248
CL=20257
2008-12-02 12:52:47 -08:00
Robert Griesemer
37bdd3c3f5 - enabled comment printing by default
- changed tab width to 8 chars by default to make test run properly
- excluded 4 files that are not idempotently printed
- fixed a couple of incorrect file position recordings in parser
- fine-tuned layout engine
- white-space formatting reasonable, but not perfect
- no handling of overlong lines
R=r

To use with smaller tabs:           pretty -tabwidth=4 file.go
To use with blanks instead of tabs: pretty -usetabs=0 file.go

OCL=20184
CL=20184
2008-12-01 17:20:59 -08:00
Robert Griesemer
8bbd873c34 - better comment formatting, starting to look good
- comment printing still disabled by default because idempotency test fails
- whitespace control better but not perfect yet
- snapshot before making some heuristics changes

R=r
OCL=20151
CL=20151
2008-12-01 14:03:20 -08:00
Robert Griesemer
d79f687ed8 - collect addition source position information in parser
for end of declarations, blocks, parameter lists, etc.
- use extra src positions to more accurately print comments
- fine-tuned low-level printing routine for comments
- added better debugging support

Status:
- comments now appear at the right place (inbetween the right tokens)
- newline control needs improvement (not very hard)
- comment printing disabled for now because pretty is not idempotent
with it; to enable: -comments

R=r
OCL=20079
CL=20079
2008-11-26 17:07:45 -08:00
Robert Griesemer
732b53a1fe - snapshot of state before trying yet another, hopefully better working
way to integrate comments into the generated output
- various simplificatins and cleanups throughout

R=r
OCL=20062
CL=20062
2008-11-26 13:23:26 -08:00
Robert Griesemer
b1297aa04f - move error handling out of scanner
- use more of the existing library code

R=r
OCL=19957
CL=19959
2008-11-24 18:24:21 -08:00
Robert Griesemer
130e6f42f1 - implemented arbitrary padding char for tabwriter
- implemented right-to-left alignment (numerical results)
- better comments and error handling
- added more tests
- updated dependent files

R=r
DELTA=232  (175 added, 11 deleted, 46 changed)
OCL=19761
CL=19780
2008-11-21 09:35:49 -08:00
Robert Griesemer
01b44bbfc8 - move tabwriter into library
- added preliminary tests (more to do)
- renamed type from TabWriter -> Writer
- adjusted my code where necessary

R=r
DELTA=825  (474 added, 346 deleted, 5 changed)
OCL=19744
CL=19753
2008-11-20 17:39:41 -08:00
Robert Griesemer
0998eaf4a1 - correct error handling throughout
- documentation, cleanups
- more options

R=r
OCL=19736
CL=19736
2008-11-20 16:26:43 -08:00
Robert Griesemer
fcdcf33a71 - array-ify code, remove local implementation
R=r
OCL=19648
CL=19651
2008-11-19 16:49:50 -08:00
Robert Griesemer
34533f06eb - support for alignment via tabs instead of blanks
- exclude a test due to syntax errors

R=r
OCL=19563
CL=19565
2008-11-18 19:25:43 -08:00
Robert Griesemer
127c65b400 - untab app (snapshot - not quite complete)
R=r
OCL=19558
CL=19558
2008-11-18 18:44:17 -08:00
Robert Griesemer
654bc2badc - factored out tabwriter a separate writer filter
(to be moved into std lib eventually)
- rewrote tabwriter to use byte buffers instead of strings
  (byte buffers to be moved into stdlib eventually)
- support for recent syntax changes
- no space printed after function name and before function parameters
- comments still disabled due to a known bug

R=r
OCL=19430
CL=19430
2008-11-17 19:58:52 -08:00
Russ Cox
75647d2024 First pieces of malloc.
R=r
DELTA=756  (754 added, 0 deleted, 2 changed)
OCL=19266
CL=19378
2008-11-17 12:32:35 -08:00
Robert Griesemer
22e0e1b049 - better comment classification
- related cleanups

R=r
OCL=19227
CL=19227
2008-11-13 19:06:57 -08:00
Robert Griesemer
3c2f0ae132 * pretty printing snapshot: towards printing comments nicely
- implemented elastic tabstops algorithm, now correct and documented
- first cut at printing comments (use -comments flag, disabled for now)
- struct field types are now aligned (using elastic tab stops)
- needs more fine-tuning

* fixed a bug in test script
* added quick smoke test to makefile and invoke it in run.bash
  instead of the full test

R=r
OCL=19220
CL=19220
2008-11-13 17:50:46 -08:00
Robert Griesemer
2a58e7d7a0 more work on elastic tabs:
- new code enabled, but no comments printed yet (so the effect
  of the elastic tabs is not seen yet)

TBR=r
DELTA=200  (93 added, 69 deleted, 38 changed)
OCL=18951
CL=18951
2008-11-10 17:56:46 -08:00
Robert Griesemer
a3b4a3c29d - steps towards "flexible tab stops" simulation in pretty
printing output
- not yet enabled

R=r
OCL=18842
CL=18842
2008-11-07 18:30:58 -08:00
Robert Griesemer
b3c983f3a0 - fixed typo in parser.go
- re-enabled bug118.go for pretty

R=r
OCL=18604
CL=18604
2008-11-05 16:05:36 -08:00
Robert Griesemer
11a3f759fd - temporarily excluding bug118.go, causing pretty trouble
R=r
OCL=18602
CL=18602
2008-11-05 15:55:51 -08:00
Robert Griesemer
17596948e3 get rid of bignum leftovers
R=r
OCL=18475
CL=18475
2008-11-04 14:08:47 -08:00
Robert Griesemer
e2eccf3bd0 install bignum as library
R=r
DELTA=3501  (1752 added, 1749 deleted, 0 changed)
OCL=18460
CL=18471
2008-11-04 13:55:18 -08:00
Robert Griesemer
e2fe2f3f23 - better support for string conversions
- removed trailing tabs

R=r
OCL=18458
CL=18458
2008-11-04 11:37:19 -08:00
Robert Griesemer
7cd11c1c09 - completed integer support (some logical functions missing)
- completed rational support
- better documentation
- more tests
- cleanups

R=r
OCL=18438
CL=18438
2008-11-04 09:33:15 -08:00
Robert Griesemer
78b0013a07 - changed general div/mod implementation to a faster algorithm
(operates on 30bit values at a time instead of 20bit values)
- refactored and cleaned up lots of code
- more tests
- close to check-in as complete library

R=r
OCL=18326
CL=18326
2008-11-03 09:21:10 -08:00
Robert Griesemer
db27d309d1 - gcd, exponentiation, population count
- more rational numbers stuff
- more tests

R=r
OCL=18295
CL=18295
2008-10-31 16:58:56 -07:00
Robert Griesemer
42ae5270d8 - handle field tags in pretty printer
R=r
OCL=18264
CL=18264
2008-10-31 14:27:34 -07:00
Robert Griesemer
00dc6e9678 - fixed another test (arithmetic vs. logic shift bug)
R=r
OCL=18235
CL=18237
2008-10-31 10:52:59 -07:00
Robert Griesemer
afad827255 - div and mod (arbitrary precision)
- more tests
- some global renames

R=r
OCL=18219
CL=18219
2008-10-30 23:37:34 -07:00
Robert Griesemer
7112dc1db7 - implemented Shr
- removed shift work-arounds (6g code appears to work now)
- made similar routines more regular in structure
- more tests

R=r
OCL=18102
CL=18102
2008-10-29 22:05:42 -07:00
Robert Griesemer
276ffd297d - added shl operation, extra tests
- fixed code so it works with any base between 9 and 64
- work-around for 6g shift problems in various places

R=r
OCL=18080
CL=18080
2008-10-29 16:48:53 -07:00
Robert Griesemer
0ed4576c6a - update test.sh (caused an error since src/pkg dir is empty now)
R=r
OCL=17987
CL=17987
2008-10-28 20:20:55 -07:00
Robert Griesemer
379b5a3921 - steps towards implementation of div and mod
- string conversion in different bases
- tracked down a 6g bug, use work-around for now

R=r
OCL=17981
CL=17981
2008-10-28 18:42:26 -07:00
Robert Griesemer
1daad03545 - bug fixes, cleanups
- integer string conversion

R=r
OCL=17923
CL=17923
2008-10-27 17:57:31 -07:00
Robert Griesemer
2e777b44b8 - created staging area for getting bignum package up-to-speed again,
now using up-to-date language features
- moved old code away from pkg (defunct anyway because of language changes)

R=r
OCL=17916
CL=17916
2008-10-27 15:44:32 -07:00
Robert Griesemer
eba73552d2 - added simple facility to print Makefile dependency rules given a Go source file
(e.g.: pretty -d pretty.go will print the Makefile dep. rules of the involved
  Go files that are not part of the installed library)
- minor fix in pretty printer (tested against ken's test files)

R=r
OCL=17872
CL=17872
2008-10-26 21:32:30 -07:00
Ken Thompson
b379d54dea another step toward interface subtypes
put explicit ./ on some runtime tests

R=r
OCL=17839
CL=17839
2008-10-24 20:14:28 -07:00
Robert Griesemer
63ed2b710b - missing file
R=r
OCL=17813
CL=17813
2008-10-24 14:08:01 -07:00
Robert Griesemer
cec64a2dd5 - some factoring of scan/parse phase so we can attach other functionality
easily (for instance import dependency extraction)
- support for new "..." syntax
- minor cleanup

R=r
OCL=17811
CL=17811
2008-10-24 14:04:54 -07:00
Robert Griesemer
816c1cefff - expanded parsing heuristics to deal with new(T, ...)
- fixed an issue with select
- added all bugs and fixedbugs tests that are syntactically correct to the test suite
- minor cosmetic changes

R=r
OCL=17759
CL=17759
2008-10-23 17:56:54 -07:00
Rob Pike
5d30161ca7 move reflection code into final place.
this is just a branch.
next cl will update and add to build

R=rsc
DELTA=4528  (2264 added, 2264 deleted, 0 changed)
OCL=17670
CL=17672
2008-10-22 17:12:07 -07:00
Rob Pike
34b8873722 Reflection values.
R=rsc
DELTA=206  (79 added, 25 deleted, 102 changed)
OCL=17652
CL=17669
2008-10-22 16:48:17 -07:00
Rob Pike
0061e56196 Add names to types to avoid recursive explosion and to get
the right answer when a type name redefines an existing type.

R=rsc
DELTA=133  (53 added, 8 deleted, 72 changed)
OCL=17637
CL=17639
2008-10-22 13:02:43 -07:00
Robert Griesemer
79985fa569 - exclude newfn.go from tests - cannot be parsed syntactically alone
in general

R=rsc
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=17624
CL=17624
2008-10-22 11:27:18 -07:00
Rob Pike
fac3dfe638 More reflection code.
Beginnings of values.
typestrings are grabbed from the environment.

R=rsc
APPROVED=rsc
DELTA=1046  (952 added, 3 deleted, 91 changed)
OCL=17593
CL=17621
2008-10-22 11:02:56 -07:00
Robert Griesemer
71d6cda6b2 - remove inconsistent directory from tests
R=rsc
DELTA=1  (0 added, 1 deleted, 0 changed)
OCL=17514
CL=17514
2008-10-20 17:37:48 -07:00
Robert Griesemer
baac04b518 enable tests that verify that pretty-printed code can be compiled with 6g again
R=r
OCL=17510
CL=17510
2008-10-20 17:13:02 -07:00
Robert Griesemer
9d20c85ae9 - fixed missing parens in some cases of unary expressions
- added validation test verifying that pretty output compiles with 6g again (disabled at the moment)
- replaced another recursive function with an interative solution

R=r
OCL=17505
CL=17505
2008-10-20 16:44:03 -07:00
Robert Griesemer
5d0e5a7867 - use stringtorune library function for faster rune scanning
- converted 2 right-recursive parsing functions into iterative versions
- renamed node.go -> ast.go (clearer)

R=r
OCL=17496
CL=17498
2008-10-20 15:03:40 -07:00