Commit Graph

25 Commits

Author SHA1 Message Date
Robert Griesemer
2527bba993 casify pretty
R=r
OCL=22899
CL=22899
2009-01-15 17:16:41 -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
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
Robert Griesemer
9662e7b2db - adjusted pretty to use old new, make
R=r
OCL=22160
CL=22160
2009-01-06 15:01:04 -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
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
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
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
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
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
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
bc641d1e9c - more robust TokenString implementation
R=r
OCL=17319
CL=17319
2008-10-16 15:28:36 -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
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
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
3548350d3e Snapshot.
Added support for function literals, composite literals.
Bug fixes.

R=r
OCL=15911
CL=15911
2008-09-25 17:20:39 -07:00
Robert Griesemer
8415280699 - more missing constructs added
- removed excessive ";"'s
- no ()'s around expressions where not needed
- parser.go now reproduced and parseable again

R=r
OCL=15881
CL=15881
2008-09-25 15:14:26 -07:00
Robert Griesemer
a1ee6804dd - fixed bug which prevented parser.go from compiling
(typo in ptr decl lead to an unresolved forward declaration)
- fixed parser bugs
- fixed Makefile
- now successfully parses most code

Issues:
- composite literals (cannot be identified easily from syntax alone)
- new(T, ...) (cannot be identified easily from syntax alone since
  new is not a keyword and thus could be a different function then
  the allocation function at which point "new((x + y))" is legal,
  but the inner "(x" looks like the beginning of a function type)

R=r
OCL=15515
CL=15515
2008-09-18 22:53:54 -07:00
Robert Griesemer
81d7c51837 First cut at a Go pretty printer:
- code scavenged from Go-in-Go front-end (will merge back)
- using "symbol-table" free parsing to build AST
- no printing yet

R=r
OCL=15504
CL=15504
2008-09-18 16:58:37 -07:00