diff options
Diffstat (limited to '42sh/src/lexer/utils.h')
| -rw-r--r-- | 42sh/src/lexer/utils.h | 23 |
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 */ |
