From 9e81047a48ad33274f411dd4f83705724323a1f2 Mon Sep 17 00:00:00 2001 From: sg Date: Thu, 8 Nov 2001 11:12:57 +0000 Subject: [PATCH] * 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. --- fcl/inc/parser.inc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fcl/inc/parser.inc b/fcl/inc/parser.inc index 62eb8a2c02..7c5aa4e469 100644 --- a/fcl/inc/parser.inc +++ b/fcl/inc/parser.inc @@ -231,7 +231,8 @@ begin Inc(P); while P^ in ['0'..'9'] do Inc(P); 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 Inc(P); Result := toFloat; @@ -307,7 +308,14 @@ begin end; { $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 }