2004-04-20 Juraj Skripsky <juraj@hotfeet.ch>
authorJuraj Skripsky <js@hotfeet.ch>
Tue, 20 Apr 2004 14:12:07 +0000 (14:12 -0000)
committerJuraj Skripsky <js@hotfeet.ch>
Tue, 20 Apr 2004 14:12:07 +0000 (14:12 -0000)
* Tokenizer.cs (ReadNumber): Correctly consume decimal point
when reading numbers. Fixes bug #57251.

svn path=/trunk/mcs/; revision=25726

mcs/class/System.Data/Mono.Data.SqlExpressions/ChangeLog
mcs/class/System.Data/Mono.Data.SqlExpressions/Tokenizer.cs

index 64eda1f4ac8fbf1d31a556068a2413ad034103cc..793dbff83955fa37d309dca370d664c20b10547d 100644 (file)
@@ -1,3 +1,8 @@
+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,
index e0e4783204ef6990b856e70a432dc3e39346cc81..2d9b64f4ee8c5cbe042b0f97308b97c28982cca8 100644 (file)
@@ -91,22 +91,17 @@ namespace Mono.Data.SqlExpressions {
                        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)