-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeyword.c
More file actions
33 lines (29 loc) · 959 Bytes
/
keyword.c
File metadata and controls
33 lines (29 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "keyword.h"
/* Array of Gink language keywords */
static const char* gink_keywords[] = {
/* Control Flow & Logic */
"if", "else", "while", "for", "in", "break", "continue", "return", "true", "false",
/* Variables & Data Structures */
"auto", "const", "type", "struct",
/* Functions & Modifiers */
"fun", "inline",
/* Memory & Resource Management */
"unsafe", "ensure", "defer", "new",
/* Modules & Visibility */
"package", "import", "use", "as", "pub", "pri",
/* Built-in Primitive Types */
"i8", "u8", "i16", "u16", "i32", "u32", "i64", "u64", "i128", "u128", "int", "uint",
"f16", "f32", "f64", "f128", "float", "bool", "char", "string"
};
size_t keyword_count = sizeof(gink_keywords) / sizeof(gink_keywords[0]);
bool is_keyword(const char *val) {
for (size_t i = 0; i < keyword_count; i++) {
if (strcmp(val, gink_keywords[i]) == 0) {
return true;
}
}
return false;
}
int keyword_total_count() {
return keyword_count;
}