예제 #1
0
        private void CheckReadCurrentIf(
            String str, TokenType expectedType, Token expectedResult, Token expectedCurrent, String message)
        {
            OperandLexer lexer = MakeFrom(str);

            lexer.MoveNext();

            Token actualResult = lexer.ReadCurrentIf(expectedType);

            TokenTest.Check(expectedResult, actualResult, "Result: " + message);
            CheckCurrentToken(expectedCurrent, lexer, "Current: " + message);
        }
예제 #2
0
 private void CheckMoveNextOne(OperandLexer lexer, Token expected, String message)
 {
     try
     {
         lexer.MoveNext();
         Token actual = lexer.CurrentToken;
         Assert.IsNotNull(expected, message);
         TokenTest.Check(expected, actual, message);
     }
     catch (Casl2SimulatorException)
     {
         Assert.IsNull(expected, message);
     }
 }
예제 #3
0
        private void CheckReadCurrentAs(
            String str, TokenType expectedType, Boolean success,
            Token expectedResult, Token expectedCurrent, String message)
        {
            OperandLexer lexer = MakeFrom(str);

            lexer.MoveNext();
            try
            {
                Token actualResult = lexer.ReadCurrentAs(expectedType);
                Assert.IsTrue(success, message);

                TokenTest.Check(expectedResult, actualResult, "Result: " + message);
                CheckCurrentToken(expectedCurrent, lexer, "Current: " + message);
            }
            catch (Casl2SimulatorException)
            {
                Assert.IsFalse(success, message);
            }
        }
예제 #4
0
        private void CheckCurrentToken(Token expected, OperandLexer lexer, String message)
        {
            Token actual = lexer.CurrentToken;

            TokenTest.Check(expected, actual, message);
        }