aboutsummaryrefslogtreecommitdiff
path: root/src/token.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/token.c')
-rw-r--r--src/token.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/token.c b/src/token.c
index e57ecd5..6991399 100644
--- a/src/token.c
+++ b/src/token.c
@@ -12,3 +12,27 @@ token_t* token_init(int type, char* val) {
return token;
}
+
+int char_could_start_keyword(char* character) {
+ for (int i = 0; i < 27; ++ i) {
+ if (TOKEN_DEFNAME_FIRST_CHAR_ALLOWED_CHARS[i] == *character) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+int char_could_split_keyword(char* character) {
+ if (char_could_start_keyword(character)) {
+ return 1;
+ } else {
+ for (int i = 0; i < 12; ++ i) {
+ if (TOKEN_DEFNAME_SPLIT_CHAR_ALLOWED_CHARS[i] == *character) {
+ return 1;
+ }
+ }
+
+ return 0;
+ }
+}