public static void Check(Token tok, Token.Type type, string text = null, int lineNum = 0)
        {
            UnitTest.ErrorIfNull(tok);
            if (tok == null)
            {
                return;
            }
            UnitTest.ErrorIf(tok.type != type, "Token type: expected "
                             + type + ", but got " + tok.type);

            UnitTest.ErrorIf(text != null && tok.text != text,
                             "Token text: expected " + text + ", but got " + tok.text);
        }