fixed syntax

This commit is contained in:
anon 2023-08-19 20:54:59 +02:00
parent 256c1b0279
commit 1ea04a4b27

View File

@ -41,6 +41,7 @@ This is how you append a display mode that render_string() will search based on
REGION REGION
} token_type_t; } token_type_t;
These are the valid type of distinct token types. These are the valid type of distinct token types.
KEYSYMBOL - a string which is contextless, the surounding text is ignored KEYSYMBOL - a string which is contextless, the surounding text is ignored
"mysymbol" will match inside all of these: "mysymbol" will match inside all of these:
"something mysymbol something" "something mysymbol something"
@ -50,11 +51,17 @@ These are the valid type of distinct token types.
KEYWORD - a string which is recognized when surounded by word bundaries such as ' ' or '\t' KEYWORD - a string which is recognized when surounded by word bundaries such as ' ' or '\t'
MATCH - a Vim style regular expression to be recognized MATCH - a Vim style regular expression to be recognized
REGION - a Vim style regular expression where the starting and ending patters are to be distinguished from the contents REGION - a Vim style regular expression where the starting and ending patters are to be distinguished from the contents
The universal way to add a new pattern to be recognized is with: The universal way to add a new pattern to be recognized is with:
token * new_token(const char * const syntax, const token_type_t t, const hl_group_t * const g); token * new_token(const char * const syntax, const token_type_t t, const hl_group_t * const g);
This wraps one of the following: This wraps one of the following:
// ?! // ?!
There are also convinience functions: There are also convinience functions:
// NOTE: the return value is the number tokens successfully inserted // NOTE: the return value is the number tokens successfully inserted
int new_keyword_tokens(const char * const * words, hl_group_t * const g); int new_keyword_tokens(const char * const * words, hl_group_t * const g);
int new_syntax_character_tokens(const char * const chars, hl_group_t * const g); int new_syntax_character_tokens(const char * const chars, hl_group_t * const g);
@ -63,10 +70,13 @@ There are also convinience functions:
hl can parse a small subset of VimScript: the few instructions related to highlighing, and it ignores everything else. hl can parse a small subset of VimScript: the few instructions related to highlighing, and it ignores everything else.
All Vim highlighing scripts should be valid hl scripts. All Vim highlighing scripts should be valid hl scripts.
The instrunctions in particular are: The instrunctions in particular are:
sy[ntax] keyword <hl_group> <word>+ sy[ntax] keyword <hl_group> <word>+
sy[ntax] match <hl_group> <regex> sy[ntax] match <hl_group> <regex>
sy[ntax] region <hl_group> start=<string|match> end=<string|match> sy[ntax] region <hl_group> start=<string|match> end=<string|match>
hi[ghtlight] link <from_group> <to_group> hi[ghtlight] link <from_group> <to_group>
hi[ghtlight] def <group> <display_t>=<data>+ hi[ghtlight] def <group> <display_t>=<data>+
Additionally hl recognizes: Additionally hl recognizes:
syn[ntax] keysymbol <char>+ syn[ntax] keysymbol <char>+