Convenience functions for character classes, highlighting and completion. More...
Functions | |
long | ic_prev_char (const char *s, long pos) |
Convenience: return the position of a previous code point in a UTF-8 string s from postion pos . More... | |
long | ic_next_char (const char *s, long pos) |
Convenience: return the position of the next code point in a UTF-8 string s from postion pos . More... | |
bool | ic_starts_with (const char *s, const char *prefix) |
Convenience: does a string s starts with a given prefix ? More... | |
bool | ic_istarts_with (const char *s, const char *prefix) |
Convenience: does a string s starts with a given prefix ignoring (ascii) case? More... | |
bool | ic_char_is_white (const char *s, long len) |
Convenience: character class for whitespace [ \t\r\n] . More... | |
bool | ic_char_is_nonwhite (const char *s, long len) |
Convenience: character class for non-whitespace [^ \t\r\n] . More... | |
bool | ic_char_is_separator (const char *s, long len) |
Convenience: character class for separators. More... | |
bool | ic_char_is_nonseparator (const char *s, long len) |
Convenience: character class for non-separators. More... | |
bool | ic_char_is_letter (const char *s, long len) |
Convenience: character class for letters ([A-Za-z] and any unicode > 0x80). More... | |
bool | ic_char_is_digit (const char *s, long len) |
Convenience: character class for digits ([0-9] ). More... | |
bool | ic_char_is_hexdigit (const char *s, long len) |
Convenience: character class for hexadecimal digits ([A-Fa-f0-9] ). More... | |
bool | ic_char_is_idletter (const char *s, long len) |
Convenience: character class for identifier letters ([A-Za-z0-9_-] and any unicode > 0x80). More... | |
bool | ic_char_is_filename_letter (const char *s, long len) |
Convenience: character class for filename letters (not in " \t\r\n`@$><=;|&\{\}\(\)\[\]]"). More... | |
long | ic_is_token (const char *s, long pos, ic_is_char_class_fun_t *is_token_char) |
Convenience: If this is a token start, return the length. Otherwise return 0. More... | |
long | ic_match_token (const char *s, long pos, ic_is_char_class_fun_t *is_token_char, const char *token) |
Convenience: Does this match the specified token? Ensures not to match prefixes or suffixes, and returns the length of the match (in bytes). More... | |
long | ic_match_any_token (const char *s, long pos, ic_is_char_class_fun_t *is_token_char, const char **tokens) |
Convenience: Do any of the specified tokens match? Ensures not to match prefixes or suffixes, and returns the length of the match (in bytes). More... | |
Convenience functions for character classes, highlighting and completion.
bool ic_char_is_digit | ( | const char * | s, |
long | len | ||
) |
Convenience: character class for digits ([0-9]
).
bool ic_char_is_filename_letter | ( | const char * | s, |
long | len | ||
) |
Convenience: character class for filename letters (not in " \t\r\n`@$><=;|&\{\}\(\)\[\]]").
bool ic_char_is_hexdigit | ( | const char * | s, |
long | len | ||
) |
Convenience: character class for hexadecimal digits ([A-Fa-f0-9]
).
bool ic_char_is_idletter | ( | const char * | s, |
long | len | ||
) |
Convenience: character class for identifier letters ([A-Za-z0-9_-]
and any unicode > 0x80).
bool ic_char_is_letter | ( | const char * | s, |
long | len | ||
) |
Convenience: character class for letters ([A-Za-z]
and any unicode > 0x80).
bool ic_char_is_nonseparator | ( | const char * | s, |
long | len | ||
) |
Convenience: character class for non-separators.
bool ic_char_is_nonwhite | ( | const char * | s, |
long | len | ||
) |
Convenience: character class for non-whitespace [^ \t\r\n]
.
bool ic_char_is_separator | ( | const char * | s, |
long | len | ||
) |
Convenience: character class for separators.
([ \t\r\n,.;:/\\(){}\[\]]
.) This is used for word boundaries in isocline.
bool ic_char_is_white | ( | const char * | s, |
long | len | ||
) |
Convenience: character class for whitespace [ \t\r\n]
.
long ic_is_token | ( | const char * | s, |
long | pos, | ||
ic_is_char_class_fun_t * | is_token_char | ||
) |
Convenience: If this is a token start, return the length. Otherwise return 0.
bool ic_istarts_with | ( | const char * | s, |
const char * | prefix | ||
) |
Convenience: does a string s
starts with a given prefix
ignoring (ascii) case?
long ic_match_any_token | ( | const char * | s, |
long | pos, | ||
ic_is_char_class_fun_t * | is_token_char, | ||
const char ** | tokens | ||
) |
Convenience: Do any of the specified tokens match? Ensures not to match prefixes or suffixes, and returns the length of the match (in bytes).
E.g. ic_match_any_token("function",0,&ic_char_is_letter,{"fun","func",NULL})
returns 0. while ic_match_any_token("func x",0,&ic_char_is_letter,{"fun","func",NULL})
returns 4.
long ic_match_token | ( | const char * | s, |
long | pos, | ||
ic_is_char_class_fun_t * | is_token_char, | ||
const char * | token | ||
) |
Convenience: Does this match the specified token? Ensures not to match prefixes or suffixes, and returns the length of the match (in bytes).
E.g. ic_match_token("function",0,&ic_char_is_letter,"fun")
returns 0. while ic_match_token("fun x",0,&ic_char_is_letter,"fun"})
returns 3.
long ic_next_char | ( | const char * | s, |
long | pos | ||
) |
Convenience: return the position of the next code point in a UTF-8 string s
from postion pos
.
Returns -1
if pos < 0
or pos >= strlen(s)
(or other errors).
long ic_prev_char | ( | const char * | s, |
long | pos | ||
) |
Convenience: return the position of a previous code point in a UTF-8 string s
from postion pos
.
Returns -1
if pos <= 0
or pos > strlen(s)
(or other errors).
bool ic_starts_with | ( | const char * | s, |
const char * | prefix | ||
) |
Convenience: does a string s
starts with a given prefix
?