syntax_defs.h
Go to the documentation of this file.
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 // Each keyword has one keyentry, which is linked in a hash list.
25 typedef struct keyentry keyentry_T;
26 
27 struct keyentry {
28  keyentry_T *ke_next; // next entry with identical "keyword[]"
29  struct sp_syn k_syn; // struct passed to in_id_list()
30  int16_t *next_list; // ID list for next match (if non-zero)
31  int flags;
32  int k_char; // conceal substitute character
33  char_u keyword[1]; // actually longer
34 };
35 
36 // Struct used to store one state of the state stack.
37 typedef struct buf_state {
38  int bs_idx; // index of pattern
39  int bs_flags; // flags for pattern
40  int bs_seqnr; // stores si_seqnr
41  int bs_cchar; // stores si_cchar
42  reg_extmatch_T *bs_extmatch; // external matches from start pattern
43 } bufstate_T;
44 
45 // syn_state contains the syntax state stack for the start of one line.
46 // Used by b_sst_array[].
47 struct syn_state {
48  synstate_T *sst_next; // next entry in used or free list
49  linenr_T sst_lnum; // line number for this state
50  union {
51  bufstate_T sst_stack[SST_FIX_STATES]; // short state stack
52  garray_T sst_ga; // growarray for long state stack
53  } sst_union;
54  int sst_next_flags; // flags for sst_next_list
55  int sst_stacksize; // number of states on the stack
56  int16_t *sst_next_list; // "nextgroup" list in this state
57  // (this is a copy, don't free it!
58  disptick_T sst_tick; // tick when last displayed
59  linenr_T sst_change_lnum; // when non-zero, change in this line
60  // may have made the state invalid
61 };
62 
63 #endif // NVIM_SYNTAX_DEFS_H
syn_state::sst_tick
disptick_T sst_tick
Definition: syntax_defs.h:58
buf_state::bs_flags
int bs_flags
Definition: syntax_defs.h:39
syn_state::sst_stack
bufstate_T sst_stack[SST_FIX_STATES]
Definition: syntax_defs.h:51
highlight_defs.h
buf_state::bs_extmatch
reg_extmatch_T * bs_extmatch
Definition: syntax_defs.h:42
syn_state::sst_next
synstate_T * sst_next
Definition: syntax_defs.h:48
keyentry::keyword
char_u keyword[1]
Definition: syntax_defs.h:33
disptick_T
uint64_t disptick_T
Definition: buffer_defs.h:101
reg_extmatch
Definition: regexp_defs.h:154
syn_state::sst_ga
garray_T sst_ga
Definition: syntax_defs.h:52
growarray
Definition: garray.h:12
sp_syn
Definition: syntax_defs.h:18
buf_state::bs_idx
int bs_idx
Definition: syntax_defs.h:38
bufstate_T
struct buf_state bufstate_T
keyentry
Definition: syntax_defs.h:27
keyentry::k_char
int k_char
Definition: syntax_defs.h:32
syn_state::sst_stacksize
int sst_stacksize
Definition: syntax_defs.h:55
buf_state
Definition: syntax_defs.h:37
buf_state::bs_cchar
int bs_cchar
Definition: syntax_defs.h:41
keyentry::ke_next
keyentry_T * ke_next
Definition: syntax_defs.h:28
syn_state::sst_change_lnum
linenr_T sst_change_lnum
Definition: syntax_defs.h:59
syn_state::sst_next_list
int16_t * sst_next_list
Definition: syntax_defs.h:56
regexp_defs.h
keyentry::k_syn
struct sp_syn k_syn
Definition: syntax_defs.h:29
syn_state
Definition: syntax_defs.h:47
keyentry::flags
int flags
Definition: syntax_defs.h:31
sp_syn::cont_in_list
int16_t * cont_in_list
Definition: syntax_defs.h:21
sp_syn::id
int16_t id
Definition: syntax_defs.h:20
sp_syn::inc_tag
int inc_tag
Definition: syntax_defs.h:19
syn_state::sst_lnum
linenr_T sst_lnum
Definition: syntax_defs.h:49
syn_state::sst_next_flags
int sst_next_flags
Definition: syntax_defs.h:54
char_u
unsigned char char_u
Definition: types.h:12
syn_state::sst_union
union syn_state::@75 sst_union
buffer_defs.h
keyentry::next_list
int16_t * next_list
Definition: syntax_defs.h:30
buf_state::bs_seqnr
int bs_seqnr
Definition: syntax_defs.h:40
linenr_T
long linenr_T
Line number type.
Definition: pos.h:5
SST_FIX_STATES
#define SST_FIX_STATES
Definition: syntax_defs.h:8