diff --git a/expand.go b/expand.go index 2965467..7cf32ef 100644 --- a/expand.go +++ b/expand.go @@ -258,8 +258,6 @@ func expandSuffixes(input string, stem string) string { return string(expanded) } -// TODO: expand RegexpRefs - // Expand a backtick quoted string, by executing the contents. func expandBackQuoted(input string, vars map[string][]string) ([]string, int) { // TODO: expand sigils? diff --git a/graph.go b/graph.go index b6a4571..44dbb34 100644 --- a/graph.go +++ b/graph.go @@ -191,9 +191,14 @@ func applyrules(rs *ruleSet, g *graph, target string, rulecnt []int) *node { var stem string var matches []string + var match_vars = make(map[string][]string) if r.attributes.regex { matches = mat + for i := range matches { + key := fmt.Sprintf("stem%d", i) + match_vars[key] = matches[i : i+1] + } } else { stem = mat[1] } @@ -207,8 +212,7 @@ func applyrules(rs *ruleSet, g *graph, target string, rulecnt []int) *node { for i := range r.prereqs { var prereq string if r.attributes.regex { - // TODO: write substituteRegexpRefs and use that here - prereq = r.prereqs[i] + prereq = expandRecipeSigils(r.prereqs[i], match_vars) } else { prereq = expandSuffixes(r.prereqs[i], stem) }