]> git.xolatile.top Git - public-libhl.git/commitdiff
Relocate syntax/
authorEmil <emilwilliams@tuta.io>
Mon, 28 Aug 2023 19:03:03 +0000 (13:03 -0600)
committerEmil <emilwilliams@tuta.io>
Mon, 28 Aug 2023 19:03:03 +0000 (13:03 -0600)
Makefile
include/syntax/c.h [new file with mode: 0644]
source/main.c
syntax/c.h [deleted file]

index 544c1af5d33bdaca1903ba472f64a5440bb3519e..816bb8c1aba4d2a7d30d7c160fcf87c5c614785b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 TARGET:=hl
 
 CFLAGS:=-std=c99
-CPPFLAGS:=-Isyntax -Iinclude -D_GNU_SOURCE -D_FORTIFY_SOURCE=2
+CPPFLAGS:=-Iinclude -D_GNU_SOURCE -D_FORTIFY_SOURCE=2
 
 DEBUG=1
 
diff --git a/include/syntax/c.h b/include/syntax/c.h
new file mode 100644 (file)
index 0000000..271ee5c
--- /dev/null
@@ -0,0 +1,21 @@
+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("+-&|.()[]{}", 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);
index 2b6ad6afcdad36a2823cb36402bd9d8d3203d71f..7ba4529ea81fc4df4e5cb50c9bc433a5070f5428 100644 (file)
@@ -40,7 +40,7 @@ int main(int      argc,
        // Highlight init
        terminal_hl_init();
        //
-       #include "c.h"
+       #include "syntax/c.h"
        //
 
        render_string(buffer, "cterm");
diff --git a/syntax/c.h b/syntax/c.h
deleted file mode 100644 (file)
index 271ee5c..0000000
+++ /dev/null
@@ -1,21 +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("+-&|.()[]{}", 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);