Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Delta Between Two Patch Sets: src/pkg/go/printer/printer.go

Issue 3050041: code review 3050041: go/ast: use token.Pos instead of token.Position; adjus... (Closed)
Left Patch Set: code review 3050041: adjust code to use new token.Pos position encoding Created 14 years, 4 months ago
Right Patch Set: code review 3050041: go/ast: use token.Pos instead of token.Position; adjus... Created 14 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/go/printer/nodes.go ('k') | src/pkg/go/printer/printer_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // The printer package implements printing of AST nodes. 5 // The printer package implements printing of AST nodes.
6 package printer 6 package printer
7 7
8 import ( 8 import (
9 "bytes" 9 "bytes"
10 "fmt" 10 "fmt"
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 // A Config node controls the output of Fprint. 1021 // A Config node controls the output of Fprint.
1022 type Config struct { 1022 type Config struct {
1023 Mode uint // default: 0 1023 Mode uint // default: 0
1024 Tabwidth int // default: 8 1024 Tabwidth int // default: 8
1025 Styler Styler // default: nil 1025 Styler Styler // default: nil
1026 } 1026 }
1027 1027
1028 1028
1029 // Fprint "pretty-prints" an AST node to output and returns the number 1029 // Fprint "pretty-prints" an AST node to output and returns the number
1030 // of bytes written and an error (if any) for a given configuration cfg. 1030 // of bytes written and an error (if any) for a given configuration cfg.
1031 // Position information is interpreted relative to the file set fset.
1031 // The node type must be *ast.File, or assignment-compatible to ast.Expr, 1032 // The node type must be *ast.File, or assignment-compatible to ast.Expr,
1032 // ast.Decl, ast.Spec, or ast.Stmt. 1033 // ast.Decl, ast.Spec, or ast.Stmt.
1033 // 1034 //
1034 func (cfg *Config) Fprint(output io.Writer, fset *token.FileSet, node interface{ }) (int, os.Error) { 1035 func (cfg *Config) Fprint(output io.Writer, fset *token.FileSet, node interface{ }) (int, os.Error) {
1035 // redirect output through a trimmer to eliminate trailing whitespace 1036 // redirect output through a trimmer to eliminate trailing whitespace
1036 // (Input to a tabwriter must be untrimmed since trailing tabs provide 1037 // (Input to a tabwriter must be untrimmed since trailing tabs provide
1037 // formatting information. The tabwriter could provide trimming 1038 // formatting information. The tabwriter could provide trimming
1038 // functionality but no tabwriter is used when RawFormat is set.) 1039 // functionality but no tabwriter is used when RawFormat is set.)
1039 output = &trimmer{output: output} 1040 output = &trimmer{output: output}
1040 1041
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 } 1111 }
1111 1112
1112 1113
1113 // Fprint "pretty-prints" an AST node to output. 1114 // Fprint "pretty-prints" an AST node to output.
1114 // It calls Config.Fprint with default settings. 1115 // It calls Config.Fprint with default settings.
1115 // 1116 //
1116 func Fprint(output io.Writer, fset *token.FileSet, node interface{}) os.Error { 1117 func Fprint(output io.Writer, fset *token.FileSet, node interface{}) os.Error {
1117 _, err := (&Config{Tabwidth: 8}).Fprint(output, fset, node) // don't car e about number of bytes written 1118 _, err := (&Config{Tabwidth: 8}).Fprint(output, fset, node) // don't car e about number of bytes written
1118 return err 1119 return err
1119 } 1120 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b