diff --git a/com.typesafe.hocon.tests/src/com/typesafe/hocon/parser/ParserTest.xtend b/com.typesafe.hocon.tests/src/com/typesafe/hocon/parser/ParserTest.xtend index 5cc6a05..bf7fa7b 100644 --- a/com.typesafe.hocon.tests/src/com/typesafe/hocon/parser/ParserTest.xtend +++ b/com.typesafe.hocon.tests/src/com/typesafe/hocon/parser/ParserTest.xtend @@ -82,6 +82,8 @@ class ParserTest { // This is a map with some nested maps and arrays within it, as well as some concatenations qux { baz: abc 123 + biz: [element1, element2] [element3, element4] + buz: [prependelementtoarray] ${arrayref} bar: { baz: abcdefg bar: { @@ -118,7 +120,7 @@ class ParserTest { @Test def void testSubstitution() { - succeeds("${foo.bar} += ${akka.timeout}\n") + succeeds("foo.bar += ${akka.timeout}\n") } @Test diff --git a/com.typesafe.hocon/src/com/typesafe/config/Hocon.xtext b/com.typesafe.hocon/src/com/typesafe/config/Hocon.xtext index 12d9dc1..6da3c9a 100644 --- a/com.typesafe.hocon/src/com/typesafe/config/Hocon.xtext +++ b/com.typesafe.hocon/src/com/typesafe/config/Hocon.xtext @@ -27,10 +27,10 @@ Member: ; Literal: - (value += SimpleLiteral)+ | Object | Array ; + (value += SimpleLiteral)+ | Object | (value += Array)+ ; SimpleLiteral returns EString: - (StringLiteral | name = Boolean | Null | NumberLiteral) + (StringLiteral | name = Boolean | Null | NumberLiteral | Substitution) ; Array: @@ -38,7 +38,7 @@ Array: (values+=Literal) ((',' | NL) NL* values+=Literal)* NL* - ']') | ( '[' NL* ']' ) + ']') | Substitution | ( '[' NL* ']' ) ; Boolean: @@ -50,7 +50,11 @@ Null: StringLiteral returns EString: - (name = STRING | name = UNQUOTED_STRING | '${' ('?')? UNQUOTED_STRING '}') + (name = STRING | name = UNQUOTED_STRING) +; + +Substitution returns EString: + '${' ('?')? UNQUOTED_STRING '}' ; NumberLiteral: