History

tccpp: allow "0x1e+1" in asm

grischka committed 10 years ago

Commit 5a23a721 parent 8afb8cc1 file · +13 −9Browse files

Unified · Split

tccpp.c+13−9
@@ -2633,21 +2633,26 @@ maybe_newline: · 2632 unmodified lines
26332633 case '0': case '1': case '2': case '3':
26342634 case '4': case '5': case '6': case '7':
26352635 case '8': case '9':
2636− cstr_reset(&tokcstr);
2636+ t = c;
2637+ PEEKC(c, p);
26372638 /* after the first digit, accept digits, alpha, '.' or sign if
26382639 prefixed by 'eEpP' */
26392640 parse_num:
2641+ cstr_reset(&tokcstr);
26402642 for(;;) {
2641− t = c;
2642− cstr_ccat(&tokcstr, c);
2643− PEEKC(c, p);
2643+ cstr_ccat(&tokcstr, t);
26442644 if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))
26452645 || c == '.'
26462646 || ((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'))))
26502653 break;
2654+ t = c;
2655+ PEEKC(c, p);
26512656 }
26522657 /* We add a trailing '\0' to ease parsing */
26532658 cstr_ccat(&tokcstr, '\0');
@@ -2660,8 +2665,7 @@ maybe_newline: · 6 unmodified lines
26602665 /* special dot handling because it can also start a number */
26612666 PEEKC(c, p);
26622667 if (isnum(c)) {
2663− cstr_reset(&tokcstr);
2664− cstr_ccat(&tokcstr, '.');
2668+ t = '.';
26652669 goto parse_num;
26662670 } else if ((parse_flags & PARSE_FLAG_ASM_FILE)
26672671 && (isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))) {