hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/lexer.h
diff options
context:
space:
mode:
Diffstat (limited to 'lexer.h')
-rw-r--r--lexer.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/lexer.h b/lexer.h
new file mode 100644
index 0000000..eb7a4d3
--- /dev/null
+++ b/lexer.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stdio.h>
+
+// single characters stand for themselves
+// so the named tokens start past them
+enum Token
+{
+ TOK_END = 0,
+ TOK_COLONCOLON = 256,
+ TOK_EMIT,
+ TOK_COMMIT,
+ TOK_DECLTYPE,
+ TOK_DIFFERENCE,
+ TOK_CHAR
+};
+
+// provided by flex
+// the input
+// the current line
+// and the scanner itself
+extern FILE* yyin;
+extern int yylineno;
+int yylex(void);
+
+// true once the lexer has refused something
+bool lexer_failed(void);
+// the character inside the most recent TOK_CHAR
+char lexer_character(void);