use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method getTextWithEmoji.
@Test
public void getTextWithEmoji() {
CodePointCharStream s = CharStreams.fromString(new StringBuilder("01234").appendCodePoint(0x1F522).append("6789").toString());
assertEquals("34🔢67", s.getText(Interval.of(3, 7)));
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method singleLatinCodePointLookAheadShouldReturnCodePoint.
@Test
public void singleLatinCodePointLookAheadShouldReturnCodePoint() {
CodePointCharStream s = CharStreams.fromString("X");
assertEquals('X', s.LA(1));
assertEquals(0, s.index());
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method toStringWithEmoji.
@Test
public void toStringWithEmoji() {
CodePointCharStream s = CharStreams.fromString(new StringBuilder("01234").appendCodePoint(0x1F522).append("6789").toString());
assertEquals("01234🔢6789", s.toString());
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method consumingSingleLatinCodePointShouldMoveIndex.
@Test
public void consumingSingleLatinCodePointShouldMoveIndex() {
CodePointCharStream s = CharStreams.fromString("X");
assertEquals(0, s.index());
s.consume();
assertEquals(1, s.index());
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method consumingSingleEmojiCodePointShouldMoveIndex.
@Test
public void consumingSingleEmojiCodePointShouldMoveIndex() {
CodePointCharStream s = CharStreams.fromString(new StringBuilder().appendCodePoint(0x1F4A9).toString());
assertEquals(0, s.index());
s.consume();
assertEquals(1, s.index());
}
Aggregations