Beispiel #1
0
 public void TestReservedWords()
 {
     var lex = new NewLexer(new StringReader("true"));
     var token = lex.Scan();
     Assert.AreEqual(token.tag, Tag.TRUE);
     lex = new NewLexer(new StringReader("false"));
     token = lex.Scan();
     Assert.AreEqual(token.tag, Tag.FALSE);
 }
Beispiel #2
0
 public void TestIdentifiers()
 {
     var lex = new NewLexer(new StringReader("asdf"));
     var token = lex.Scan();
     Assert.AreEqual(token.tag, Tag.IDENTIFIER);
 }
Beispiel #3
0
 public void TestInteger()
 {
     var lex = new NewLexer(new StringReader("123"));
     var token = lex.Scan();
     Assert.AreEqual(token.tag, Tag.INTEGER);
 }
Beispiel #4
0
 public void TestEndOfSource()
 {
     var lex = new NewLexer(new StringReader(""));
     var token = lex.Scan();
     Assert.IsNull(token);
 }