summaryrefslogtreecommitdiff
path: root/42sh/src/lexer/token.h
diff options
context:
space:
mode:
Diffstat (limited to '42sh/src/lexer/token.h')
-rw-r--r--42sh/src/lexer/token.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/42sh/src/lexer/token.h b/42sh/src/lexer/token.h
new file mode 100644
index 0000000..89d772a
--- /dev/null
+++ b/42sh/src/lexer/token.h
@@ -0,0 +1,54 @@
+#ifndef TOKEN_H
+#define TOKEN_H
+
+#include <utils/libstring.h>
+
+enum token_type
+{
+ // STEP 1
+ TOKEN_NEWLINE,
+ TOKEN_EOF,
+ TOKEN_ERROR,
+ TOKEN_WORD,
+ TOKEN_IF,
+ TOKEN_THEN,
+ TOKEN_ELIF,
+ TOKEN_ELSE,
+ TOKEN_SEMICOLON,
+ TOKEN_FI,
+ TOKEN_HASHTAG,
+
+ // STEP 2
+ TOKEN_REDIR,
+ TOKEN_PIPE,
+ TOKEN_NEG,
+ TOKEN_WHILE,
+ TOKEN_UNTIL,
+ TOKEN_DO,
+ TOKEN_FOR,
+ TOKEN_DONE,
+ TOKEN_AND,
+ TOKEN_OR,
+ TOKEN_ESCAPE,
+ TOKEN_ASS_WORD,
+ TOKEN_DOUBLEQUOTE,
+ TOKEN_DOLLAR,
+ TOKEN_IN,
+ TOKEN_IONUMBER,
+
+ // STEP 3
+ TOKEN_PAR_RIGHT,
+ TOKEN_PAR_LEFT,
+ TOKEN_CURLY_RIGHT,
+ TOKEN_CURLY_LEFT,
+
+ // STEP 4
+};
+
+struct token
+{
+ enum token_type type;
+ struct string *value;
+};
+
+#endif /* ! TOKEN_H */