groovy/groovy-core — pull request #262 by aalmiray (2013-10-09 16:23:15+00:00)
Title: Port Griffon's ConfigReader enhancements back to Groovy's ConfigSlurper.

ConfigSlurper now has the ability to support multiple conditional blocks, not just 'environments'.
The 'environments' block is still set as the default conditional if none is specified. These patch
also allows for nested conditionals, for example

projects { // conditional
sample {
environments { // conditional
test { ... }
prod { ... }
}
}
experimental { ... }
}

The aforementioned script can be parsed with

ConfigSlurper slurper = new ConfigSlurper()
slurper.registerConditionalBlock('projects', 'sample')
slurper.registerConditionalBlock('environments', 'prod')
ConfigObject config = slurper.parse(theScript)