aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.c
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-07-31 02:43:02 +0900
committernsfisis <nsfisis@gmail.com>2025-08-15 10:06:18 +0900
commit788cfd8bcc932e545db73da282c48a9bad8ca271 (patch)
treeb386b8a6f2f1dc7a6042c15f13b2d929635816e5 /main.c
parent8fba2c682d190236b0e4c82b71404e6cfb62d6d0 (diff)
downloadducc-788cfd8bcc932e545db73da282c48a9bad8ca271.tar.gz
ducc-788cfd8bcc932e545db73da282c48a9bad8ca271.tar.zst
ducc-788cfd8bcc932e545db73da282c48a9bad8ca271.zip
feat: implement __FILE__ macro
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/main.c b/main.c
index 0aedc6d..3d06c02 100644
--- a/main.c
+++ b/main.c
@@ -2,6 +2,7 @@
// clang-format off
#include "std.h"
#include "common.c"
+#include "io.c"
#include "preprocess.c"
#include "tokenize.c"
#include "ast.c"
@@ -13,13 +14,7 @@ int main(int argc, char** argv) {
if (argc == 1) {
fatal_error("usage: ducc <FILE>");
}
- FILE* in;
- if (strcmp(argv[1], "-") == 0) {
- in = stdin;
- } else {
- in = fopen(argv[1], "rb");
- }
- char* source = read_all(in);
+ InFile* source = read_all(argv[1]);
PpToken* pp_tokens = preprocess(source);
Token* tokens = tokenize(pp_tokens);
Program* prog = parse(tokens);