summaryrefslogtreecommitdiff
path: root/lexer.h
diff options
context:
space:
mode:
Diffstat (limited to 'lexer.h')
-rw-r--r--lexer.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/lexer.h b/lexer.h
new file mode 100644
index 0000000..542dd2c
--- /dev/null
+++ b/lexer.h
@@ -0,0 +1,33 @@
+#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,
+
+ /* Etc */
+ TOK_IDENT
+};
+
+struct location {
+ size_t line;
+ size_t column;
+};
+
+struct token {
+ enum TOKEN_TYPE type;
+ struct location loc;
+ char value[MAX_IDENT_LENGTH];
+ struct token *next;
+};
+
+struct token* lex_file(FILE*);
+const char *get_token_description(enum TOKEN_TYPE);
+