4042 {
4044 bool flag = false;
4046 string value2;
4048 {
4051 value2 =
info.CurrencyGroupSeparator;
4052 flag = true;
4053 }
4054 else
4055 {
4057 value2 =
info.NumberGroupSeparator;
4058 }
4059 int num = 0;
4061 char c = ((ptr < strEnd) ? (*ptr) : '\0');
4062 while (true)
4063 {
4064 if (!
IsWhite(c) || (styles &
NumberStyles.AllowLeadingWhite) == 0 || (((uint)num & (
true ? 1u : 0u)) != 0 && (num & 0x20) == 0 &&
info.NumberNegativePattern != 2))
4065 {
4066 char* ptr2;
4068 {
4069 num |= 1;
4070 ptr = ptr2 - 1;
4071 }
4072 else if (c ==
'(' && (styles &
NumberStyles.AllowParentheses) != 0 && (num & 1) == 0)
4073 {
4074 num |= 3;
4075 number.IsNegative = true;
4076 }
4077 else
4078 {
4080 {
4081 break;
4082 }
4083 num |= 0x20;
4085 ptr = ptr2 - 1;
4086 }
4087 }
4088 c = ((++ptr < strEnd) ? (*ptr) : '\0');
4089 }
4090 int num2 = 0;
4091 int num3 = 0;
4092 int num4 = number.Digits.Length - 1;
4093 int num5 = 0;
4094 while (true)
4095 {
4096 char* ptr2;
4098 {
4099 num |= 4;
4100 if (c != '0' || ((uint)num & 8u) != 0)
4101 {
4102 if (num2 < num4)
4103 {
4104 number.Digits[num2] = (byte)c;
4105 if (c != '0' || number.Kind != NumberBufferKind.Integer)
4106 {
4107 num3 = num2 + 1;
4108 }
4109 }
4110 else if (c != '0')
4111 {
4112 number.HasNonZeroTail = true;
4113 }
4114 if ((num & 0x10) == 0)
4115 {
4116 number.Scale++;
4117 }
4118 if (num2 < num4)
4119 {
4120 num5 = ((c == '0') ? (num5 + 1) : 0);
4121 }
4122 num2++;
4123 num |= 8;
4124 }
4125 else if (((uint)num & 0x10u) != 0)
4126 {
4127 number.Scale--;
4128 }
4129 }
4130 else if ((styles &
NumberStyles.AllowDecimalPoint) != 0 && (num & 0x10) == 0 && ((ptr2 =
MatchChars(ptr, strEnd,
value)) !=
null || (flag && (num & 0x20) == 0 && (ptr2 =
MatchChars(ptr, strEnd,
info.NumberDecimalSeparator)) !=
null)))
4131 {
4132 num |= 0x10;
4133 ptr = ptr2 - 1;
4134 }
4135 else
4136 {
4137 if ((styles &
NumberStyles.AllowThousands) == 0 || (num & 4) == 0 || ((uint)num & 0x10u) != 0 || ((ptr2 =
MatchChars(ptr, strEnd, value2)) ==
null && (!flag || ((uint)num & 0x20u) != 0 || (ptr2 =
MatchChars(ptr, strEnd,
info.NumberGroupSeparator)) ==
null)))
4138 {
4139 break;
4140 }
4141 ptr = ptr2 - 1;
4142 }
4143 c = ((++ptr < strEnd) ? (*ptr) : '\0');
4144 }
4145 bool flag2 = false;
4146 number.DigitsCount = num3;
4147 number.Digits[num3] = 0;
4148 if (((uint)num & 4u) != 0)
4149 {
4150 if ((c ==
'E' || c ==
'e') && (styles &
NumberStyles.AllowExponent) != 0)
4151 {
4152 char* ptr3 = ptr;
4153 c = ((++ptr < strEnd) ? (*ptr) : '\0');
4154 char* ptr2;
4155 if ((ptr2 =
MatchChars(ptr, strEnd,
info._positiveSign)) !=
null)
4156 {
4157 c = (((ptr = ptr2) < strEnd) ? (*ptr) : '\0');
4158 }
4160 {
4161 c = (((ptr = ptr2) < strEnd) ? (*ptr) : '\0');
4162 flag2 = true;
4163 }
4165 {
4166 int num6 = 0;
4167 do
4168 {
4169 num6 = num6 * 10 + (c - 48);
4170 c = ((++ptr < strEnd) ? (*ptr) : '\0');
4171 if (num6 > 1000)
4172 {
4173 num6 = 9999;
4175 {
4176 c = ((++ptr < strEnd) ? (*ptr) : '\0');
4177 }
4178 }
4179 }
4181 if (flag2)
4182 {
4183 num6 = -num6;
4184 }
4185 number.Scale += num6;
4186 }
4187 else
4188 {
4189 ptr = ptr3;
4190 c = ((ptr < strEnd) ? (*ptr) : '\0');
4191 }
4192 }
4193 if (number.Kind == NumberBufferKind.FloatingPoint && !number.HasNonZeroTail)
4194 {
4195 int num7 = num3 - number.Scale;
4196 if (num7 > 0)
4197 {
4198 num5 = Math.Min(num5, num7);
4199 number.DigitsCount = num3 - num5;
4200 number.Digits[number.DigitsCount] = 0;
4201 }
4202 }
4203 while (true)
4204 {
4206 {
4207 char* ptr2;
4209 {
4210 num |= 1;
4211 ptr = ptr2 - 1;
4212 }
4213 else if (c == ')' && ((uint)num & 2u) != 0)
4214 {
4215 num &= -3;
4216 }
4217 else
4218 {
4220 {
4221 break;
4222 }
4224 ptr = ptr2 - 1;
4225 }
4226 }
4227 c = ((++ptr < strEnd) ? (*ptr) : '\0');
4228 }
4229 if ((num & 2) == 0)
4230 {
4231 if ((num & 8) == 0)
4232 {
4233 if (number.Kind != NumberBufferKind.Decimal)
4234 {
4235 number.Scale = 0;
4236 }
4237 if (number.Kind == NumberBufferKind.Integer && (num & 0x10) == 0)
4238 {
4239 number.IsNegative = false;
4240 }
4241 }
4243 return true;
4244 }
4245 }
4247 return false;
4248 }
static unsafe char * MatchChars(char *p, char *pEnd, string value)
static bool IsWhite(int ch)
static unsafe char * MatchNegativeSignChars(char *p, char *pEnd, NumberFormatInfo info)
static bool IsDigit(int ch)