summaryrefslogtreecommitdiff
path: root/syntax.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-27 14:48:26 -0500
committerpommicket <pommicket@gmail.com>2022-12-27 14:48:26 -0500
commit6912e5c194ef28d3d567ccdf0ee77f30219d9e17 (patch)
tree435ed36af14a1b833a035349d312acdb1725ff08 /syntax.c
parentc9907c20599728286e73115d11b46b169d10e1a3 (diff)
nicer keyword system
Diffstat (limited to 'syntax.c')
-rw-r--r--syntax.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/syntax.c b/syntax.c
index 18bc076..a8ce4d4 100644
--- a/syntax.c
+++ b/syntax.c
@@ -118,14 +118,15 @@ bool syntax_is_opening_bracket(Language lang, char32_t c) {
}
// lookup the given string in the keywords table
-static Keyword const *syntax_keyword_lookup(Keyword const *const *all_keywords, size_t n_all_keywords, char32_t const *str, size_t len) {
+static Keyword const *syntax_keyword_lookup(const KeywordList *all_keywords, size_t n_all_keywords, char32_t const *str, size_t len) {
if (!len) return NULL;
if (str[0] >= n_all_keywords) return NULL;
- Keyword const *keywords = all_keywords[str[0]];
-
+ const KeywordList *list = &all_keywords[str[0]];
+ const Keyword *keywords = list->keywords;
+ size_t nkeywords = list->len;
if (keywords) {
- for (size_t k = 0; keywords[k].str; ++k) {
+ for (size_t k = 0; k < nkeywords; ++k) {
if (syntax_keyword_matches(str, len, keywords[k].str)) {
return &keywords[k];
}