• Robert Griesemer's avatar
    Intersperse comments nicely when printing an AST. · 2210a643
    Robert Griesemer authored
    gofmt formatted source code looks pretty good already;
    with a bit more fine-tuning it should be great.
    
    printer.go:
    - Implemented comment intersperse algorithm.
      The approach is a result of many trial-and-error
      experiments but at this point reasonably simple
      and open to arbitrary fine-tuning.
    
    parser.go:
    - Simplified handling of lead and line comments
      (formerly called leading and trailing comments).
    - Use a comments list instead of an array (I may
      change this back - this is not obviously better
      and uses more space).
    
    doc.go:
    - Remove comments from AST nodes that have been
      'consumed' in the documentation to avoid duplicate
      printing of them. Allows for better control of
      what is printed w/o use of printing control flags
      (which are hard to use and not fine-grained enough).
    
    Corresponding adjustments to various clients of these
    files.
    
    R=rsc
    DELTA=478  (275 added, 108 deleted, 95 changed)
    OCL=32185
    CL=32380
    2210a643
test.sh 2.82 KB