From e0630766450d402455d9c8368087f96d8075c07c Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 5 Aug 2022 09:31:06 +0200 Subject: headers, import --- bootstrap/all.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'bootstrap/all.h') diff --git a/bootstrap/all.h b/bootstrap/all.h index fa24479..3048d99 100644 --- a/bootstrap/all.h +++ b/bootstrap/all.h @@ -2,6 +2,7 @@ #include "vec.h" #include +#include #include #include #include @@ -42,6 +43,7 @@ struct span { _(fn) \ _(for) \ _(if) \ + _(import) \ _(let) \ _(not) \ _(or) \ @@ -124,6 +126,7 @@ struct parser { int expanno; const struct type *targty; bool used_targty; + bool is_header; }; enum typetype { @@ -366,8 +369,12 @@ struct stmt { }; }; -struct transunit { - slice_t(struct decl) decls; +struct declsl { + slice_t(struct decl); +}; + +struct comfile { + struct declsl decls; }; /************/ @@ -447,7 +454,7 @@ void noreturn fatal(struct parser *, struct span, const char *fmt, ...); /** parse.c **/ extern const char *keyword2str[]; -void parse(struct transunit *, struct parser *); +void parse(struct comfile *, struct parser *); void initparser(struct parser *, const char *fname); /** types.c **/ @@ -481,7 +488,7 @@ bool envput(struct env *, const struct decl *decl); struct env *mkenv(const struct env *parent); /** dump.c **/ -void dumptransunit(const struct transunit *); +void dumpcomfile(const struct comfile *); const char *tokt2str(int); const char *tok2str(struct tok); void pritoktree(struct toktree); @@ -489,7 +496,7 @@ void epri(const char *fmt, ...); void vepri(const char *fmt, va_list); /** cgen.c **/ -void cgen(FILE *, const struct transunit *); +void cgen(FILE *, const struct comfile *); /** fold.c **/ int fold(struct expr *); -- cgit v1.2.3