diff --git a/JsonPreprocessor/JsonPreprocessor.pdf b/JsonPreprocessor/JsonPreprocessor.pdf index d14e5a3a..d348298c 100644 Binary files a/JsonPreprocessor/JsonPreprocessor.pdf and b/JsonPreprocessor/JsonPreprocessor.pdf differ diff --git a/packagedoc/additional_docs/The JSONP format.tex b/packagedoc/additional_docs/The JSONP format.tex index b92ccb1d..af89857d 100644 --- a/packagedoc/additional_docs/The JSONP format.tex +++ b/packagedoc/additional_docs/The JSONP format.tex @@ -1191,5 +1191,75 @@ \section{Implicite creation of dictionaries} {'paramA': 'ABC', 'subKey': 'ABC', 'testdict': {'subKey': {'subKey': {'paramA': 'DEF'}}}} \end{pythonlog} +\vspace{2ex} + +\textbf{Reference to existing keys} + +It is possible to use parameters to refer to \textit{already existing} keys. + +\begin{pythoncode} +{ + // + ${testdict.subKey_1.subKey_2.subKey_3} : "ABC", + + // + "keyName_3" : "subKey_3", + + // + ${testdict.subKey_1.subKey_2.${keyName_3}} : "XYZ" +} +\end{pythoncode} + +\vspace{2ex} + +\textbf{Outcome:} + +\begin{pythonlog} +{'keyName_3': 'subKey_3', + 'testdict': {'subKey_1': {'subKey_2': {'subKey_3': 'XYZ'}}}} +\end{pythonlog} + +\vspace{2ex} + +Parameters cannot be used to create new keys. + +\begin{pythoncode} +{ + // + ${testdict.subKey_1.subKey_2.subKey_3} : "ABC", + + // + "keyName_4" : "subKey_4", + + // + ${testdict.subKey_1.subKey_2.subKey_3.${keyName_4}} : "XYZ" +} +\end{pythoncode} + +\vspace{2ex} + +\textbf{Outcome is the following error:} + +\begin{pythonlog} +"The implicit creation of data structures based on nested parameter is not supported ..." +\end{pythonlog} + +The same error will happen in case of the standard notation is used: + +\begin{pythoncode} +{ + // + ${testdict}['subKey_1']['subKey_2']['subKey_3'][${keyName_4}] : "XYZ" +} +\end{pythoncode} + + + + + + + + + % -------------------------------------------------------------------------------------------------------------- diff --git a/test/testfiles/jpp-test_config_1002.jsonp b/test/testfiles/jpp-test_config_1002.jsonp index fe94987c..079052fb 100644 --- a/test/testfiles/jpp-test_config_1002.jsonp +++ b/test/testfiles/jpp-test_config_1002.jsonp @@ -31,10 +31,11 @@ "paramD" : "D", "paramE" : "E", ${testdict_3.paramD.paramE.paramD} : {"E" : 5}, - ${testdict_3.paramD.paramE.paramD}[${paramE}] : {"F" : 6} // if not implicit, usage of parameters for key names is allowed // - // needs to be clarified (currently throws an implicit creation error) - // ${testdict_4} : {}, - // ${testdict_4}[${paramD}] : {"G" : 7} + // usage of parameters allowed only in case of a key with this name already exists + + + + ${testdict_3.paramD.paramE.paramD}[${paramE}] : {"F" : 6} // ${paramE} is accepted because the value is "E" and a key with this name already exists } diff --git a/test/testfiles/jpp-test_config_1051.jsonp b/test/testfiles/jpp-test_config_1051.jsonp index 1d63e26b..766b2245 100644 --- a/test/testfiles/jpp-test_config_1051.jsonp +++ b/test/testfiles/jpp-test_config_1051.jsonp @@ -15,7 +15,7 @@ { "testdict" : {"A" : 1}, - "name" : "C", + "name" : "C", ${testdict.B.${name}} : 2 } diff --git a/test/testfiles/jpp-test_config_1052.jsonp b/test/testfiles/jpp-test_config_1052.jsonp index 4028d7da..90940d10 100644 --- a/test/testfiles/jpp-test_config_1052.jsonp +++ b/test/testfiles/jpp-test_config_1052.jsonp @@ -15,7 +15,7 @@ { "testdict" : {"A" : 1}, - "name" : "C", + "name" : "C", ${testdict}['${name}']['${name}'] : 2 } diff --git a/test/testfiles/jpp-test_config_1053.jsonp b/test/testfiles/jpp-test_config_1053.jsonp index 29b69f56..3e0620ea 100644 --- a/test/testfiles/jpp-test_config_1053.jsonp +++ b/test/testfiles/jpp-test_config_1053.jsonp @@ -14,7 +14,7 @@ //************************************************************************** { - "name" : "C", + "name" : "C", "testdict2" : {"B" : 2}, ${somethingnotexisting.${testdict2}}['${name}'] : 4 } diff --git a/test/testfiles/jpp-test_config_1054.jsonp b/test/testfiles/jpp-test_config_1054.jsonp index 60fcd02e..5faab86a 100644 --- a/test/testfiles/jpp-test_config_1054.jsonp +++ b/test/testfiles/jpp-test_config_1054.jsonp @@ -14,7 +14,7 @@ //************************************************************************** { - "name" : "C", + "name" : "C", "testdict" : {"B" : 2}, ${testdict.${testdict}}['${name}'] : 4 } diff --git a/test/testfiles/jpp-test_config_1055.jsonp b/test/testfiles/jpp-test_config_1055.jsonp index 4bd33f3b..7ec80248 100644 --- a/test/testfiles/jpp-test_config_1055.jsonp +++ b/test/testfiles/jpp-test_config_1055.jsonp @@ -14,7 +14,7 @@ //************************************************************************** { - "name" : "C", + "name" : "C", "testlist" : ["B", 2], ${testlist.${testlist}}['${name}'] : 4 } diff --git a/test/testfiles/jpp-test_config_1056.jsonp b/test/testfiles/jpp-test_config_1056.jsonp index f96893a0..1dbab24c 100644 --- a/test/testfiles/jpp-test_config_1056.jsonp +++ b/test/testfiles/jpp-test_config_1056.jsonp @@ -15,7 +15,7 @@ { "testdict" : {"A" : 1}, - "name" : "C", + "name" : "C", ${testdict.${name}}['${name}'] : 5 } diff --git a/test/testfiles/jpp-test_config_1057.jsonp b/test/testfiles/jpp-test_config_1057.jsonp index 00f03ef0..9027cd19 100644 --- a/test/testfiles/jpp-test_config_1057.jsonp +++ b/test/testfiles/jpp-test_config_1057.jsonp @@ -15,7 +15,7 @@ { "testdict" : {"A" : 1}, - "name" : "C", + "name" : "C", ${testdict}[${name}][${name}] : 4 } diff --git a/test/testfiles/jpp-test_config_1058.jsonp b/test/testfiles/jpp-test_config_1058.jsonp index 49e1a75e..41c6db28 100644 --- a/test/testfiles/jpp-test_config_1058.jsonp +++ b/test/testfiles/jpp-test_config_1058.jsonp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. //************************************************************************** + { "testdict" : {"A" : 1}, "name" : "C",