diff src/lex.l @ 3598:0ae310231c46

[project @ 2000-02-19 08:07:08 by jwe]
author jwe
date Sat, 19 Feb 2000 08:07:10 +0000
parents 7576a76f6d7b
children 0689afb1d001
line wrap: on
line diff
--- a/src/lex.l	Sat Feb 12 02:24:46 2000 +0000
+++ b/src/lex.l	Sat Feb 19 08:07:10 2000 +0000
@@ -1540,26 +1540,30 @@
 static void
 handle_number (void)
 {
-  char *tmp = strsave (yytext);
-
-  char *idx = strpbrk (tmp, "Dd");
-
-  if (idx)
-    *idx = 'e';
-
   double value = 0.0;
   int nread = 0;
 
-  if (looks_like_hex (tmp, strlen (tmp)))
+  if (looks_like_hex (yytext, strlen (yytext)))
     {
       unsigned long ival;
-      nread = sscanf (tmp, "%lx", &ival);
+
+      nread = sscanf (yytext, "%lx", &ival);
+
       value = static_cast<double> (ival);
     }
   else
-    nread = sscanf (tmp, "%lf", &value);
+    {
+      char *tmp = strsave (yytext);
+
+      char *idx = strpbrk (tmp, "Dd");
 
-  delete [] tmp;
+      if (idx)
+	*idx = 'e';
+
+      nread = sscanf (tmp, "%lf", &value);
+
+      delete [] tmp;
+    }
 
   // If yytext doesn't contain a valid number, we are in deep doo doo.