use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method getTextWithLatin.
@Test
public void getTextWithLatin() {
CodePointCharStream s = CharStreams.fromString("0123456789");
assertEquals("34567", s.getText(Interval.of(3, 7)));
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method emptyBytesLookAheadReturnsEOF.
@Test
public void emptyBytesLookAheadReturnsEOF() {
CodePointCharStream s = CharStreams.fromString("");
assertEquals(IntStream.EOF, s.LA(1));
assertEquals(0, s.index());
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method lookAheadWithLatin.
@Test
public void lookAheadWithLatin() {
CodePointCharStream s = CharStreams.fromString("0123456789");
assertEquals('5', s.LA(6));
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method toStringWithCJK.
@Test
public void toStringWithCJK() {
CodePointCharStream s = CharStreams.fromString("01234䂔6789");
assertEquals("01234䂔6789", s.toString());
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method consumingSingleCJKCodePointShouldMoveIndex.
@Test
public void consumingSingleCJKCodePointShouldMoveIndex() {
CodePointCharStream s = CharStreams.fromString("愛");
assertEquals(0, s.index());
s.consume();
assertEquals(1, s.index());
}
Aggregations