more logical algorithm of the isidnum_table[] changing
Unified · Split
| @@ -1330,6 +1330,7 @@ ST_FUNC void parse_define(void) · 1329 unmodified lines | |||
| 1330 | if (tok == '(') { | 1330 | if (tok == '(') { |
| 1331 | /* must be able to parse TOK_DOTS (in asm mode '.' can be part of identifier) */ | 1331 | /* must be able to parse TOK_DOTS (in asm mode '.' can be part of identifier) */ |
| 1332 | parse_flags &= ~PARSE_FLAG_ASM_FILE; | 1332 | parse_flags &= ~PARSE_FLAG_ASM_FILE; |
| 1333 | isidnum_table['.' - CH_EOF] = 0; | ||
| 1333 | next_nomacro(); | 1334 | next_nomacro(); |
| 1334 | ps = &first; | 1335 | ps = &first; |
| 1335 | if (tok != ')') for (;;) { | 1336 | if (tok != ')') for (;;) { |
| @@ -1358,6 +1359,8 @@ ST_FUNC void parse_define(void) · 22 unmodified lines | |||
| 1358 | next_nomacro_spc(); | 1359 | next_nomacro_spc(); |
| 1359 | t = MACRO_FUNC; | 1360 | t = MACRO_FUNC; |
| 1360 | parse_flags |= (saved_parse_flags & PARSE_FLAG_ASM_FILE); | 1361 | parse_flags |= (saved_parse_flags & PARSE_FLAG_ASM_FILE); |
| 1362 | isidnum_table['.' - CH_EOF] = | ||
| 1363 | (parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0; | ||
| 1361 | } | 1364 | } |
| 1362 | tok_str_new(&str); | 1365 | tok_str_new(&str); |
| 1363 | spc = 2; | 1366 | spc = 2; |
| @@ -2476,8 +2479,6 @@ maybe_newline: · 1112 unmodified lines | |||
| 2476 | p1 = p; | 2479 | p1 = p; |
| 2477 | h = TOK_HASH_INIT; | 2480 | h = TOK_HASH_INIT; |
| 2478 | h = TOK_HASH_FUNC(h, c); | 2481 | h = TOK_HASH_FUNC(h, c); |
| 2479 | isidnum_table['.' - CH_EOF] = | ||
| 2480 | (parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0; | ||
| 2481 | while (c = *++p, isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) | 2482 | while (c = *++p, isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) |
| 2482 | h = TOK_HASH_FUNC(h, c); | 2483 | h = TOK_HASH_FUNC(h, c); |
| 2483 | if (c != '\\') { | 2484 | if (c != '\\') { |
| @@ -2532,8 +2533,6 @@ maybe_newline: · 48 unmodified lines | |||
| 2532 | } else { | 2533 | } else { |
| 2533 | cstr_reset(&tokcstr); | 2534 | cstr_reset(&tokcstr); |
| 2534 | cstr_ccat(&tokcstr, 'L'); | 2535 | cstr_ccat(&tokcstr, 'L'); |
| 2535 | isidnum_table['.' - CH_EOF] = | ||
| 2536 | (parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0; | ||
| 2537 | goto parse_ident_slow; | 2536 | goto parse_ident_slow; |
| 2538 | } | 2537 | } |
| 2539 | } | 2538 | } |
| @@ -3369,6 +3368,9 @@ ST_FUNC void preprocess_init(TCCState *s1) · 829 unmodified lines | |||
| 3369 | 3368 | ||
| 3370 | isidnum_table['$' - CH_EOF] = | 3369 | isidnum_table['$' - CH_EOF] = |
| 3371 | tcc_state->dollars_in_identifiers ? IS_ID : 0; | 3370 | tcc_state->dollars_in_identifiers ? IS_ID : 0; |
| 3371 | |||
| 3372 | isidnum_table['.' - CH_EOF] = | ||
| 3373 | (parse_flags & PARSE_FLAG_ASM_FILE) ? IS_ID : 0; | ||
| 3372 | } | 3374 | } |
| 3373 | 3375 | ||
| 3374 | ST_FUNC void preprocess_new(void) | 3376 | ST_FUNC void preprocess_new(void) |