示例#1
0
 public void testConsume()
 {
     Lexer lexer = new Lexer("123");
     lexer.consume(2);
     Assert.IsTrue(lexer.consumeIf("3"));
     Assert.IsTrue(lexer.eof());
 }
示例#2
0
 public void testConsumeIf()
 {
     Lexer lexer = new Lexer("abcd");
     Assert.IsFalse(lexer.consumeIf("xab"));
     Assert.IsTrue(lexer.consumeIf("ab"));
     Assert.IsFalse(lexer.consumeIf("ycd"));
     Assert.IsTrue(lexer.consumeIf("cd"));
     Assert.IsTrue(lexer.eof());
 }