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

Delta Between Two Patch Sets: src/pkg/exp/datafmt/datafmt.go

Issue 4536063: code review 4536063: pkg: spelling tweaks, A-H (Closed)
Left Patch Set: Created 13 years, 11 months ago
Right Patch Set: diff -r 4ce4c75f9bb5 https://go.googlecode.com/hg/ Created 13 years, 11 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:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
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 /* Package datafmt implements syntax-directed, type-driven formatting 5 /* Package datafmt implements syntax-directed, type-driven formatting
6 of arbitrary data structures. Formatting a data structure consists of 6 of arbitrary data structures. Formatting a data structure consists of
7 two phases: first, a parser reads a format specification and builds a 7 two phases: first, a parser reads a format specification and builds a
8 "compiled" format. Then, the format can be applied repeatedly to 8 "compiled" format. Then, the format can be applied repeatedly to
9 arbitrary values. Applying a format to a value evaluates to a []byte 9 arbitrary values. Applying a format to a value evaluates to a []byte
10 containing the formatted value bytes, or nil. 10 containing the formatted value bytes, or nil.
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 case *group: 588 case *group:
589 // remember current indentation 589 // remember current indentation
590 indentLen := s.indent.Len() 590 indentLen := s.indent.Len()
591 591
592 // update current indentation 592 // update current indentation
593 mark := s.save() 593 mark := s.save()
594 s.eval(t.indent, value, index) 594 s.eval(t.indent, value, index)
595 // if the indentation evaluates to nil, the state's output buffe r 595 // if the indentation evaluates to nil, the state's output buffe r
596 // didn't change - either way it's ok to append the difference t o 596 // didn't change - either way it's ok to append the difference t o
597 » » // the current identation 597 » » // the current indentation
598 s.indent.Write(s.output.Bytes()[mark.outputLen:s.output.Len()]) 598 s.indent.Write(s.output.Bytes()[mark.outputLen:s.output.Len()])
599 s.restore(mark) 599 s.restore(mark)
600 600
601 // format group body 601 // format group body
602 mark = s.save() 602 mark = s.save()
603 b := true 603 b := true
604 if !s.eval(t.body, value, index) { 604 if !s.eval(t.body, value, index) {
605 s.restore(mark) 605 s.restore(mark)
606 b = false 606 b = false
607 } 607 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 // 722 //
723 func (f Format) Sprint(args ...interface{}) string { 723 func (f Format) Sprint(args ...interface{}) string {
724 var buf bytes.Buffer 724 var buf bytes.Buffer
725 _, err := f.Fprint(&buf, nil, args...) 725 _, err := f.Fprint(&buf, nil, args...)
726 if err != nil { 726 if err != nil {
727 var i interface{} = args 727 var i interface{} = args
728 fmt.Fprintf(&buf, "--- Sprint(%s) failed: %v", fmt.Sprint(i), er r) 728 fmt.Fprintf(&buf, "--- Sprint(%s) failed: %v", fmt.Sprint(i), er r)
729 } 729 }
730 return buf.String() 730 return buf.String()
731 } 731 }
LEFTRIGHT

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