aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2022-03-14 11:02:59 +0000
committerGitHub <noreply@github.com>2022-03-14 11:02:59 +0000
commita7adb2fb6e092e1f37791b1da633b01ff3ca489c (patch)
tree6bff88f90b9b72dcc04ce1c02f86d981c2135fdd /src/parser.cpp
parent410b85b5c7f768543e03c9fc6f47f8c2efcd602b (diff)
parentf907516cbd0078b69996929d02742d0c1a48c226 (diff)
Merge branch 'master' into freestanding_amd64
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 9659e8c18..94a585f35 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1538,7 +1538,7 @@ void fix_advance_to_next_stmt(AstFile *f) {
Token expect_closing(AstFile *f, TokenKind kind, String context) {
if (f->curr_token.kind != kind &&
f->curr_token.kind == Token_Semicolon &&
- f->curr_token.string == "\n") {
+ (f->curr_token.string == "\n" || f->curr_token.kind == Token_EOF)) {
Token tok = f->prev_token;
tok.pos.column += cast(i32)tok.string.len;
syntax_error(tok, "Missing ',' before newline in %.*s", LIT(context));
@@ -1560,6 +1560,7 @@ void assign_removal_flag_to_semicolon(AstFile *f) {
switch (curr_token->kind) {
case Token_CloseBrace:
case Token_CloseParen:
+ case Token_EOF:
ok = true;
break;
}
@@ -5719,6 +5720,22 @@ ParseFileError parse_packages(Parser *p, String init_filename) {
error_line("Expected either a directory or a .odin file, got '%.*s'\n", LIT(init_filename));
return ParseFile_WrongExtension;
}
+ } else if (init_fullpath.len != 0) {
+ String path = init_fullpath;
+ if (path[path.len-1] == '/') {
+ path.len -= 1;
+ }
+ if ((build_context.command_kind & Command__does_build) &&
+ build_context.build_mode == BuildMode_Executable) {
+ String short_path = filename_from_path(path);
+ char *cpath = alloc_cstring(heap_allocator(), short_path);
+ defer (gb_free(heap_allocator(), cpath));
+
+ if (gb_file_exists(cpath)) {
+ error_line("Please specify the executable name with -out:<string> as a directory exists with the same name in the current working directory");
+ return ParseFile_DirectoryAlreadyExists;
+ }
+ }
}