diff options
| author | Ondřej Surý <ondrej@sury.org> | 2012-06-14 13:23:46 +0200 | 
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2012-06-14 13:23:46 +0200 | 
| commit | 917c5fb8ec48e22459d77e3849e6d388f93d3260 (patch) | |
| tree | 9c23734a6ffd4d2a8ac99502eda3cc812a8b130b /src/pkg/go/ast/ast.go | |
| parent | 0003ee229fd33ff46cb5f2fe1e35f5c0284debc4 (diff) | |
| download | golang-917c5fb8ec48e22459d77e3849e6d388f93d3260.tar.gz | |
Imported Upstream version 1.0.2upstream/1.0.2
Diffstat (limited to 'src/pkg/go/ast/ast.go')
| -rw-r--r-- | src/pkg/go/ast/ast.go | 14 | 
1 files changed, 8 insertions, 6 deletions
| diff --git a/src/pkg/go/ast/ast.go b/src/pkg/go/ast/ast.go index 7123fe58f..d2e75dc1c 100644 --- a/src/pkg/go/ast/ast.go +++ b/src/pkg/go/ast/ast.go @@ -87,8 +87,12 @@ func stripTrailingWhitespace(s string) string {  	return s[0:i]  } -// Text returns the text of the comment, -// with the comment markers - //, /*, and */ - removed. +// Text returns the text of the comment. +// Comment markers (//, /*, and */), the first space of a line comment, and +// leading and trailing empty lines are removed. Multiple empty lines are +// reduced to one, and trailing space on lines is trimmed. Unless the result +// is empty, it is newline-terminated. +//  func (g *CommentGroup) Text() string {  	if g == nil {  		return "" @@ -104,11 +108,9 @@ func (g *CommentGroup) Text() string {  		// The parser has given us exactly the comment text.  		switch c[1] {  		case '/': -			//-style comment +			//-style comment (no newline at the end)  			c = c[2:] -			// Remove leading space after //, if there is one. -			// TODO(gri) This appears to be necessary in isolated -			//           cases (bignum.RatFromString) - why? +			// strip first space - required for Example tests  			if len(c) > 0 && c[0] == ' ' {  				c = c[1:]  			} | 
