Allow an empty string as a default in variable substitution.

Lanucher configuration parser would previously require a default
value in variable substitution pattern to be non-empty string.
This is an unnecessary restriction as empty value is sometimes
useful as in this example:

  resources: ${sbt.extraClasspath-}

This commit lifts this restriction so empty default values are
allowed. The change has been discussed with @harrah.
This commit is contained in:
Grzegorz Kossakowski 2013-06-24 14:20:13 -07:00
parent f7ac74ab05
commit f426f8ba7f
1 changed files with 1 additions and 1 deletions

View File

@ -18,7 +18,7 @@ object ConfigurationParser
def trim(s: Array[String]) = s.map(_.trim).toList
def ids(value: String) = trim(substituteVariables(value).split(",")).filter(isNonEmpty)
private[this] lazy val VarPattern = Pattern.compile("""\$\{([\w.]+)(\-(.+))?\}""")
private[this] lazy val VarPattern = Pattern.compile("""\$\{([\w.]+)(\-(.*))?\}""")
def substituteVariables(s: String): String = if(s.indexOf('$') >= 0) substituteVariables0(s) else s
// scala.util.Regex brought in 30kB, so we code it explicitly
def substituteVariables0(s: String): String =