Ejemplo n.º 1
0
 /// <summary>
 /// Scans the statement and returns a list of tokens
 /// </summary>
 /// <param name="statement"></param>
 /// <returns></returns>
 public IEnumerable<AToken> GetTokens(string statement)
 {
     var tokens = statement.Split(' ');
     var factory = new TokenFactory();
     foreach (var token in tokens)
     {
         yield return factory.Interpret(token);
     }
 }
Ejemplo n.º 2
0
 public void MultiplicationIsRecognized()
 {
     TokenFactory factory = new TokenFactory();
     var token = factory.Interpret("*");
     Assert.AreEqual(token.GetType(), typeof (Multiplication));
 }