From 314460f5750181fbed997dd484949c0b2c467867 Mon Sep 17 00:00:00 2001 From: anon Date: Wed, 20 Sep 2023 08:50:57 +0200 Subject: [PATCH] spec update --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f1e55e3..2ce54d8 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,21 @@ These functions are responsible for the library's "life time". ```C +#define HLPATH ~/.local/hl/:~/.vim/syntax/ +``` +Coma separated list of directories to be searched for syntax scripts. `#undef` to disable it entirely. + + +```C void render_string(const char * const string, const char * const mode); //XXX: rename ``` This function matches _string_ against all known highlighting rules and dispatches the appropriate callback depending on _mode_. ```C -#define HLPATH //?! +int token_fits(const token_t * const token, const char * const to, const int string_offset, const bool is_start_of_line, int * match_offset); ``` -Coma separated list of directories to be searched for syntax scripts. `#undef` to disable it entirely. +Fit a specific token against a string. `render_string()` uses this function internally. ```C @@ -82,7 +88,12 @@ There are also convinience functions: ```C // NOTE: the return value is the number tokens successfully inserted int new_keyword_tokens(const char * const * words, hl_group_t * const g); // _words_ must be NULL terminated -int new_syntax_character_tokens(const char * const chars, hl_group_t * const g); +int new_syntax_char_tokens(const char * const chars, hl_group_t * const g); +token_t * new_symbol_token(const char * const c, hl_group_t * const g); +int new_symbol_tokens(const char * const * symbols, hl_group_t * const g); +int new_char_tokens(const char * str, hl_group_t * const g); +token_t * new_keyword_token(const char * const word, hl_group_t * const g); +token_t * new_region_token(const char * start, const char * end, hl_group_t * g); ```