aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
diff options
context:
space:
mode:
authorVlad Vissoultchev <wqweto@gmail.com>2016-03-14 18:14:52 +0200
committerVlad Vissoultchev <wqweto@gmail.com>2016-03-14 18:37:39 +0200
commit05ec6654a76bc3854a74f5d5d53ceb2ca1502cbe (patch)
treeb57aa619f2595f976c408c59f8a8d7ca98355daf /tccpp.c
parent17395ea5070bb05681f93ce7a8019c8c863a607b (diff)
downloadtinycc-05ec6654a76bc3854a74f5d5d53ceb2ca1502cbe.tar.gz
tinycc-05ec6654a76bc3854a74f5d5d53ceb2ca1502cbe.tar.bz2
Identifiers can start and/or contain '.' in PARSE_FLAG_ASM_FILE
Including labels, directives and section names
Diffstat (limited to 'tccpp.c')
-rw-r--r--tccpp.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/tccpp.c b/tccpp.c
index 97bd124..01f5b37 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -2550,15 +2550,12 @@ maybe_newline:
cstr_reset(&tokcstr);
cstr_ccat(&tokcstr, '.');
goto parse_num;
- } else if (c == '.') {
- PEEKC(c, p);
- if (c == '.') {
- p++;
- tok = TOK_DOTS;
- } else {
- *--p = '.'; /* may underflow into file->unget[] */
- tok = '.';
- }
+ } else if ((isidnum_table['.' - CH_EOF] & IS_ID) != 0) { /* asm mode */
+ *--p = c = '.';
+ goto parse_ident_fast;
+ } else if (c == '.' && p[1] == '.') {
+ p += 2;
+ tok = TOK_DOTS;
} else {
tok = '.';
}
@@ -3342,8 +3339,9 @@ ST_FUNC void preprocess_init(TCCState *s1)
s1->pack_stack[0] = 0;
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;
+ isidnum_table['.' - CH_EOF] = (parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0;
}
ST_FUNC void preprocess_new(void)