summaryrefslogtreecommitdiff
path: root/42sh/src/lexer/utils.h
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /42sh/src/lexer/utils.h
add: added projectsHEADmain
Diffstat (limited to '42sh/src/lexer/utils.h')
-rw-r--r--42sh/src/lexer/utils.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/42sh/src/lexer/utils.h b/42sh/src/lexer/utils.h
new file mode 100644
index 0000000..3edd83f
--- /dev/null
+++ b/42sh/src/lexer/utils.h
@@ -0,0 +1,23 @@
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <lexer/token.h>
+
+struct reserved_word
+{
+ const char *word;
+ enum token_type type;
+};
+
+static struct reserved_word reserved_words[] = {
+ { "if", TOKEN_IF }, { "then", TOKEN_THEN },
+ { "elif", TOKEN_ELIF }, { "else", TOKEN_ELSE },
+ { "fi", TOKEN_FI }, { "while", TOKEN_WHILE },
+ { "until", TOKEN_UNTIL }, { "do", TOKEN_DO },
+ { "done", TOKEN_DONE }, { "for", TOKEN_FOR },
+ { "in", TOKEN_IN }, { "!", TOKEN_NEG },
+ { "}", TOKEN_CURLY_RIGHT }, { "{", TOKEN_CURLY_LEFT },
+ { NULL, TOKEN_ERROR }
+};
+
+#endif /* ! UTILS_H */