GetDecimalValue() public method

public GetDecimalValue ( ) : BigDecimal
return BigDecimal
Beispiel #1
0
        public static Number String2Number(string str)
        {
            if (str == null)
            {
                return 0;
            }

            //TODO --ExprEvalUtils-String2Number
            try
            {
                return Convert.ToInt32(str);
            }
            catch (Exception ex)
            {
                Console.WriteLine("String2Number-ToInt32-{0}-{1}", str, ex);
            }
            try
            {
                return Convert.ToInt64(str);
            }
            catch (Exception ex)
            {
                Console.WriteLine("String2Number-ToInt64-{0}-{1}", str, ex);
            }
            try
            {
                var lexer = new MySqlLexer(str);
                switch (lexer.Token())
                {
                    case MySqlToken.LiteralNumPureDigit:
                    {
                        return lexer.GetIntegerValue();
                    }

                    case MySqlToken.LiteralNumMixDigit:
                    {
                        return lexer.GetDecimalValue();
                    }

                    default:
                    {
                        throw new ArgumentException("unrecognized number: " + str);
                    }
                }
            }
            catch (SqlSyntaxErrorException e)
            {
                throw new ArgumentException("str", e);
            }
        }
 public virtual void TestNumber()
 {
     var sut =
         new MySqlLexer(" . 12e3/***/.12e3#/**\n.123ee123.1--  \r\t\n.12e/*a*//* !*/.12e_a/12e-- \r\t.12e-1");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("12000", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("120", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("123ee123", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("0.1", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12e_a", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpSlash, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer(".12e-1  ");
     Assert.AreEqual("0.012", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12e000000000000000  ");
     Assert.AreEqual("12", sut.GetDecimalValue().ToPlainString());
     sut = new MySqlLexer(".12e-  ");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpMinus, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer(".12e-1d  ");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpMinus, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("1d", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12.e+1d  ");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("120", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("d", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12.f ");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("12", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("f", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer(".12f ");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12f", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("1.2f ");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("1.2", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("f", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     try
     {
         sut = new MySqlLexer("12.e ");
         Assert.IsFalse(true, "should not reach here");
     }
     catch (SqlSyntaxErrorException)
     {
     }
     sut = new MySqlLexer("0e  ");
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("0e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12. e  ");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("12", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12. e+1  ");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("12", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpPlus, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumPureDigit, sut.Token());
     Assert.AreEqual("1", sut.GetIntegerValue().ToString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12.e+1  ");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("120", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12.");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("12", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer(".12");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("0.12", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12e");
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12ef");
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12ef", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer(".12e");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("1.0e0");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("1.0", sut.GetDecimalValue().ToPlainString());
     sut = new MySqlLexer("1.01e0,");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("1.01", sut.GetDecimalValue().ToPlainString());
     sut = new MySqlLexer(".12e-");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpMinus, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer(".12e-d");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("12e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpMinus, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("d", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("123E2.*");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("12300", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpAsterisk, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("1e-1  ");
     Assert.AreEqual("0.1", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer(".E5");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("E5", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0E5d");
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("0E5d", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0E10");
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("0", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer(".   ");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("12345678901234567890123 1234567890 1234567890123456789");
     Assert.AreEqual(MySqlToken.LiteralNumPureDigit, sut.Token());
     Assert.AreEqual("12345678901234567890123", sut.GetIntegerValue().ToString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumPureDigit, sut.Token());
     Assert.AreEqual("1234567890", sut.GetIntegerValue().ToString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumPureDigit, sut.Token());
     Assert.AreEqual("1234567890123456789", sut.GetIntegerValue().ToString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer(".");
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
 }
 public virtual void TestHexBit()
 {
     var sut = new MySqlLexer("0x123  ");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("123", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0x123");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("123", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0x123aDef");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("123aDef", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0x0");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("0", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0xABC");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("ABC", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0xA01aBC");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("A01aBC", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0x123re2  ");
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("0x123re2", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("x'123'e  ");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("123", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("x'123'");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("123", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("x'102AaeF3'");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("102AaeF3", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0b10");
     Assert.AreEqual(MySqlToken.LiteralBit, sut.Token());
     Assert.AreEqual("10", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0b101101");
     Assert.AreEqual(MySqlToken.LiteralBit, sut.Token());
     Assert.AreEqual("101101", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("0b103  ");
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("0b103", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("b'10'b  ");
     Assert.AreEqual(MySqlToken.LiteralBit, sut.Token());
     Assert.AreEqual("10", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("b", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
     sut = new MySqlLexer("\r 0xabc.123;x'e'a0x1.3x'a2w'--\t0b11\n0b12*b '123' b'101'");
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("abc", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("0.123", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.PuncSemicolon, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("e", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("a0x1", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("3x", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralChars, sut.Token());
     Assert.AreEqual("'a2w'", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("0b12", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpAsterisk, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("b", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralChars, sut.Token());
     Assert.AreEqual("'123'", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralBit, sut.Token());
     Assert.AreEqual("101", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
 }
 public virtual void TestLexer()
 {
     var sut = new MySqlLexer(" @a.1_$ .1e+1a%x'a1e'*0b11a \r#\"\"\n@@`123`@@'abc'1.e-1d`/`1.1e1.1e1");
     Assert.AreEqual(MySqlToken.UsrVar, sut.Token());
     Assert.AreEqual("@a.1_$", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.PuncDot, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("1e", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpPlus, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("1a", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpPercent, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralHex, sut.Token());
     Assert.AreEqual("a1e", new string(sut.Sql, sut.OffsetCache, sut.SizeCache));
     sut.NextToken();
     Assert.AreEqual(MySqlToken.OpAsterisk, sut.Token());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("0b11a", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.SysVar, sut.Token());
     Assert.AreEqual("`123`", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.SysVar, sut.Token());
     Assert.AreEqual(string.Empty, sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralChars, sut.Token());
     Assert.AreEqual("'abc'", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("0.1", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("d", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Identifier, sut.Token());
     Assert.AreEqual("`/`", sut.GetStringValue());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("11", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.LiteralNumMixDigit, sut.Token());
     Assert.AreEqual("1", sut.GetDecimalValue().ToPlainString());
     sut.NextToken();
     Assert.AreEqual(MySqlToken.Eof, sut.Token());
 }
        /// <exception cref="System.SqlSyntaxErrorException" />
        public static void Main(string[] args)
        {
            var sql = Performance.SqlBenchmarkSelect;
            var chars = sql.ToCharArray();
            var sut = new MySqlLexer(sql);
            var start = Runtime.CurrentTimeMillis();
            var end = Runtime.CurrentTimeMillis();
            for (var i = 0; i < 1; ++i)
            {
                for (; !sut.Eof();)
                {
                    sut.NextToken();
                    switch (sut.Token())
                    {
                        case MySqlToken.LiteralNumMixDigit:
                        {
                            sut.GetDecimalValue();
                            break;
                        }

                        case MySqlToken.LiteralNumPureDigit:
                        {
                            sut.GetIntegerValue();
                            break;
                        }

                        default:
                        {
                            sut.GetStringValue();
                            break;
                        }
                    }
                }
            }
            var loop = 5000000;
            sut = new MySqlLexer(sql);
            start = Runtime.CurrentTimeMillis();
            for (var i_1 = 0; i_1 < loop; ++i_1)
            {
                sut = new MySqlLexer(chars);
                for (; !sut.Eof();)
                {
                    sut.NextToken();
                    switch (sut.Token())
                    {
                        case MySqlToken.LiteralNumMixDigit:
                        {
                            sut.GetDecimalValue();
                            break;
                        }

                        case MySqlToken.LiteralNumPureDigit:
                        {
                            sut.GetIntegerValue();
                            break;
                        }

                        default:
                        {
                            sut.GetStringValue();
                            break;
                        }
                    }
                }
            }
            end = Runtime.CurrentTimeMillis();
            Console.Out.WriteLine((end - start)*1.0d/(loop/1000) + " us.");
        }