Ejemplo n.º 1
0
 private Token GetCurrentToken()
 {
     if (currentToken == null)
     {
         if (scanner.InternalMoveNext())
         {
             currentToken = scanner.Current;
         }
     }
     return currentToken;
 }
Ejemplo n.º 2
0
 private void Skip()
 {
     if (currentToken != null)
     {
         currentToken = null;
         scanner.ConsumeCurrent();
     }
 }
Ejemplo n.º 3
0
        private void AssertToken(Token expected, Token actual, int tokenNumber)
        {
            Dump.WriteLine(expected.GetType().Name);
            Assert.NotNull(actual);
            Assert.AreEqual(expected.GetType(), actual.GetType(), "Token {0} is not of the expected type", tokenNumber);

            foreach (var property in expected.GetType().GetProperties())
            {
                if (property.PropertyType != typeof(Mark) && property.CanRead)
                {
                    var value = property.GetValue(actual, null);
                    var expectedValue = property.GetValue(expected, null);
                    Dump.WriteLine("\t{0} = {1}", property.Name, value);
                    Assert.AreEqual(expectedValue, value, "Comparing property {0} in token {1}", property.Name, tokenNumber);
                }
            }
        }