summaryrefslogtreecommitdiff
path: root/syntax.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-31 23:28:03 -0500
committerpommicket <pommicket@gmail.com>2022-12-31 23:28:03 -0500
commit57834dc0b116a62b806781ddec101bca4cda3abb (patch)
treee93e85b8cd2de7198cabe11abe1a779dbdf7b7cb /syntax.c
parent993d4f50d13c3a703d634d989af7dd8b96ae8c3d (diff)
start moving things around
Diffstat (limited to 'syntax.c')
-rw-r--r--syntax.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/syntax.c b/syntax.c
index 39a4255..1525e1d 100644
--- a/syntax.c
+++ b/syntax.c
@@ -3,6 +3,33 @@
// all characters that can appear in a number
#define SYNTAX_DIGITS "0123456789.xXoObBlLuUiIabcdefABCDEF_"
+typedef struct {
+ Language lang;
+ char const *name;
+} LanguageName;
+
+static const LanguageName language_names[] = {
+ {LANG_NONE, "None"},
+ {LANG_C, "C"},
+ {LANG_CPP, "C++"},
+ {LANG_RUST, "Rust"},
+ {LANG_PYTHON, "Python"},
+ {LANG_TEX, "Tex"},
+ {LANG_MARKDOWN, "Markdown"},
+ {LANG_HTML, "HTML"},
+ {LANG_CONFIG, "Config"},
+ {LANG_JAVASCRIPT, "JavaScript"},
+ {LANG_JAVA, "Java"},
+ {LANG_GO, "Go"},
+ {LANG_TED_CFG, "TedCfg"},
+ {LANG_TYPESCRIPT, "TypeScript"},
+ {LANG_JSON, "JSON"},
+ {LANG_XML, "XML"},
+ {LANG_GLSL, "GLSL"},
+};
+
+static_assert_if_possible(arr_count(language_names) == LANG_COUNT)
+
// returns the language this string is referring to, or LANG_NONE if it's invalid.
Language language_from_str(char const *str) {