mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-04 08:20:12 +08:00
tccpp: allow "0x1e+1" in asm
This commit is contained in:
parent
8afb8ccba2
commit
5a23a72aed
22
tccpp.c
22
tccpp.c
@ -2633,21 +2633,26 @@ maybe_newline:
|
|||||||
case '0': case '1': case '2': case '3':
|
case '0': case '1': case '2': case '3':
|
||||||
case '4': case '5': case '6': case '7':
|
case '4': case '5': case '6': case '7':
|
||||||
case '8': case '9':
|
case '8': case '9':
|
||||||
cstr_reset(&tokcstr);
|
t = c;
|
||||||
|
PEEKC(c, p);
|
||||||
/* after the first digit, accept digits, alpha, '.' or sign if
|
/* after the first digit, accept digits, alpha, '.' or sign if
|
||||||
prefixed by 'eEpP' */
|
prefixed by 'eEpP' */
|
||||||
parse_num:
|
parse_num:
|
||||||
|
cstr_reset(&tokcstr);
|
||||||
for(;;) {
|
for(;;) {
|
||||||
t = c;
|
cstr_ccat(&tokcstr, t);
|
||||||
cstr_ccat(&tokcstr, c);
|
|
||||||
PEEKC(c, p);
|
|
||||||
if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))
|
if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))
|
||||||
|| c == '.'
|
|| c == '.'
|
||||||
|| ((c == '+' || c == '-')
|
|| ((c == '+' || c == '-')
|
||||||
&& (t == 'e' || t == 'E' || t == 'p' || t == 'P')
|
&& (((t == 'e' || t == 'E')
|
||||||
&& !(parse_flags & PARSE_FLAG_ASM_FILE)
|
&& !(parse_flags & PARSE_FLAG_ASM_FILE
|
||||||
)))
|
/* 0xe+1 is 3 tokens in asm */
|
||||||
|
&& ((char*)tokcstr.data)[0] == '0'
|
||||||
|
&& toup(((char*)tokcstr.data)[1]) == 'X'))
|
||||||
|
|| t == 'p' || t == 'P'))))
|
||||||
break;
|
break;
|
||||||
|
t = c;
|
||||||
|
PEEKC(c, p);
|
||||||
}
|
}
|
||||||
/* We add a trailing '\0' to ease parsing */
|
/* We add a trailing '\0' to ease parsing */
|
||||||
cstr_ccat(&tokcstr, '\0');
|
cstr_ccat(&tokcstr, '\0');
|
||||||
@ -2660,8 +2665,7 @@ maybe_newline:
|
|||||||
/* special dot handling because it can also start a number */
|
/* special dot handling because it can also start a number */
|
||||||
PEEKC(c, p);
|
PEEKC(c, p);
|
||||||
if (isnum(c)) {
|
if (isnum(c)) {
|
||||||
cstr_reset(&tokcstr);
|
t = '.';
|
||||||
cstr_ccat(&tokcstr, '.');
|
|
||||||
goto parse_num;
|
goto parse_num;
|
||||||
} else if ((parse_flags & PARSE_FLAG_ASM_FILE)
|
} else if ((parse_flags & PARSE_FLAG_ASM_FILE)
|
||||||
&& (isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))) {
|
&& (isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user