summaryrefslogtreecommitdiff
path: root/token.h
diff options
context:
space:
mode:
Diffstat (limited to 'token.h')
-rw-r--r--token.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/token.h b/token.h
new file mode 100644
index 0000000..c00c870
--- /dev/null
+++ b/token.h
@@ -0,0 +1,38 @@
+#ifndef HENCE_TOKEN_H
+#define HENCE_TOKEN_H
+
+#define MAX_IDENT_LENGTH 128
+
+enum TOKEN_TYPE {
+ /* Keywords */
+ TOK_MODULE,
+ TOK_INPUT,
+ TOK_EXPR,
+ TOK_COLON,
+ TOK_EOL,
+ TOK_OR,
+ TOK_AND,
+ TOK_XOR,
+ TOK_NOT,
+ TOK_NAND,
+ TOK_NOR,
+
+ /* Etc */
+ TOK_IDENT
+};
+
+struct location {
+ size_t line;
+ size_t column;
+ size_t leading_whitespace_len;
+};
+
+struct token {
+ enum TOKEN_TYPE type;
+ struct location loc;
+ char value[MAX_IDENT_LENGTH];
+ size_t span;
+ struct token *next;
+};
+
+#endif