(char c)
| 237 | } |
| 238 | |
| 239 | private Printer escapeCharacter(char c) { |
| 240 | if (c == '"') { |
| 241 | return backslashChar(c); |
| 242 | } |
| 243 | switch (c) { |
| 244 | case '\\': |
| 245 | return backslashChar('\\'); |
| 246 | case '\r': |
| 247 | return backslashChar('r'); |
| 248 | case '\n': |
| 249 | return backslashChar('n'); |
| 250 | case '\t': |
| 251 | return backslashChar('t'); |
| 252 | default: |
| 253 | if (c < 32) { |
| 254 | // TODO(bazel-team): support \x escapes |
| 255 | return this.append(String.format("\\x%02x", (int) c)); |
| 256 | } |
| 257 | return this.append(c); // no need to support UTF-8 |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | // Reports whether x is already present on the visitation stack, pushing it if not. |
| 262 | private boolean push(Object x) { |
no test coverage detected