@Test public void testUnescapeBraceFormatIgnoresErrors() { assertThat(unescapeBraceFormat("Hello '")).isEqualTo("Hello "); assertThat(unescapeBraceFormat("Hello \\'")).isEqualTo("Hello "); }
static void unescapeBraceFormat(StringBuilder out, String message, int start, int end) { int pos = start; boolean isQuoted = false; while (pos < end) { char c = message.charAt(pos++); if (c != '\\' && c != '\'') { continue; } int quoteStart = pos - 1; if (c == '\\') { c = message.charAt(pos++); if (c != '\'') { continue; } } out.append(message, start, quoteStart); start = pos; if (pos == end) { break; } if (isQuoted) { isQuoted = false; } else if (message.charAt(pos) != '\'') { isQuoted = true; } else { pos++; } } if (start < end) { out.append(message, start, end); } }
BraceStyleMessageParser extends MessageParser { static void unescapeBraceFormat(StringBuilder out, String message, int start, int end) { int pos = start; boolean isQuoted = false; while (pos < end) { char c = message.charAt(pos++); if (c != '\\' && c != '\'') { continue; } int quoteStart = pos - 1; if (c == '\\') { c = message.charAt(pos++); if (c != '\'') { continue; } } out.append(message, start, quoteStart); start = pos; if (pos == end) { break; } if (isQuoted) { isQuoted = false; } else if (message.charAt(pos) != '\'') { isQuoted = true; } else { pos++; } } if (start < end) { out.append(message, start, end); } } }
BraceStyleMessageParser extends MessageParser { static void unescapeBraceFormat(StringBuilder out, String message, int start, int end) { int pos = start; boolean isQuoted = false; while (pos < end) { char c = message.charAt(pos++); if (c != '\\' && c != '\'') { continue; } int quoteStart = pos - 1; if (c == '\\') { c = message.charAt(pos++); if (c != '\'') { continue; } } out.append(message, start, quoteStart); start = pos; if (pos == end) { break; } if (isQuoted) { isQuoted = false; } else if (message.charAt(pos) != '\'') { isQuoted = true; } else { pos++; } } if (start < end) { out.append(message, start, end); } }  }
BraceStyleMessageParser extends MessageParser { static void unescapeBraceFormat(StringBuilder out, String message, int start, int end) { int pos = start; boolean isQuoted = false; while (pos < end) { char c = message.charAt(pos++); if (c != '\\' && c != '\'') { continue; } int quoteStart = pos - 1; if (c == '\\') { c = message.charAt(pos++); if (c != '\'') { continue; } } out.append(message, start, quoteStart); start = pos; if (pos == end) { break; } if (isQuoted) { isQuoted = false; } else if (message.charAt(pos) != '\'') { isQuoted = true; } else { pos++; } } if (start < end) { out.append(message, start, end); } }  @Override final void unescape(StringBuilder out, String message, int start, int end); }
BraceStyleMessageParser extends MessageParser { static void unescapeBraceFormat(StringBuilder out, String message, int start, int end) { int pos = start; boolean isQuoted = false; while (pos < end) { char c = message.charAt(pos++); if (c != '\\' && c != '\'') { continue; } int quoteStart = pos - 1; if (c == '\\') { c = message.charAt(pos++); if (c != '\'') { continue; } } out.append(message, start, quoteStart); start = pos; if (pos == end) { break; } if (isQuoted) { isQuoted = false; } else if (message.charAt(pos) != '\'') { isQuoted = true; } else { pos++; } } if (start < end) { out.append(message, start, end); } }  @Override final void unescape(StringBuilder out, String message, int start, int end);  }