@Test public void testIsEscapedReturnsFalseWhenCharacterIsQuadrupleEscaped() throws Exception { Assert.assertFalse(ParseTools.isEscaped("/foo{bar\\\\\\\\}}".toCharArray(), 12)); }
public static boolean isEscaped(final char[] chars, final int cursor) { Assert.notNull(chars, "Character input array must not be null."); Assert.assertTrue(cursor >= 0, "Start position must be greater than zero."); Assert.assertTrue(cursor < (chars.length), "Start position must be within the array upper bound."); if ((cursor > 0) && (chars[cursor - 1] == ESCAPE_CHAR)) { if ((cursor == 1) || ((cursor > 1) && (chars[cursor - 2] != ESCAPE_CHAR))) { return true; } } return false; }
ParseTools { public static boolean isEscaped(final char[] chars, final int cursor) { Assert.notNull(chars, "Character input array must not be null."); Assert.assertTrue(cursor >= 0, "Start position must be greater than zero."); Assert.assertTrue(cursor < (chars.length), "Start position must be within the array upper bound."); if ((cursor > 0) && (chars[cursor - 1] == ESCAPE_CHAR)) { if ((cursor == 1) || ((cursor > 1) && (chars[cursor - 2] != ESCAPE_CHAR))) { return true; } } return false; } }
ParseTools { public static boolean isEscaped(final char[] chars, final int cursor) { Assert.notNull(chars, "Character input array must not be null."); Assert.assertTrue(cursor >= 0, "Start position must be greater than zero."); Assert.assertTrue(cursor < (chars.length), "Start position must be within the array upper bound."); if ((cursor > 0) && (chars[cursor - 1] == ESCAPE_CHAR)) { if ((cursor == 1) || ((cursor > 1) && (chars[cursor - 2] != ESCAPE_CHAR))) { return true; } } return false; }  }
ParseTools { public static boolean isEscaped(final char[] chars, final int cursor) { Assert.notNull(chars, "Character input array must not be null."); Assert.assertTrue(cursor >= 0, "Start position must be greater than zero."); Assert.assertTrue(cursor < (chars.length), "Start position must be within the array upper bound."); if ((cursor > 0) && (chars[cursor - 1] == ESCAPE_CHAR)) { if ((cursor == 1) || ((cursor > 1) && (chars[cursor - 2] != ESCAPE_CHAR))) { return true; } } return false; }  static CapturingGroup balancedCapture(final char[] chars, final int startPos, final int endPos,
            final CaptureType type); static boolean isEscaped(final char[] chars, final int cursor); }
ParseTools { public static boolean isEscaped(final char[] chars, final int cursor) { Assert.notNull(chars, "Character input array must not be null."); Assert.assertTrue(cursor >= 0, "Start position must be greater than zero."); Assert.assertTrue(cursor < (chars.length), "Start position must be within the array upper bound."); if ((cursor > 0) && (chars[cursor - 1] == ESCAPE_CHAR)) { if ((cursor == 1) || ((cursor > 1) && (chars[cursor - 2] != ESCAPE_CHAR))) { return true; } } return false; }  static CapturingGroup balancedCapture(final char[] chars, final int startPos, final int endPos,
            final CaptureType type); static boolean isEscaped(final char[] chars, final int cursor);  }