summaryrefslogtreecommitdiff
path: root/src/token.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/token.c')
-rw-r--r--src/token.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/token.c b/src/token.c
new file mode 100644
index 0000000..1cd0d91
--- /dev/null
+++ b/src/token.c
@@ -0,0 +1,15 @@
+#include "./include/token.h"
+#include "./include/macros.h"
+
+#include <stdlib.h>
+
+token_t *init_token(int type, char *value, int row, int col) {
+ token_t *t = (token_t *)malloc(sizeof(token_t));
+ if (t == NULL)
+ die("malloc on token struct");
+ t->type = type;
+ t->value = value;
+ t->row = row;
+ t->col = col;
+ return t;
+}