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

43 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Robert Griesemer
2527bba993 casify pretty
R=r
OCL=22899
CL=22899
2009-01-15 17:16:41 -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
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
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
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
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
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
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
fcdcf33a71 - array-ify code, remove local implementation
R=r
OCL=19648
CL=19651
2008-11-19 16:49:50 -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
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
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
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
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
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
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
c51195386e snapshot: more pretty printer stuff
R=r
OCL=15863
CL=15863
2008-09-25 11:50:34 -07:00
Robert Griesemer
c5a29a6dd4 - more ast buidling and printing
- almost complete language reproduced

R=r
OCL=15801
CL=15801
2008-09-24 15:50:28 -07:00
Robert Griesemer
83267dce11 - added initial formatting: indentation
- more AST nodes built and printed

R=r
OCL=15735
CL=15735
2008-09-23 18:34:17 -07:00
Robert Griesemer
09bed25621 - snapshot of pretty printer status
- parts of AST built and printed
- no formatting yet

R=r
OCL=15727
CL=15727
2008-09-23 16:40:12 -07:00
Robert Griesemer
b390608636 - added gccgo makefile
R=r
OCL=15693
CL=15695
2008-09-23 11:17:44 -07:00
Robert Griesemer
c13c03c261 - first cut at building and printing AST
R=r
OCL=15675
CL=15675
2008-09-22 18:26:12 -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