Mercurial > vim
comparison src/syntax.c @ 41:f529edb9bab3 v7.0025
updated for version 7.0025
author | vimboss |
---|---|
date | Mon, 27 Dec 2004 21:59:20 +0000 |
parents | 125e80798a85 |
children | 9322cb10d72e |
comparison
equal
deleted
inserted
replaced
40:f1d2a58883b9 | 41:f529edb9bab3 |
---|---|
1392 * length was less than SST_FIX_STATES. */ | 1392 * length was less than SST_FIX_STATES. */ |
1393 ga_init2(&sp->sst_union.sst_ga, (int)sizeof(bufstate_T), 1); | 1393 ga_init2(&sp->sst_union.sst_ga, (int)sizeof(bufstate_T), 1); |
1394 if (ga_grow(&sp->sst_union.sst_ga, current_state.ga_len) == FAIL) | 1394 if (ga_grow(&sp->sst_union.sst_ga, current_state.ga_len) == FAIL) |
1395 sp->sst_stacksize = 0; | 1395 sp->sst_stacksize = 0; |
1396 else | 1396 else |
1397 { | |
1398 sp->sst_union.sst_ga.ga_len = current_state.ga_len; | 1397 sp->sst_union.sst_ga.ga_len = current_state.ga_len; |
1399 sp->sst_union.sst_ga.ga_room -= current_state.ga_len; | |
1400 } | |
1401 bp = SYN_STATE_P(&(sp->sst_union.sst_ga)); | 1398 bp = SYN_STATE_P(&(sp->sst_union.sst_ga)); |
1402 } | 1399 } |
1403 else | 1400 else |
1404 bp = sp->sst_union.sst_stack; | 1401 bp = sp->sst_union.sst_stack; |
1405 for (i = 0; i < sp->sst_stacksize; ++i) | 1402 for (i = 0; i < sp->sst_stacksize; ++i) |
1452 else | 1449 else |
1453 CUR_STATE(i).si_next_list = NULL; | 1450 CUR_STATE(i).si_next_list = NULL; |
1454 update_si_attr(i); | 1451 update_si_attr(i); |
1455 } | 1452 } |
1456 current_state.ga_len = from->sst_stacksize; | 1453 current_state.ga_len = from->sst_stacksize; |
1457 current_state.ga_room -= current_state.ga_len; | |
1458 } | 1454 } |
1459 current_next_list = from->sst_next_list; | 1455 current_next_list = from->sst_next_list; |
1460 current_next_flags = from->sst_next_flags; | 1456 current_next_flags = from->sst_next_flags; |
1461 current_lnum = from->sst_lnum; | 1457 current_lnum = from->sst_lnum; |
1462 } | 1458 } |
2087 * endless loop). */ | 2083 * endless loop). */ |
2088 if (ga_grow(&zero_width_next_ga, 1) == OK) | 2084 if (ga_grow(&zero_width_next_ga, 1) == OK) |
2089 { | 2085 { |
2090 ((int *)(zero_width_next_ga.ga_data)) | 2086 ((int *)(zero_width_next_ga.ga_data)) |
2091 [zero_width_next_ga.ga_len++] = next_match_idx; | 2087 [zero_width_next_ga.ga_len++] = next_match_idx; |
2092 --zero_width_next_ga.ga_room; | |
2093 } | 2088 } |
2094 next_match_idx = -1; | 2089 next_match_idx = -1; |
2095 } | 2090 } |
2096 else | 2091 else |
2097 cur_si = push_next_match(cur_si); | 2092 cur_si = push_next_match(cur_si); |
2577 if (ga_grow(¤t_state, 1) == FAIL) | 2572 if (ga_grow(¤t_state, 1) == FAIL) |
2578 return FAIL; | 2573 return FAIL; |
2579 vim_memset(&CUR_STATE(current_state.ga_len), 0, sizeof(stateitem_T)); | 2574 vim_memset(&CUR_STATE(current_state.ga_len), 0, sizeof(stateitem_T)); |
2580 CUR_STATE(current_state.ga_len).si_idx = idx; | 2575 CUR_STATE(current_state.ga_len).si_idx = idx; |
2581 ++current_state.ga_len; | 2576 ++current_state.ga_len; |
2582 --current_state.ga_room; | |
2583 return OK; | 2577 return OK; |
2584 } | 2578 } |
2585 | 2579 |
2586 /* | 2580 /* |
2587 * Remove a state from the current_state stack. | 2581 * Remove a state from the current_state stack. |
2591 { | 2585 { |
2592 if (current_state.ga_len) | 2586 if (current_state.ga_len) |
2593 { | 2587 { |
2594 unref_extmatch(CUR_STATE(current_state.ga_len - 1).si_extmatch); | 2588 unref_extmatch(CUR_STATE(current_state.ga_len - 1).si_extmatch); |
2595 --current_state.ga_len; | 2589 --current_state.ga_len; |
2596 ++current_state.ga_room; | |
2597 } | 2590 } |
2598 /* after the end of a pattern, try matching a keyword or pattern */ | 2591 /* after the end of a pattern, try matching a keyword or pattern */ |
2599 next_match_idx = -1; | 2592 next_match_idx = -1; |
2600 | 2593 |
2601 /* if first state with "keepend" is popped, reset keepend_level */ | 2594 /* if first state with "keepend" is popped, reset keepend_level */ |
3149 #endif | 3142 #endif |
3150 syn_clear_pattern(buf, idx); | 3143 syn_clear_pattern(buf, idx); |
3151 mch_memmove(spp, spp + 1, | 3144 mch_memmove(spp, spp + 1, |
3152 sizeof(synpat_T) * (buf->b_syn_patterns.ga_len - idx - 1)); | 3145 sizeof(synpat_T) * (buf->b_syn_patterns.ga_len - idx - 1)); |
3153 --buf->b_syn_patterns.ga_len; | 3146 --buf->b_syn_patterns.ga_len; |
3154 --buf->b_syn_patterns.ga_room; | |
3155 } | 3147 } |
3156 | 3148 |
3157 /* | 3149 /* |
3158 * Clear and free one syntax pattern. When clearing all, must be called from | 3150 * Clear and free one syntax pattern. When clearing all, must be called from |
3159 * last to first! | 3151 * last to first! |
4497 SYN_ITEMS(curbuf)[idx].sp_syn.cont_in_list = cont_in_list; | 4489 SYN_ITEMS(curbuf)[idx].sp_syn.cont_in_list = cont_in_list; |
4498 if (cont_in_list != NULL) | 4490 if (cont_in_list != NULL) |
4499 curbuf->b_syn_containedin = TRUE; | 4491 curbuf->b_syn_containedin = TRUE; |
4500 SYN_ITEMS(curbuf)[idx].sp_next_list = next_list; | 4492 SYN_ITEMS(curbuf)[idx].sp_next_list = next_list; |
4501 ++curbuf->b_syn_patterns.ga_len; | 4493 ++curbuf->b_syn_patterns.ga_len; |
4502 --curbuf->b_syn_patterns.ga_room; | |
4503 | 4494 |
4504 /* remember that we found a match for syncing on */ | 4495 /* remember that we found a match for syncing on */ |
4505 if (flags & (HL_SYNC_HERE|HL_SYNC_THERE)) | 4496 if (flags & (HL_SYNC_HERE|HL_SYNC_THERE)) |
4506 curbuf->b_syn_sync_flags |= SF_MATCH; | 4497 curbuf->b_syn_sync_flags |= SF_MATCH; |
4507 #ifdef FEAT_FOLDING | 4498 #ifdef FEAT_FOLDING |
4740 if (cont_in_list != NULL) | 4731 if (cont_in_list != NULL) |
4741 curbuf->b_syn_containedin = TRUE; | 4732 curbuf->b_syn_containedin = TRUE; |
4742 SYN_ITEMS(curbuf)[idx].sp_next_list = next_list; | 4733 SYN_ITEMS(curbuf)[idx].sp_next_list = next_list; |
4743 } | 4734 } |
4744 ++curbuf->b_syn_patterns.ga_len; | 4735 ++curbuf->b_syn_patterns.ga_len; |
4745 --curbuf->b_syn_patterns.ga_room; | |
4746 ++idx; | 4736 ++idx; |
4747 #ifdef FEAT_FOLDING | 4737 #ifdef FEAT_FOLDING |
4748 if (flags & HL_FOLD) | 4738 if (flags & HL_FOLD) |
4749 ++curbuf->b_syn_folditems; | 4739 ++curbuf->b_syn_folditems; |
4750 #endif | 4740 #endif |
5031 vim_memset(&(SYN_CLSTR(curbuf)[len]), 0, sizeof(struct syn_cluster)); | 5021 vim_memset(&(SYN_CLSTR(curbuf)[len]), 0, sizeof(struct syn_cluster)); |
5032 SYN_CLSTR(curbuf)[len].scl_name = name; | 5022 SYN_CLSTR(curbuf)[len].scl_name = name; |
5033 SYN_CLSTR(curbuf)[len].scl_name_u = vim_strsave_up(name); | 5023 SYN_CLSTR(curbuf)[len].scl_name_u = vim_strsave_up(name); |
5034 SYN_CLSTR(curbuf)[len].scl_list = NULL; | 5024 SYN_CLSTR(curbuf)[len].scl_list = NULL; |
5035 ++curbuf->b_syn_clusters.ga_len; | 5025 ++curbuf->b_syn_clusters.ga_len; |
5036 --curbuf->b_syn_clusters.ga_room; | |
5037 | 5026 |
5038 return len + SYNID_CLUSTER; | 5027 return len + SYNID_CLUSTER; |
5039 } | 5028 } |
5040 | 5029 |
5041 /* | 5030 /* |
7465 { | 7454 { |
7466 gap->ae_u.cterm.fg_color = aep->ae_u.cterm.fg_color; | 7455 gap->ae_u.cterm.fg_color = aep->ae_u.cterm.fg_color; |
7467 gap->ae_u.cterm.bg_color = aep->ae_u.cterm.bg_color; | 7456 gap->ae_u.cterm.bg_color = aep->ae_u.cterm.bg_color; |
7468 } | 7457 } |
7469 ++table->ga_len; | 7458 ++table->ga_len; |
7470 --table->ga_room; | |
7471 return (table->ga_len - 1 + ATTR_OFF); | 7459 return (table->ga_len - 1 + ATTR_OFF); |
7472 } | 7460 } |
7473 | 7461 |
7474 #ifdef FEAT_GUI | 7462 #ifdef FEAT_GUI |
7475 | 7463 |
7970 #ifdef FEAT_GUI | 7958 #ifdef FEAT_GUI |
7971 HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR; | 7959 HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR; |
7972 HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR; | 7960 HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR; |
7973 #endif | 7961 #endif |
7974 ++highlight_ga.ga_len; | 7962 ++highlight_ga.ga_len; |
7975 --highlight_ga.ga_room; | |
7976 | 7963 |
7977 return highlight_ga.ga_len; /* ID is index plus one */ | 7964 return highlight_ga.ga_len; /* ID is index plus one */ |
7978 } | 7965 } |
7979 | 7966 |
7980 /* | 7967 /* |
7983 */ | 7970 */ |
7984 static void | 7971 static void |
7985 syn_unadd_group() | 7972 syn_unadd_group() |
7986 { | 7973 { |
7987 --highlight_ga.ga_len; | 7974 --highlight_ga.ga_len; |
7988 ++highlight_ga.ga_room; | |
7989 vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name); | 7975 vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name); |
7990 vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name_u); | 7976 vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name_u); |
7991 } | 7977 } |
7992 | 7978 |
7993 /* | 7979 /* |