(yylex): When reading malformed floating point constant,

avoid printing error more than once, and avoid passing malformed
number to subsequent atof call.

From-SVN: r6201
This commit is contained in:
Jim Wilson 1993-12-10 12:41:43 -08:00
parent 6f2f831199
commit b408c3fd00
1 changed files with 7 additions and 1 deletions

View File

@ -1330,10 +1330,16 @@ yylex ()
{
if (base == 16)
error ("floating constant may not be in radix 16");
if (floatflag == AFTER_POINT)
if (floatflag == TOO_MANY_POINTS)
/* We have already emitted an error. Don't need another. */
;
else if (floatflag == AFTER_POINT)
{
error ("malformed floating constant");
floatflag = TOO_MANY_POINTS;
/* Avoid another error from atof by forcing all characters
from here on to be ignored. */
p[-1] = '\0';
}
else
floatflag = AFTER_POINT;