/** * Tries to scan for the end of a comment denoted by the "-->" sequence. * * @return false, if the parsing could not be completed because the end of the HTML source was * reached. True otherwise. */ private boolean scanForCommentEnd() { int pos = caret.getOffset(); if (caret.walkAfterMatchCheckCase("-->")) { status = Status.COMPLETE; return true; } else { caret.goTo(pos); return false; } }
@Test public void test() { String test = " ABCDEFGH\t\r\nabcdefgh"; Caret c = new Caret(test, 0); assertThat(c.walkAfterMatchCheckCase("cdefg"), equalTo(true)); assertThat(c.get(0), equalTo('h')); c.goN(1); assertThat(c.walkAfterMatchCheckCase("cdefg"), equalTo(false)); } }