From a6d850a959d3a00eec4d065a4550e6e55f595376 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Tue, 13 May 1997 17:49:54 +0200
Subject: [PATCH] Now handles exponent in float constants.

Rev: src/lex.c:1.22
---
 src/lex.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/lex.c b/src/lex.c
index e6dcfed798..1e60f72539 100644
--- a/src/lex.c
+++ b/src/lex.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: lex.c,v 1.21 1997/04/16 03:09:12 hubbe Exp $");
+RCSID("$Id: lex.c,v 1.22 1997/05/13 15:49:54 grubba Exp $");
 #include "language.h"
 #include "array.h"
 #include "lex.h"
@@ -1477,9 +1477,9 @@ static int do_lex2(int literal, YYSTYPE *yylval)
     case '1': case '2': case '3': case '4':
     case '5': case '6': case '7': case '8': case '9':
     {
-      char *p;
+      char *p, *p2;
       UNGETC(c);
-      READBUF(isdigit(C) || C=='.');
+      READBUF(isdigit(C) || C=='.' || C=='e' || C=='E');
 
       p=STRCHR(buf,'.');
       
@@ -1501,6 +1501,19 @@ static int do_lex2(int literal, YYSTYPE *yylval)
 	  return F_FLOAT;
 	}
       }
+      p = STRCHR(buf, 'e');
+      p2 = STRCHR(buf, 'E');
+      if (p || p2) {
+	if (p) {
+	  if (p2 && (p > p2)) {
+	    p = p2;
+	  }
+	} else {
+	  p = p2;
+	}
+	UNGETSTR(p, strlen(p));
+	*p = 0;
+      }
       if(buf[0]=='0')
 	yylval->number=STRTOL(buf,NULL,8);
       else
-- 
GitLab