namespace System {
[Serializable]
+#if NET_2_0
+ [System.Runtime.InteropServices.ComVisible (true)]
+#endif
public struct Double : IComparable, IFormattable, IConvertible
#if NET_2_0
, IComparable <double>, IEquatable <double>
private const int State_ExponentSign = 4;
private const int State_Exponent = 5;
private const int State_ConsumeWhiteSpace = 6;
+ private const int State_Exit = 7;
public static double Parse (string s, NumberStyles style, IFormatProvider provider)
{
return result;
}
- [MonoTODO("check if digits are group in correct numbers between the group separators")]
+ // FIXME: check if digits are group in correct numbers between the group separators
internal static bool Parse (string s, NumberStyles style, IFormatProvider provider, bool tryParse, out double result, out Exception exc)
{
result = 0;
if (sidx == len) {
if (!tryParse)
exc = Int32.GetFormatException ();
- return true;
+ return false;
}
}
sidx = len;
continue;
}
+
switch (state){
case State_AllowSign:
if ((style & NumberStyles.AllowLeadingSign) != 0){
}
if (c == 'e' || c == 'E'){
- if ((style & NumberStyles.AllowExponent) == 0)
- throw new FormatException ("Unknown char: " + c);
+ if ((style & NumberStyles.AllowExponent) == 0) {
+ if (!tryParse)
+ exc = new FormatException ("Unknown char: " + c);
+ return false;
+ }
b [didx++] = (byte) c;
state = State_ExponentSign;
break;
return false;
case State_ConsumeWhiteSpace:
- if (allow_trailing_white && Char.IsWhiteSpace (c))
+ if (allow_trailing_white && Char.IsWhiteSpace (c)) {
+ state = State_ConsumeWhiteSpace;
break;
+ }
if (!tryParse)
exc = new FormatException ("Unknown char");
return false;
}
+
+ if (state == State_Exit)
+ break;
}
b [didx] = 0;