1 | #ifndef NVIM_SYNTAX_DEFS_H |
2 | #define NVIM_SYNTAX_DEFS_H |
3 | |
4 | #include "nvim/highlight_defs.h" |
5 | |
6 | # define SST_MIN_ENTRIES 150 /* minimal size for state stack array */ |
7 | # define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */ |
8 | # define SST_FIX_STATES 7 /* size of sst_stack[]. */ |
9 | # define SST_DIST 16 /* normal distance between entries */ |
10 | # define SST_INVALID (synstate_T *)-1 /* invalid syn_state pointer */ |
11 | |
12 | typedef struct syn_state synstate_T; |
13 | |
14 | #include "nvim/buffer_defs.h" |
15 | #include "nvim/regexp_defs.h" |
16 | |
17 | /* struct passed to in_id_list() */ |
18 | struct sp_syn { |
19 | int inc_tag; // ":syn include" unique tag |
20 | int16_t id; // highlight group ID of item |
21 | int16_t *cont_in_list; // cont.in group IDs, if non-zero |
22 | }; |
23 | |
24 | /* |
25 | * Each keyword has one keyentry, which is linked in a hash list. |
26 | */ |
27 | typedef struct keyentry keyentry_T; |
28 | |
29 | struct keyentry { |
30 | keyentry_T *ke_next; // next entry with identical "keyword[]" |
31 | struct sp_syn k_syn; // struct passed to in_id_list() |
32 | int16_t *next_list; // ID list for next match (if non-zero) |
33 | int flags; |
34 | int k_char; // conceal substitute character |
35 | char_u keyword[1]; // actually longer |
36 | }; |
37 | |
38 | /* |
39 | * Struct used to store one state of the state stack. |
40 | */ |
41 | typedef struct buf_state { |
42 | int bs_idx; /* index of pattern */ |
43 | int bs_flags; /* flags for pattern */ |
44 | int bs_seqnr; /* stores si_seqnr */ |
45 | int bs_cchar; /* stores si_cchar */ |
46 | reg_extmatch_T *bs_extmatch; /* external matches from start pattern */ |
47 | } bufstate_T; |
48 | |
49 | /* |
50 | * syn_state contains the syntax state stack for the start of one line. |
51 | * Used by b_sst_array[]. |
52 | */ |
53 | struct syn_state { |
54 | synstate_T *sst_next; /* next entry in used or free list */ |
55 | linenr_T sst_lnum; /* line number for this state */ |
56 | union { |
57 | bufstate_T sst_stack[SST_FIX_STATES]; /* short state stack */ |
58 | garray_T sst_ga; /* growarray for long state stack */ |
59 | } sst_union; |
60 | int sst_next_flags; // flags for sst_next_list |
61 | int sst_stacksize; // number of states on the stack |
62 | int16_t *sst_next_list; // "nextgroup" list in this state |
63 | // (this is a copy, don't free it! |
64 | disptick_T sst_tick; // tick when last displayed |
65 | linenr_T sst_change_lnum; // when non-zero, change in this line |
66 | // may have made the state invalid |
67 | }; |
68 | |
69 | #endif // NVIM_SYNTAX_DEFS_H |
70 | |