diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-18 15:39:22 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-18 15:39:22 -0400 |
| commit | 7f5af625e5045055173fb776fc5aaa5453704f61 (patch) | |
| tree | d69a512eef5f5a04f039bc0f9d9a210db5d200bd /parse.c | |
| parent | 2d78f11400d61f89845678b40e7b0682f14bba7f (diff) | |
Support `use`ing .c files and .S files (assembly)
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -2356,14 +2356,19 @@ PARSER(parse_use) { pos += name_len; while (match(&pos, ";")) continue; int what; - if (name[0] == '<' || name[0] == '"') + if (name[0] == '<' || ends_with(name, ".h")) { what = USE_HEADER; - else if (starts_with(name, "./") || starts_with(name, "/") || starts_with(name, "../") || starts_with(name, "~/")) + } else if (ends_with(name, ".c")) { + what = USE_C_CODE; + } else if (ends_with(name, ".S") || ends_with(name, ".s")) { + what = USE_ASM; + } else if (starts_with(name, "./") || starts_with(name, "/") || starts_with(name, "../") || starts_with(name, "~/")) { what = USE_LOCAL; - else if (ends_with(name, ".so")) + } else if (ends_with(name, ".so")) { what = USE_SHARED_OBJECT; - else + } else { what = USE_MODULE; + } return NewAST(ctx->file, start, pos, Use, .path=name, .what=what); } |
