bak
This commit is contained in:
14
include/hl.h
14
include/hl.h
@ -174,20 +174,18 @@ int new_char_tokens(const char * str,
|
||||
|
||||
token_t * new_keyword_token(const char * const word,
|
||||
hl_group_t * const g) {
|
||||
//char * new_word = strdup(word);
|
||||
//size_t word_length = strlen(word);
|
||||
//char * new_word = (char*)malloc(word_length + 4 + 1);
|
||||
size_t word_length = strlen(word);
|
||||
char * new_word = (char*)malloc(word_length + 4 + 1);
|
||||
|
||||
//memcpy(new_word, "\\<", 2);
|
||||
//memcpy(new_word + 2, word, word_length);
|
||||
//strcpy(new_word + 2 + word_length, "\\>");
|
||||
memcpy(new_word, "\\<", 2);
|
||||
memcpy(new_word + 2, word, word_length);
|
||||
strcpy(new_word + 2 + word_length, "\\>");
|
||||
|
||||
token_t * mt = (token_t*)malloc(sizeof(token_t));
|
||||
|
||||
mt->hl = g;
|
||||
mt->t = KEYWORD;
|
||||
//mt->syntax = regex_compile(new_word);
|
||||
mt->syntax = regex_compile(word);
|
||||
mt->syntax = regex_compile(new_word);
|
||||
|
||||
append_token(mt);
|
||||
|
||||
|
@ -12,10 +12,12 @@ const char * preprocessor_keywords[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
new_char_tokens("+-&|.()[]{}", operator_hl);
|
||||
new_keyword_tokens(c_keywords, control_hl);
|
||||
new_keyword_tokens(preprocessor_keywords, special_hl);
|
||||
new_region_token("/\\*", "\\*/", comment_hl);
|
||||
new_region_token("//", "\\n", comment_hl);
|
||||
new_region_token("\"", "\"", string_literal_hl);
|
||||
new_region_token("<", ">", string_literal_hl);
|
||||
//new_char_tokens("+-&|.()[]{}", operator_hl);
|
||||
//new_keyword_tokens(c_keywords, control_hl);
|
||||
//new_keyword_tokens(preprocessor_keywords, special_hl);
|
||||
//new_region_token("/\\*", "\\*/", comment_hl);
|
||||
//new_region_token("//", "\\n", comment_hl);
|
||||
//new_region_token("\"", "\"", string_literal_hl);
|
||||
//new_region_token("<", ">", string_literal_hl);
|
||||
//new_keyword_token("keyword", special_hl);
|
||||
new_keyword_token("while", operator_hl);
|
||||
|
Reference in New Issue
Block a user