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