Identifiers can start and/or contain '.' in PARSE_FLAG_ASM_FILE

Including labels, directives and section names
This commit is contained in:
Vlad Vissoultchev 2016-03-14 18:14:52 +02:00
parent 17395ea507
commit 05ec6654a7

18
tccpp.c
View File

@ -2550,15 +2550,12 @@ maybe_newline:
cstr_reset(&tokcstr); cstr_reset(&tokcstr);
cstr_ccat(&tokcstr, '.'); cstr_ccat(&tokcstr, '.');
goto parse_num; goto parse_num;
} else if (c == '.') { } else if ((isidnum_table['.' - CH_EOF] & IS_ID) != 0) { /* asm mode */
PEEKC(c, p); *--p = c = '.';
if (c == '.') { goto parse_ident_fast;
p++; } else if (c == '.' && p[1] == '.') {
tok = TOK_DOTS; p += 2;
} else { tok = TOK_DOTS;
*--p = '.'; /* may underflow into file->unget[] */
tok = '.';
}
} else { } else {
tok = '.'; tok = '.';
} }
@ -3342,8 +3339,9 @@ ST_FUNC void preprocess_init(TCCState *s1)
s1->pack_stack[0] = 0; s1->pack_stack[0] = 0;
s1->pack_stack_ptr = s1->pack_stack; s1->pack_stack_ptr = s1->pack_stack;
isidnum_table['$' - CH_EOF] = isidnum_table['$' - CH_EOF] = (parse_flags & PARSE_FLAG_ASM_FILE) ||
tcc_state->dollars_in_identifiers ? IS_ID : 0; tcc_state->dollars_in_identifiers ? IS_ID : 0;
isidnum_table['.' - CH_EOF] = (parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0;
} }
ST_FUNC void preprocess_new(void) ST_FUNC void preprocess_new(void)