(s string)
| 38 | } |
| 39 | |
| 40 | func (fm *formatter) WriteQuotedName(s string) { |
| 41 | qpos := 0 |
| 42 | for i := 0; i < len(s); i++ { |
| 43 | ch := s[i] |
| 44 | if q, quoted := quoteByte(ch); quoted { |
| 45 | if qpos == 0 { |
| 46 | fm.WriteByte('"') |
| 47 | } |
| 48 | fm.WriteString(s[qpos:i]) |
| 49 | fm.Write(q) |
| 50 | qpos = i + 1 |
| 51 | } |
| 52 | } |
| 53 | fm.WriteString(s[qpos:]) |
| 54 | if qpos > 0 { |
| 55 | fm.WriteByte('"') |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | var quoteEscapeTable = map[byte]byte{ |
| 60 | '\a': 'a', |