improve floating point literal handling.

Wed, 02 Jan 2002 10:17:24 +0000

author
eric
date
Wed, 02 Jan 2002 10:17:24 +0000
changeset 34
8d7bd2fa5db6
parent 33
44d823824a46
child 35
41804cc569ab

improve floating point literal handling.

scanner.l file | annotate | diff | revisions
     1.1 --- a/scanner.l	Tue Jan 01 10:18:33 2002 +0000
     1.2 +++ b/scanner.l	Wed Jan 02 10:17:24 2002 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 -$Id: scanner.l,v 1.14 2002/01/01 02:16:50 eric Exp $
     1.6 +$Id: scanner.l,v 1.15 2002/01/02 02:17:24 eric Exp $
     1.7  */
     1.8  
     1.9  %option case-insensitive
    1.10 @@ -29,8 +29,13 @@
    1.11  [\,;{}]		{ return (yytext [0]); }
    1.12  {dot}{dot}	{ LDBG(("elipsis\n")); return (ELIPSIS); }
    1.13  
    1.14 +  /* decimal integer */
    1.15  {digit}+	{ yylval.integer = atoi (yytext); LDBG(("integer %d\n", yylval.integer)); return (INTEGER); }
    1.16 -{digit}+\.{digit}+ { yylval.fp = atof (yytext); return (FLOAT); }
    1.17 +
    1.18 +  /* floating point number - tricky to make sure it doesn't grab an integer
    1.19 +     followed by an elipsis */
    1.20 +-?{digit}+\.{digit}+ { yylval.fp = atof (yytext); return (FLOAT); }
    1.21 +-?{digit}+\./[^.] { yylval.fp = atof (yytext); return (FLOAT); }
    1.22  
    1.23  a		{ yylval.size.width = 8.5;
    1.24  		  yylval.size.height = 11.0;