use of org.antlr.v4.tool.LexerGrammar in project antlr4 by tunnelvisionlabs.
the class TestATNLexerInterpreter method testLexerNotSMPSetMatchesBMP.
@Test
public void testLexerNotSMPSetMatchesBMP() throws Exception {
LexerGrammar lg = new LexerGrammar("lexer grammar L;\n" + "ID : ~('\\u{1F4A9}'|'\\u{1F4AA}')\n ;");
String expecting = "ID, EOF";
checkLexerMatches(lg, "\u611B", expecting);
}
use of org.antlr.v4.tool.LexerGrammar in project antlr4 by tunnelvisionlabs.
the class TestATNLexerInterpreter method testGreedyBetweenRules.
@Test
public void testGreedyBetweenRules() throws Exception {
LexerGrammar lg = new LexerGrammar("lexer grammar L;\n" + "A : '<a>' ;\n" + "B : '<' .+ '>' ;\n");
String expecting = "B, EOF";
checkLexerMatches(lg, "<a><x>", expecting);
}
use of org.antlr.v4.tool.LexerGrammar in project antlr4 by tunnelvisionlabs.
the class TestATNLexerInterpreter method testLexerEscapeInString.
@Test
public void testLexerEscapeInString() throws Exception {
LexerGrammar lg = new LexerGrammar("lexer grammar L;\n" + "STR : '[' ('~' ']' | .)* ']' ;\n");
checkLexerMatches(lg, "[a~]b]", "STR, EOF");
checkLexerMatches(lg, "[a]", "STR, EOF");
}
use of org.antlr.v4.tool.LexerGrammar in project antlr4 by tunnelvisionlabs.
the class TestATNLexerInterpreter method testLexerSetUnicodeSMP.
@Test
public void testLexerSetUnicodeSMP() throws Exception {
LexerGrammar lg = new LexerGrammar("lexer grammar L;\n" + "ID : ('\\u{1F4A9}'|'\\u{1F4AA}')\n ;");
String expecting = "ID, EOF";
checkLexerMatches(lg, new StringBuilder().appendCodePoint(0x1F4A9).toString(), expecting);
}
use of org.antlr.v4.tool.LexerGrammar in project antlr4 by tunnelvisionlabs.
the class TestATNLexerInterpreter method testLexerNotBMPSetMatchesSMP.
@Test
public void testLexerNotBMPSetMatchesSMP() throws Exception {
LexerGrammar lg = new LexerGrammar("lexer grammar L;\n" + "ID : ~('a'|'b')\n ;");
String expecting = "ID, EOF";
checkLexerMatches(lg, new StringBuilder().appendCodePoint(0x1F4A9).toString(), expecting);
}
Aggregations