use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method lookBehindWithCJK.
@Test
public void lookBehindWithCJK() {
CodePointCharStream s = CharStreams.fromString("01234䂔6789");
s.seek(6);
assertEquals(0x4094, s.LA(-1));
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method consumingEmptyStreamShouldThrow.
@Test
public void consumingEmptyStreamShouldThrow() {
CodePointCharStream s = CharStreams.fromString("");
thrown.expect(IllegalStateException.class);
thrown.expectMessage("cannot consume EOF");
s.consume();
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method seekWithEmoji.
@Test
public void seekWithEmoji() {
CodePointCharStream s = CharStreams.fromString(new StringBuilder("01234").appendCodePoint(0x1F522).append("6789").toString());
s.seek(5);
assertEquals(0x1F522, s.LA(1));
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method singleEmojiCodePointHasSize1.
@Test
public void singleEmojiCodePointHasSize1() {
CodePointCharStream s = CharStreams.fromString(new StringBuilder().appendCodePoint(0x1F4A9).toString());
assertEquals(1, s.size());
assertEquals(0, s.index());
}
use of org.antlr.v4.runtime.CodePointCharStream in project antlr4 by antlr.
the class TestCodePointCharStream method lookBehindWithLatin.
@Test
public void lookBehindWithLatin() {
CodePointCharStream s = CharStreams.fromString("0123456789");
s.seek(6);
assertEquals('5', s.LA(-1));
}
Aggregations