* Copyright (c) 1982 Regents of the University of California
static char sccsid
[] = "@(#)asscan4.c 4.4 %G%";
#define NUMSIZE 128 /* how many characters long a number can be */
#define FLTCHAR(x) (INCHARSET((x),(DIGIT|SIGN|FLOATEXP|POINT)))
static char numbuf
[NUMSIZE
];
#define BACK(backval) intval = backval; goto stuffback;
int digit
; /* part of number being constructed */
reg
int intval
; /* number being constructed */
Ovf overflow
; /* overflow flag */
* Check if it is a local label by peeking ahead
case 'F': ch
= 'f'; goto floatnum
;
case 'D': ch
= 'd'; goto floatnum
;
case 'H': ch
= 'h'; goto floatnum
;
case 'G': ch
= 'g'; goto floatnum
;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8':
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8':
yylval
= ((ch
- '0') + 1);
yylval
= -((ch
- '0') + 1);
ungetc(ch1
); /* put back non zero */
* There is a character in ch that must be used to
* cons up the number; we can't ungetc it
if (INCHARSET(ch
, HEXLDIGIT
)){
if (INCHARSET(ch
, HEXUDIGIT
)){
* Build a negative number, then negate it
if(!INCHARSET(ch
, DIGIT
)){
if(!INCHARSET(ch
, (HEXLDIGIT
|HEXUDIGIT
)))
* See if the number is too large for our previous calculation
if (maxstrlg
== 11 && numbuf
[0] > 3)
yybignum
= as_atoi(numbuf
, radix
, &overflow
);
yybignum
= floatnumber(ch
);
if (cp == &numbuf[NUMSIZE]){ \
error |= scanint(sign, &cp); \
Bignum
floatnumber(fltradix
)
char *toolong
= "Floating number too long.";
"Floating 0%c conflicts with exponent %c; choose %c";
* This is not implemented yet:
* overflow is set on floating overflow.
if(INCHARSET(ch
, POINT
)){
if(INCHARSET(ch
, FLOATEXP
)){
yywarning(prologue
, fltradix
, ch
, fltradix
);
*cp
++ = 'e'; /* will be read by atof() */
*cp
++ = fltradix
; /* will be read by bigatof() */
if (error
|| fractOK
== 0){
yyerror("Badly formatted floating point number.");
case 'f': fltradix
= TYPF
; break;
case 'd': fltradix
= TYPD
; break;
case 'g': fltradix
= TYPG
; nGHnumbers
++; break;
case 'h': fltradix
= TYPH
; nGHnumbers
++; break;
* The overflow value is lost in the call to as_atof
return(as_atof(numbuf
, fltradix
, &overflow
));
* Scan an optionally signed integer, putting back the lookahead
* character when finished scanning.
int scanint(signOK
, dstcpp
)
while (INCHARSET(ch
, SIGN
)){
while (INCHARSET(ch
, DIGIT
)){