From: anon Date: Thu, 24 Aug 2023 02:45:07 +0000 (+0200) Subject: more logical syntax header ordering X-Git-Url: https://git.xolatile.top/?a=commitdiff_plain;h=88a4be2d536751188a1812848212246a419cd425;p=public-libhl.git more logical syntax header ordering --- diff --git a/config.mk b/config.mk index 9397d4a..517dfe6 100644 --- a/config.mk +++ b/config.mk @@ -6,7 +6,7 @@ PREFIX:=/usr/bin CFLAGS:=-std=c99 -CPPFLAGS:=-D_GNU_SOURCE -D_FORTIFY_SOURCE=2 +CPPFLAGS:=-Isyntax/ -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 DEBUG=1 diff --git a/source/hl_c.inc b/source/hl_c.inc deleted file mode 100644 index 8ce987f..0000000 --- a/source/hl_c.inc +++ /dev/null @@ -1,17 +0,0 @@ -const char * c_keywords[] = { - "register", "volatile", "auto", "const", "static", "extern", "if", "else", - "do", "while", "for", "continue", "switch", "case", "default", "break", - "enum", "union", "struct", "typedef", "goto", "void", "return", "sizeof", - "char", "short", "int", "long", "signed", "unsigned", "float", "double", - NULL -}; - -const char * preprocessor_keywords[] = { - "#include", "#pragma", "#define", "#undef", "#ifdef", "#ifndef", "#elifdef", "#elifndef", - "#if", "#elif", "#else", "#endif", "#embed", "#line", "#error", "#warning", - NULL -}; - -new_char_tokens("&|()[]{}*,", symbol_hl); -new_keyword_tokens(c_keywords, keyword_hl); -new_keyword_tokens(preprocessor_keywords, preprocessor_hl); diff --git a/source/main.c b/source/main.c index 7a7390e..4946dc5 100644 --- a/source/main.c +++ b/source/main.c @@ -36,7 +36,7 @@ int main(int argc, // Highlight init terminal_hl_init(); // - #include "hl_c.inc" + #include "c.h" // render_string(buffer, "cterm"); putchar('\n'); diff --git a/syntax/c.h b/syntax/c.h new file mode 100644 index 0000000..8ce987f --- /dev/null +++ b/syntax/c.h @@ -0,0 +1,17 @@ +const char * c_keywords[] = { + "register", "volatile", "auto", "const", "static", "extern", "if", "else", + "do", "while", "for", "continue", "switch", "case", "default", "break", + "enum", "union", "struct", "typedef", "goto", "void", "return", "sizeof", + "char", "short", "int", "long", "signed", "unsigned", "float", "double", + NULL +}; + +const char * preprocessor_keywords[] = { + "#include", "#pragma", "#define", "#undef", "#ifdef", "#ifndef", "#elifdef", "#elifndef", + "#if", "#elif", "#else", "#endif", "#embed", "#line", "#error", "#warning", + NULL +}; + +new_char_tokens("&|()[]{}*,", symbol_hl); +new_keyword_tokens(c_keywords, keyword_hl); +new_keyword_tokens(preprocessor_keywords, preprocessor_hl);