Browse Source

* Parser now only detects a number as float when the "." is followed by
a valid char. Else the input is handled as a normal integer, followed by
the dot as separate char. This allows to parse input such as
"0..9" - until now this would have lead to a float "0..9" which, of
course, couldn't be converted afterwards.

sg 24 years ago
parent
commit
9e81047a48
1 changed files with 10 additions and 2 deletions
  1. 10 2
      fcl/inc/parser.inc

+ 10 - 2
fcl/inc/parser.inc

@@ -231,7 +231,8 @@ begin
         Inc(P);
         Inc(P);
         while P^ in ['0'..'9'] do Inc(P);
         while P^ in ['0'..'9'] do Inc(P);
         Result := toInteger;
         Result := toInteger;
-        while P^ in ['0'..'9', '.', 'e', 'E', '+', '-'] do
+        while (P^ in ['0'..'9', '.', 'e', 'E', '+', '-']) and not
+	  ((P[0] = '.') and not (P[1] in ['0'..'9', 'e', 'E'])) do
         begin
         begin
           Inc(P);
           Inc(P);
           Result := toFloat;
           Result := toFloat;
@@ -307,7 +308,14 @@ begin
 end;
 end;
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2000-07-13 11:32:59  michael
+  Revision 1.3  2001-11-08 11:12:57  sg
+  * Parser now only detects a number as float when the "." is followed by
+    a valid char. Else the input is handled as a normal integer, followed by
+    the dot as separate char. This allows to parse input such as
+    "0..9" - until now this would have lead to a float "0..9" which, of
+    course, couldn't be converted afterwards.
+
+  Revision 1.2  2000/07/13 11:32:59  michael
   + removed logs
   + removed logs
  
  
 }
 }