cleaning "Identifiers can start and/or contain"

more logical algorithm of the isidnum_table[] changing
master
seyko 2016-04-05 15:06:47 +03:00
parent 983c40f58b
commit effc7d9ed4
1 changed files with 6 additions and 4 deletions

10
tccpp.c
View File

@ -1330,6 +1330,7 @@ ST_FUNC void parse_define(void)
if (tok == '(') {
/* must be able to parse TOK_DOTS (in asm mode '.' can be part of identifier) */
parse_flags &= ~PARSE_FLAG_ASM_FILE;
isidnum_table['.' - CH_EOF] = 0;
next_nomacro();
ps = &first;
if (tok != ')') for (;;) {
@ -1358,6 +1359,8 @@ ST_FUNC void parse_define(void)
next_nomacro_spc();
t = MACRO_FUNC;
parse_flags |= (saved_parse_flags & PARSE_FLAG_ASM_FILE);
isidnum_table['.' - CH_EOF] =
(parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0;
}
tok_str_new(&str);
spc = 2;
@ -2476,8 +2479,6 @@ maybe_newline:
p1 = p;
h = TOK_HASH_INIT;
h = TOK_HASH_FUNC(h, c);
isidnum_table['.' - CH_EOF] =
(parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0;
while (c = *++p, isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))
h = TOK_HASH_FUNC(h, c);
if (c != '\\') {
@ -2532,8 +2533,6 @@ maybe_newline:
} else {
cstr_reset(&tokcstr);
cstr_ccat(&tokcstr, 'L');
isidnum_table['.' - CH_EOF] =
(parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0;
goto parse_ident_slow;
}
}
@ -3369,6 +3368,9 @@ ST_FUNC void preprocess_init(TCCState *s1)
isidnum_table['$' - CH_EOF] =
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)