aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorc+12023-10-02 13:13:23 -0400
committerc+12023-10-02 13:13:23 -0400
commitdee72dfcc0124be81e338a1d85948b8f1250085d (patch)
treee013ac2a9410cff9ef55ce10531505af72edf67f /src/include
parent1e62e5f079bdd61c37f2f510a77279345680ccbf (diff)
emalloc(), ecalloc(), erealloc()
Diffstat (limited to 'src/include')
-rw-r--r--src/include/lexer.h3
-rw-r--r--src/include/token.h2
-rw-r--r--src/include/util.h8
3 files changed, 9 insertions, 4 deletions
diff --git a/src/include/lexer.h b/src/include/lexer.h
index 28d0e6f..8d4f75f 100644
--- a/src/include/lexer.h
+++ b/src/include/lexer.h
@@ -1,11 +1,12 @@
#ifndef LEXER_H
#define LEXER_H
+#include "util.h"
+#include "syntax.h"
#include "token.h"
#define LEXER_VALID (lexer->c != '\0' && lexer->i < strlen(lexer->content))
-
/* the lexer struct */
typedef struct LEXER_STRUC {
/* current character in content */
diff --git a/src/include/token.h b/src/include/token.h
index d3dda67..1a307cd 100644
--- a/src/include/token.h
+++ b/src/include/token.h
@@ -13,7 +13,7 @@
typedef struct TOKEN_STRUC {
enum TOKEN_ENUM {
TOKEN_KEYWORD, // keyword
- TOKEN_PRIM_STR, // 'string'
+ TOKEN_PRIM_STR, // "string"
TOKEN_PRIM_INT, // 42
TOKEN_COMM, // `comment`
TOKEN_STMNT_END, // ;
diff --git a/src/include/util.h b/src/include/util.h
index a2f887b..712af43 100644
--- a/src/include/util.h
+++ b/src/include/util.h
@@ -18,7 +18,11 @@ void log_raw(const char*, ...);
/* log a warning */
void log_war(const char*, ...);
-/* does c appear in s? */
-int appears_in_str(char*, char*);
+/* if calloc() returns null, die */
+void* ecalloc(size_t, size_t);
+/* if malloc() returns null, die */
+void* emalloc(size_t);
+/* if realloc() returns null, die */
+void* erealloc(void*, size_t);
#endif