mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-10 06:50:10 +08:00
cleaning "Identifiers can start and/or contain"
more logical algorithm of the isidnum_table[] changing
This commit is contained in:
parent
983c40f58b
commit
effc7d9ed4
10
tccpp.c
10
tccpp.c
@ -1330,6 +1330,7 @@ ST_FUNC void parse_define(void)
|
|||||||
if (tok == '(') {
|
if (tok == '(') {
|
||||||
/* must be able to parse TOK_DOTS (in asm mode '.' can be part of identifier) */
|
/* must be able to parse TOK_DOTS (in asm mode '.' can be part of identifier) */
|
||||||
parse_flags &= ~PARSE_FLAG_ASM_FILE;
|
parse_flags &= ~PARSE_FLAG_ASM_FILE;
|
||||||
|
isidnum_table['.' - CH_EOF] = 0;
|
||||||
next_nomacro();
|
next_nomacro();
|
||||||
ps = &first;
|
ps = &first;
|
||||||
if (tok != ')') for (;;) {
|
if (tok != ')') for (;;) {
|
||||||
@ -1358,6 +1359,8 @@ ST_FUNC void parse_define(void)
|
|||||||
next_nomacro_spc();
|
next_nomacro_spc();
|
||||||
t = MACRO_FUNC;
|
t = MACRO_FUNC;
|
||||||
parse_flags |= (saved_parse_flags & PARSE_FLAG_ASM_FILE);
|
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);
|
tok_str_new(&str);
|
||||||
spc = 2;
|
spc = 2;
|
||||||
@ -2476,8 +2479,6 @@ maybe_newline:
|
|||||||
p1 = p;
|
p1 = p;
|
||||||
h = TOK_HASH_INIT;
|
h = TOK_HASH_INIT;
|
||||||
h = TOK_HASH_FUNC(h, c);
|
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))
|
while (c = *++p, isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))
|
||||||
h = TOK_HASH_FUNC(h, c);
|
h = TOK_HASH_FUNC(h, c);
|
||||||
if (c != '\\') {
|
if (c != '\\') {
|
||||||
@ -2532,8 +2533,6 @@ maybe_newline:
|
|||||||
} else {
|
} else {
|
||||||
cstr_reset(&tokcstr);
|
cstr_reset(&tokcstr);
|
||||||
cstr_ccat(&tokcstr, 'L');
|
cstr_ccat(&tokcstr, 'L');
|
||||||
isidnum_table['.' - CH_EOF] =
|
|
||||||
(parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0;
|
|
||||||
goto parse_ident_slow;
|
goto parse_ident_slow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3369,6 +3368,9 @@ ST_FUNC void preprocess_init(TCCState *s1)
|
|||||||
|
|
||||||
isidnum_table['$' - CH_EOF] =
|
isidnum_table['$' - CH_EOF] =
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user