* Tokenizer.cs (ReadNumber): Correctly consume decimal point
when reading numbers. Fixes bug #57251.
svn path=/trunk/mcs/; revision=25726
+2004-04-20 Juraj Skripsky <juraj@hotfeet.ch>
+
+ * Tokenizer.cs (ReadNumber): Correctly consume decimal point
+ when reading numbers. Fixes bug #57251.
+
2004-03-31 Juraj Skripsky <juraj@hotfeet.ch>
* Parser.jay, ColumnReference.cs, Comparison.cs, Functions.cs,
sb.Append (Current ());
char next;
- while (Char.IsDigit (next = Next ())) {
+ while (Char.IsDigit (next = Next ()) || next == '.') {
sb.Append (next);
MoveNext ();
}
- if (next == '.') {
- sb.Append (next);
- while (Char.IsDigit (next = Next ())) {
- sb.Append (next);
- MoveNext ();
- }
-
- return double.Parse (sb.ToString ());
- }
-
- return int.Parse (sb.ToString ());
+ string str = sb.ToString ();
+
+ if (str.IndexOf(".") == -1)
+ return int.Parse (str);
+ else
+ return double.Parse (str);
}
private char ProcessEscapes(char c)