expand variable lists with prefix/suffix elements

This commit is contained in:
Josh Holtrop 2013-06-26 22:07:23 -04:00
parent 5e42e9b868
commit fbdc773abb

View File

@ -55,7 +55,16 @@ module Rscons
expand_varref.call(ent)
end
else
if varref[0] == '$'
if varref =~ /^(.*)\$\[(\w+)\](.*)$/
# expand array with given prefix, suffix
prefix, varname, suffix = $1, $2, $3
varval = merged_variables[varname]
unless varval.is_a?(Array)
raise "Array expected for $#{varname}"
end
varval.map {|e| "#{prefix}#{e}#{suffix}"}
elsif varref[0] == '$'
# expand a single variable reference
varname = varref[1, varref.size]
varval = merged_variables[varname]
if varval