diff --git a/tccpp.c b/tccpp.c index 7a74232..94f0b5f 100644 --- a/tccpp.c +++ b/tccpp.c @@ -2557,7 +2557,6 @@ static inline void next_nomacro1(void) TokenSym *ts; uint8_t *p, *p1; unsigned int h; - int is_dec; p = file->buf_ptr; redo_no_start: @@ -2752,45 +2751,23 @@ maybe_newline: } break; - case '0': - t = c; - cstr_reset(&tokcstr); - cstr_ccat(&tokcstr, c); - PEEKC(c, p); - is_dec = 1; - if ((c == 'x') || (c == 'o') || (c == 'b')) - is_dec = 0; - goto parse_num; - - case '1': case '2': case '3': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - is_dec = 1; - t = c; cstr_reset(&tokcstr); - cstr_ccat(&tokcstr, c); - PEEKC(c, p); + /* after the first digit, accept digits, alpha, '.' or sign if + prefixed by 'eEpP' */ parse_num: for(;;) { - if (parse_flags & PARSE_FLAG_ASM_FILE) { - if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) - || (c == '.') - || ((c == '+' || c == '-') - && (((t == 'e' || t == 'E') && is_dec) || - ((t == 'p' || t == 'P') && !is_dec))) - )) - break; - } else - if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) - || c == '.' - || ((c == '+' || c == '-') - && (t == 'e' || t == 'E' || t == 'p' || t == 'P') - ))) - break; - t = c; cstr_ccat(&tokcstr, c); PEEKC(c, p); + if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) + || c == '.' + || ((c == '+' || c == '-') + && (t == 'e' || t == 'E' || t == 'p' || t == 'P') + ))) + break; } /* We add a trailing '\0' to ease parsing */ cstr_ccat(&tokcstr, '\0'); @@ -2804,8 +2781,6 @@ maybe_newline: /* special dot handling because it can also start a number */ PEEKC(c, p); if (isnum(c)) { - t = '.'; - is_dec = 1; cstr_reset(&tokcstr); cstr_ccat(&tokcstr, '.'); goto parse_num;