summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c1
-rw-r--r--parse.c10
-rw-r--r--test.toc1
3 files changed, 10 insertions, 2 deletions
diff --git a/main.c b/main.c
index caf8d61..a644ae4 100644
--- a/main.c
+++ b/main.c
@@ -16,7 +16,6 @@ use
for accessing struct members (and other things, potentially) with struct["member"], just replace e with
a BINARY_DOT
local structs should not be named in C
-for some reason forgetting a ; after #include causes a misleading unrecognized expression
simplify eval macros with val_to_u/i64
&&, ||
start making a standard library... (printf; stringbuilder would be nice to have)
diff --git a/parse.c b/parse.c
index bd25189..f5699bf 100644
--- a/parse.c
+++ b/parse.c
@@ -2422,8 +2422,10 @@ static Status parse_stmt(Parser *p, Statement *s, bool *was_a_statement) {
i->flags |= INC_FORCED;
++t->token;
}
- if (!parse_expr(p, &i->filename, expr_find_end(p, EXPR_CAN_END_WITH_COMMA)))
+ if (!parse_expr(p, &i->filename, expr_find_end(p, EXPR_CAN_END_WITH_COMMA))) {
+ tokr_skip_semicolon(t);
return false;
+ }
if (token_is_kw(t->token, KW_COMMA)) {
Expression filename = i->filename;
++t->token;
@@ -2466,6 +2468,12 @@ static Status parse_stmt(Parser *p, Statement *s, bool *was_a_statement) {
inc_stmt->where = s->where;
inc_stmt->inc = parser_calloc(p, 1, sizeof *inc_stmt->inc);
inc_stmt->inc->filename = filename;
+ } else if (i->flags & INC_FORCED) {
+ /* go back to #forced */
+ while (!token_is_direct(t->token, DIRECT_FORCE)) --t->token;
+ err_print(token_location(p->file, t->token), "You don't need to specify #force if you're not including into a namespace (this is the default behaviour).");
+ tokr_skip_semicolon(t);
+ return false;
}
if (!token_is_kw(t->token, KW_SEMICOLON)) {
tokr_err(t, "Expected ; after #include directive");
diff --git a/test.toc b/test.toc
index a233fed..f08f2d6 100644
--- a/test.toc
+++ b/test.toc
@@ -1,3 +1,4 @@
+
#include "std/io.toc";
Point ::= struct {