Unified · Split
| @@ -2633,21 +2633,26 @@ maybe_newline: · 2632 unmodified lines | ||
| 2633 | 2633 | case '0': case '1': case '2': case '3': |
| 2634 | 2634 | case '4': case '5': case '6': case '7': |
| 2635 | 2635 | case '8': case '9': |
| 2636 | − cstr_reset(&tokcstr); | |
| 2636 | + t = c; | |
| 2637 | + PEEKC(c, p); | |
| 2637 | 2638 | /* after the first digit, accept digits, alpha, '.' or sign if |
| 2638 | 2639 | prefixed by 'eEpP' */ |
| 2639 | 2640 | parse_num: |
| 2641 | + cstr_reset(&tokcstr); | |
| 2640 | 2642 | for(;;) { |
| 2641 | − t = c; | |
| 2642 | − cstr_ccat(&tokcstr, c); | |
| 2643 | − PEEKC(c, p); | |
| 2643 | + cstr_ccat(&tokcstr, t); | |
| 2644 | 2644 | if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) |
| 2645 | 2645 | || c == '.' |
| 2646 | 2646 | || ((c == '+' || c == '-') |
| 2647 | − && (t == 'e' || t == 'E' || t == 'p' || t == 'P') | |
| 2648 | − && !(parse_flags & PARSE_FLAG_ASM_FILE) | |
| 2649 | − ))) | |
| 2647 | + && (((t == 'e' || t == 'E') | |
| 2648 | + && !(parse_flags & PARSE_FLAG_ASM_FILE | |
| 2649 | + /* 0xe+1 is 3 tokens in asm */ | |
| 2650 | + && ((char*)tokcstr.data)[0] == '0' | |
| 2651 | + && toup(((char*)tokcstr.data)[1]) == 'X')) | |
| 2652 | + || t == 'p' || t == 'P')))) | |
| 2650 | 2653 | break; |
| 2654 | + t = c; | |
| 2655 | + PEEKC(c, p); | |
| 2651 | 2656 | } |
| 2652 | 2657 | /* We add a trailing '\0' to ease parsing */ |
| 2653 | 2658 | cstr_ccat(&tokcstr, '\0'); |
| @@ -2660,8 +2665,7 @@ maybe_newline: · 6 unmodified lines | ||
| 2660 | 2665 | /* special dot handling because it can also start a number */ |
| 2661 | 2666 | PEEKC(c, p); |
| 2662 | 2667 | if (isnum(c)) { |
| 2663 | − cstr_reset(&tokcstr); | |
| 2664 | − cstr_ccat(&tokcstr, '.'); | |
| 2668 | + t = '.'; | |
| 2665 | 2669 | goto parse_num; |
| 2666 | 2670 | } else if ((parse_flags & PARSE_FLAG_ASM_FILE) |
| 2667 | 2671 | && (isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))) { |