fp01 = regInfo{inputs: nil, outputs: fponly}
fp21 = regInfo{inputs: []regMask{fp, fp}, outputs: fponly}
- fp21load = regInfo{inputs: []regMask{fp, gpspsb, 0}, outputs: fponly}
+ fp21load = regInfo{inputs: []regMask{fp, gpspsb, 0}, outputs: fponly}
fpgp = regInfo{inputs: fponly, outputs: gponly}
gpfp = regInfo{inputs: gponly, outputs: fponly}
fp11 = regInfo{inputs: fponly, outputs: fponly}
framepointerreg: int8(num["BP"]),
linkreg: -1, // not used
})
-}
\ No newline at end of file
+}
fset *token.FileSet
// Current state
- output []byte // raw printer result
- indent int // current indentation
- level int // level == 0: outside composite literal; level > 0: inside composite literal
- mode pmode // current printer mode
- impliedSemi bool // if set, a linebreak implies a semicolon
- lastTok token.Token // last token printed (token.ILLEGAL if it's whitespace)
- prevOpen token.Token // previous non-brace "open" token (, [, or token.ILLEGAL
- wsbuf []whiteSpace // delayed white space
+ output []byte // raw printer result
+ indent int // current indentation
+ level int // level == 0: outside composite literal; level > 0: inside composite literal
+ mode pmode // current printer mode
+ endAlignment bool // if set, terminate alignment immediately
+ impliedSemi bool // if set, a linebreak implies a semicolon
+ lastTok token.Token // last token printed (token.ILLEGAL if it's whitespace)
+ prevOpen token.Token // previous non-brace "open" token (, [, or token.ILLEGAL
+ wsbuf []whiteSpace // delayed white space
// Positions
// The out position differs from the pos position when the result
// writeByte writes ch n times to p.output and updates p.pos.
// Only used to write formatting (white space) characters.
func (p *printer) writeByte(ch byte, n int) {
+ if p.endAlignment {
+ // Ignore any alignment control character;
+ // and at the end of the line, break with
+ // a formfeed to indicate termination of
+ // existing columns.
+ switch ch {
+ case '\t', '\v':
+ ch = ' '
+ case '\n', '\f':
+ ch = '\f'
+ p.endAlignment = false
+ }
+ }
+
if p.out.Column == 1 {
// no need to write line directives before white space
p.writeIndent()
nlines := 0
var li int // index of last newline; valid if nlines > 0
for i := 0; i < len(s); i++ {
- // Go tokens cannot contain '\f' - no need to look for it
- if s[i] == '\n' {
+ // Raw string literals may contain any character except back quote (`).
+ if ch := s[i]; ch == '\n' || ch == '\f' {
+ // account for line break
nlines++
li = i
+ // A line break inside a literal will break whatever column
+ // formatting is in place; ignore any further alignment through
+ // the end of the line.
+ p.endAlignment = true
}
}
p.pos.Offset += len(s)