From fb7fdf330feb639003d3fa8589625e81d17b29e0 Mon Sep 17 00:00:00 2001 From: HuntedByTheIRS Date: Tue, 28 Jul 2026 16:38:09 -0400 Subject: [PATCH] Fix variable expansion --- source/antelope/evaluator/expansion.d | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/antelope/evaluator/expansion.d b/source/antelope/evaluator/expansion.d index 0e0162a..3bbf533 100644 --- a/source/antelope/evaluator/expansion.d +++ b/source/antelope/evaluator/expansion.d @@ -224,11 +224,13 @@ private string resolveParenContent(string content, char closer, Environment* env content[colonIdx + 1] != '=' && indexOf(content[colonIdx + 1 .. $], '=') >= 0) { // Syntax: VAR:old=new + // Per GNU Make: $(var:a=b) ≡ $(patsubst %a,%b,$(var)) + // The '%' is prepended so that patsubst matches at end-of-word. string varName = content[0 .. colonIdx]; auto eqIdx = indexOf(content[colonIdx + 1 .. $], '='); - string oldPat = content[colonIdx + 1 .. colonIdx + 1 + eqIdx]; - string newPat = content[colonIdx + 1 + eqIdx + 1 .. $]; - // Equivalent to $(patsubst oldPat,newPat,$(varName)) + string oldPat = "%" ~ content[colonIdx + 1 .. colonIdx + 1 + eqIdx]; + string newPat = "%" ~ content[colonIdx + 1 + eqIdx + 1 .. $]; + // Equivalent to $(patsubst %oldPat,%newPat,$(varName)) string varValue = env ? env.get(varName) : ""; if (varValue.length > 0) {