oxe+1 is parsed as 0xe +1 if (parse_flags & PARSE_FLAG_ASM_FILE) Helps to compile a code: __asm__("mov $0xe" "+1", "%eax\n")
Unified · Split
| @@ -2558,6 +2558,7 @@ static inline void next_nomacro1(void) · 2557 unmodified lines | |||
| 2558 | TokenSym *ts; | 2558 | TokenSym *ts; |
| 2559 | uint8_t *p, *p1; | 2559 | uint8_t *p, *p1; |
| 2560 | unsigned int h; | 2560 | unsigned int h; |
| 2561 | int is_dec; | ||
| 2561 | 2562 | ||
| 2562 | p = file->buf_ptr; | 2563 | p = file->buf_ptr; |
| 2563 | redo_no_start: | 2564 | redo_no_start: |
| @@ -2752,23 +2753,45 @@ maybe_newline: · 188 unmodified lines | |||
| 2752 | } | 2753 | } |
| 2753 | break; | 2754 | break; |
| 2754 | 2755 | ||
| 2755 | case '0': case '1': case '2': case '3': | 2756 | case '0': |
| 2757 | t = c; | ||
| 2758 | cstr_reset(&tokcstr); | ||
| 2759 | cstr_ccat(&tokcstr, c); | ||
| 2760 | PEEKC(c, p); | ||
| 2761 | is_dec = 1; | ||
| 2762 | if ((c == 'x') || (c == 'o') || (c == 'b')) | ||
| 2763 | is_dec = 0; | ||
| 2764 | goto parse_num; | ||
| 2765 | |||
| 2766 | case '1': case '2': case '3': | ||
| 2756 | case '4': case '5': case '6': case '7': | 2767 | case '4': case '5': case '6': case '7': |
| 2757 | case '8': case '9': | 2768 | case '8': case '9': |
| 2769 | is_dec = 1; | ||
| 2770 | t = c; | ||
| 2758 | cstr_reset(&tokcstr); | 2771 | cstr_reset(&tokcstr); |
| 2759 | /* after the first digit, accept digits, alpha, '.' or sign if | 2772 | cstr_ccat(&tokcstr, c); |
| 2760 | prefixed by 'eEpP' */ | 2773 | PEEKC(c, p); |
| 2761 | parse_num: | 2774 | parse_num: |
| 2762 | for(;;) { | 2775 | for(;;) { |
| 2776 | if (parse_flags & PARSE_FLAG_ASM_FILE) { | ||
| 2777 | if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) | ||
| 2778 | || (c == '.') | ||
| 2779 | || ((c == '+' || c == '-') | ||
| 2780 | && (((t == 'e' || t == 'E') && is_dec) || | ||
| 2781 | ((t == 'p' || t == 'P') && !is_dec))) | ||
| 2782 | )) | ||
| 2783 | break; | ||
| 2784 | } else | ||
| 2785 | if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) | ||
| 2786 | || c == '.' | ||
| 2787 | || ((c == '+' || c == '-') | ||
| 2788 | && (t == 'e' || t == 'E' || t == 'p' || t == 'P') | ||
| 2789 | ))) | ||
| 2790 | break; | ||
| 2791 | |||
| 2763 | t = c; | 2792 | t = c; |
| 2764 | cstr_ccat(&tokcstr, c); | 2793 | cstr_ccat(&tokcstr, c); |
| 2765 | PEEKC(c, p); | 2794 | PEEKC(c, p); |
| 2766 | if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) | ||
| 2767 | || c == '.' | ||
| 2768 | || ((c == '+' || c == '-') | ||
| 2769 | && (t == 'e' || t == 'E' || t == 'p' || t == 'P') | ||
| 2770 | ))) | ||
| 2771 | break; | ||
| 2772 | } | 2795 | } |
| 2773 | /* We add a trailing '\0' to ease parsing */ | 2796 | /* We add a trailing '\0' to ease parsing */ |
| 2774 | cstr_ccat(&tokcstr, '\0'); | 2797 | cstr_ccat(&tokcstr, '\0'); |
| @@ -2782,6 +2805,8 @@ maybe_newline: · 7 unmodified lines | |||
| 2782 | /* special dot handling because it can also start a number */ | 2805 | /* special dot handling because it can also start a number */ |
| 2783 | PEEKC(c, p); | 2806 | PEEKC(c, p); |
| 2784 | if (isnum(c)) { | 2807 | if (isnum(c)) { |
| 2808 | t = '.'; | ||
| 2809 | is_dec = 1; | ||
| 2785 | cstr_reset(&tokcstr); | 2810 | cstr_reset(&tokcstr); |
| 2786 | cstr_ccat(&tokcstr, '.'); | 2811 | cstr_ccat(&tokcstr, '.'); |
| 2787 | goto parse_num; | 2812 | goto parse_num; |