From 31b382cd1a0edca09b605f5cd756cf986186b46f Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sun, 27 Sep 2026 13:31:11 +0200 Subject: [PATCH] dasm: detect unquoted filenames in detect.ts, but incbin needs quotes --- src/common/detect.ts | 7 ++++--- src/docs/build-directives.md | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/detect.ts b/src/common/detect.ts index 9fedb228..17c9347c 100644 --- a/src/common/detect.ts +++ b/src/common/detect.ts @@ -217,11 +217,12 @@ export async function detectProject(input: DetectInput): Promise { var text = await input.read(file); if (text == null) continue; texts.set(file, text); - // includes, with their line numbers for the evidence - var re = /^[ \t]*[#.]?[ \t]*include\s+[<"]([^>"]+)[>"]/gim; + // includes, with their line numbers for the evidence. Quoted (C, ca65), + // angle-bracketed (C), or bare (DASM, bB) -- name is whichever matched. + var re = /^[ \t]*[#.]?[ \t]*include\s+(?:"([^"]+)"|<([^>]+)>|([^\s;]+))/gim; var inc: RegExpExecArray | null; while ((inc = re.exec(text)) != null) { - var name = inc[1]; + var name = inc[1] || inc[2] || inc[3]; // a local copy of a library header (neslib.h) still counts var list = headers[name] || headers[basename(name)]; if (!list) continue; diff --git a/src/docs/build-directives.md b/src/docs/build-directives.md index f69dedbe..73a8e9ab 100644 --- a/src/docs/build-directives.md +++ b/src/docs/build-directives.md @@ -41,6 +41,8 @@ directives: .incbin "tileset.chr" ``` +With DASM, make sure to quote the filename in `incbin`. + ## C preprocessor defines The preprocessor macro `__MAIN__` is defined when compiling the main C