NumberLiteral- error parsing 10000000000

Dec 8, 2011 at 8:22 PM

10000000000 is too long to be an integer, but it will work in a float. However, when parsing, I get the following exception:

Error Cannot convert literal 10000000000 to type Int32.

In NumberLiteral.AssignTypeCodes it could look at the length of the string- if greater than 10 characters, then set isFloat.  Though that's certainly not very clean.

I think I can get by by adding TypeCode.Single to NumberLiteral.DefaultIntTypes; is there a better solution?

Dec 8, 2011 at 9:13 PM

Look at ExpressionEvaluatorGrammar:


      number.DefaultIntTypes = new TypeCode[] { TypeCode.Int32, TypeCode.Int64, NumberLiteral.TypeCodeBigInt };


This tells parser to use Int64 or even BigInt types when values are too large. That would solve your problem.