aboutsummaryrefslogtreecommitdiff
path: root/src/inc
diff options
context:
space:
mode:
authorMarvin Borner2021-04-20 00:54:43 +0200
committerMarvin Borner2021-04-20 00:54:43 +0200
commitaac2dae5cfcd360ad48f265910511c98decbf9e7 (patch)
tree45b7d421d2ff3d3db390f0c7fd969e4d8a58cd65 /src/inc
parent3ecfdb1064f7c4f45f53c415a77803ce2153d04d (diff)
Beautiful blub blabs
Diffstat (limited to 'src/inc')
-rw-r--r--src/inc/def.h2
-rw-r--r--src/inc/lexer.h20
-rw-r--r--src/inc/parser.h4
-rw-r--r--src/inc/warnings.h11
4 files changed, 29 insertions, 8 deletions
diff --git a/src/inc/def.h b/src/inc/def.h
index bd06eb9..22e1bda 100644
--- a/src/inc/def.h
+++ b/src/inc/def.h
@@ -10,5 +10,7 @@ typedef signed short s16;
typedef signed char s8;
#define UNUSED(bla) ((void)(bla))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
diff --git a/src/inc/lexer.h b/src/inc/lexer.h
index 833e522..82d533c 100644
--- a/src/inc/lexer.h
+++ b/src/inc/lexer.h
@@ -1,7 +1,9 @@
#ifndef LEXER_H
#define LEXER_H
-enum token {
+#include <def.h>
+
+enum token_type {
UNKNOWN,
NEWLINE,
NOP,
@@ -44,7 +46,7 @@ enum token {
DUBB,
MUL,
CJNE,
- SWP,
+ SWAP,
DA,
CRL,
XCH,
@@ -55,10 +57,16 @@ enum token {
DB,
DW,
INCLUDE,
- BRACE_OPEN,
- BRACE_CLOSE,
- DATA,
- BIT,
};
+struct token {
+ enum token_type type;
+ char *start;
+ u32 length;
+ void *data;
+};
+
+void token_print(struct token *tok);
+struct token token_resolve(char *token, u32 size);
+
#endif
diff --git a/src/inc/parser.h b/src/inc/parser.h
index c46ead1..0c59681 100644
--- a/src/inc/parser.h
+++ b/src/inc/parser.h
@@ -1,5 +1,5 @@
-#ifndef LEXER_H
-#define LEXER_H
+#ifndef PARSER_H
+#define PARSER_H
#include <def.h>
diff --git a/src/inc/warnings.h b/src/inc/warnings.h
new file mode 100644
index 0000000..495b2e2
--- /dev/null
+++ b/src/inc/warnings.h
@@ -0,0 +1,11 @@
+#ifndef WARNINGS_H
+#define WARNINGS_H
+
+#include <def.h>
+
+void warnings_print(void);
+void warnings_add(u32 line, const char *fmt, ...);
+void warnings_clear(void);
+u8 warnings_exist(void);
+
+#endif