diff options
Diffstat (limited to 'syntax.c')
-rw-r--r-- | syntax.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -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) { |