Commit Graph

66 Commits

Author SHA1 Message Date
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
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
42ae5270d8 - handle field tags in pretty printer
R=r
OCL=18264
CL=18264
2008-10-31 14:27:34 -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
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
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
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
Robert Griesemer
6440c59e22 - removed need for lhs field in stat node
- as a result deleted some more code

R=r
OCL=17449
CL=17449
2008-10-20 10:01:34 -07:00
Robert Griesemer
52e9080d56 - simplified parsing of composite literals and slices by
treating ":" as lowest-level binary operator
- more precise error message for composites
- added flag -columns (false) - when set, prints precise error column
- a few more tests

R=r
OCL=17428
CL=17428
2008-10-18 20:20:30 -07:00
Robert Griesemer
e45eb60657 Added mechanism for very precise self-testing:
- in selftest mode (-t) interpret comments of the form /* ERROR */ and /* SYNC */
  and validate reported errors with the error markings in a file
- added initial selftest.go file

Also:
- fixed an issue with empty blocks
- generally report better error messages
- added many more tests to the test script (essentially all .go programs which
  have no syntax errors)

R=r
OCL=17426
CL=17426
2008-10-18 16:42:25 -07:00
Robert Griesemer
071e963e0e - fixed bug that wasn't caught by 6g (but by gccgo)
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=17380
CL=17380
2008-10-17 16:27:49 -07:00
Robert Griesemer
f39b518bcb - fixed a couple of corner cases (empty statements, empty composites)
- more robust printing in presence of errors
- fixed incorrect printing of function literals

R=r
OCL=17378
CL=17378
2008-10-17 16:19:31 -07:00
Robert Griesemer
61d9a3c3b0 - stronger syntax checks
- fixed a bug with non-eof terminated //-style comments
- collecting comments
- first experiments with reproducing comments
  (works but not very pretty, disabled for now)
- idempotent for all correct .go files we have checked in

R=r
OCL=17333
CL=17333
2008-10-16 23:30:42 -07:00
Robert Griesemer
c4f9f369a6 - added test script
- fixed a couple of printing bugs
status: parses, reproduces, and idempotently reproduces all correct .go files

R=r
OCL=17332
CL=17332
2008-10-16 19:24:33 -07:00
Robert Griesemer
bc641d1e9c - more robust TokenString implementation
R=r
OCL=17319
CL=17319
2008-10-16 15:28:36 -07:00
Robert Griesemer
3c9b817257 snapshot:
- typeguards, var decls, several printing bug fixed
- now fully idempotent on many files (which are accepted by 6g afterwards)
- still some detail issues

R=r
OCL=17310
CL=17310
2008-10-16 14:25:23 -07:00
Robert Griesemer
b705ac6cf5 - composites, receivers, various add. checks
R=r
OCL=17295
CL=17295
2008-10-16 12:16:50 -07:00
Robert Griesemer
a09b7fdd6c snapshot:
- fallthrough stat, label decls
- improved printing layout

R=r
OCL=17283
CL=17283
2008-10-16 10:16:59 -07:00
Robert Griesemer
237eea4ea5 - updated makefile for gccgo
R=r
OCL=17243
CL=17245
2008-10-15 17:13:00 -07:00
Robert Griesemer
6b49713df5 snapshot of pretty printer:
- almost there, receivers, labels, composites, comments are not yet printed
- runs through 18KLOC of Go code and prints it again

R=r
OCL=17237
CL=17237
2008-10-15 17:06:28 -07:00
Robert Griesemer
82fbbdfc7d snapshot
- fixed expression and statement printing
- missing: declarations, comments

R=r
OCL=17207
CL=17207
2008-10-15 11:48:18 -07:00
Robert Griesemer
7c3a2c47b0 - snapshot of pretty printer work
- accepts all Go code (use -s flag)
- complete rewrite of AST, AST building, and printing
  (as a result much more compact)
- printing severely screwed up at the moment, but should be
  fully working in 1 more day

R=r
DELTA=2118  (514 added, 980 deleted, 624 changed)
OCL=17161
CL=17161
2008-10-14 18:14:01 -07:00
Robert Griesemer
89319cfbf9 - implemented heuristic for composite literals starting with a type name:
if in a if, for, or switch header, must be parenthesized
- implemented string concatenation
- simplified a lot of code
- added many more tests: can now parse all *.go files I got my hands on
- printing output currently broken in some cases, use with -s (silent) option

R=r
OCL=16932
CL=16934
2008-10-10 16:03:32 -07:00
Robert Griesemer
583dac04e3 - more cleanups (simpler code for optional semi's, bug fixes)
R=r
OCL=16869
CL=16869
2008-10-09 18:03:16 -07:00
Robert Griesemer
638233a7d6 - don't allow empty decl lists (e.g. const ())
R=r
OCL=16698
CL=16698
2008-10-07 18:30:08 -07:00
Robert Griesemer
44dffd92fc - accept new semicolon syntax (at the moment,
the parser accepts a bit more then it should)

R=r
OCL=16694
CL=16694
2008-10-07 17:57:19 -07:00
Russ Cox
e6cd1e445b remove uses of *T as an implicit forward declaration of T
R=gri,r
OCL=16648
CL=16652
2008-10-07 12:59:54 -07:00
Robert Griesemer
4fb6064c11 - fixed Makefile, added more tests
- fixed parsing of parameter lists (sigh)

R=r
DELTA=48  (22 added, 7 deleted, 19 changed)
OCL=16319
CL=16321
2008-10-01 14:31:44 -07:00
Robert Griesemer
a6400dd448 more fine-tuning of ;'s
R=r
OCL=16274
CL=16274
2008-09-30 19:31:27 -07:00
Robert Griesemer
6349d38ebc - fixed semicolon handling in pretty printer
- some scanner cleanup
- new pretty-printed code can be compiled again (for some files)

R=r
OCL=16272
CL=16272
2008-09-30 18:50:29 -07:00
Robert Griesemer
bf855f5a94 - allow for embeded types in fields, and parameter lists w/o parameter names
- temporary work-around for 6g bug

R=r
OCL=16052
CL=16052
2008-09-27 17:42:18 -07:00