add to unit test.

This commit is contained in:
Terence Parr 2012-09-29 11:47:06 -07:00
parent ea652962ea
commit d3d5bebf9f
1 changed files with 14 additions and 2 deletions

View File

@ -153,8 +153,20 @@ public class TestATNLexerInterpreter extends BaseTest {
"lexer grammar L;\n"+
"CMT : '/*' (CMT | .)+ '*/' ;\n" +
"WS : (' '|'\n')+ ;");
String expecting = "CMT, WS, CMT, EOF";
checkLexerMatches(lg, "/* ick */\n/* /*nested*/ */", expecting);
String expecting = "CMT, WS, CMT, WS, CMT, WS, EOF";
// stuff on end of comment matches another rule
checkLexerMatches(lg,
"/* ick */\n" +
"/* /* */\n" +
"/* /*nested*/ */\n",
expecting);
// stuff on end of comment doesn't match another rule
expecting = "CMT, WS, CMT, WS, CMT, WS, EOF";
checkLexerMatches(lg,
"/* ick */x\n" +
"/* /* */x\n" +
"/* /*nested*/ */x\n",
expecting);
}
@Test public void testLexerWildcardNonGreedyLoopByDefault() throws Exception {