diff --git a/applications/test/dictionary/testDictList b/applications/test/dictionary/testDictList new file mode 100644 index 0000000000..d0e1171bc1 --- /dev/null +++ b/applications/test/dictionary/testDictList @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object testDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Test some parsing + +// #default +internalField uniform 10; +// #default +dimensions [ 0 2 -2 0 0 0 0 ]; + +active +{ + type turbulentIntensityKineticEnergyInlet; + intensity 0.1; + value $internalField; +} + +// #inputMode error +active +{ + type turbulentIntensityKineticEnergyInlet; + intensity 0.1; + value 100; +} + +(U|k|epsilon|omega) +{ + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-6; + relTol 0; +} +/* +; + */ + +(rho) smoothSolver + +//OK smoothSolver // <- missing ';' as well + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/dictionary/dictionaryListEntry/dictionaryListEntryIO.C b/src/OpenFOAM/db/dictionary/dictionaryListEntry/dictionaryListEntryIO.C index 5043a206c2..c368e68035 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryListEntry/dictionaryListEntryIO.C +++ b/src/OpenFOAM/db/dictionary/dictionaryListEntry/dictionaryListEntryIO.C @@ -60,11 +60,11 @@ Foam::dictionaryListEntry::dictionaryListEntry token firstToken(is); if (firstToken.isLabel()) { - label s = firstToken.labelToken(); + const label sz = firstToken.labelToken(); is.readBeginList("List"); - for (label i=0; i Foam::entry::New(Istream& is) { is.fatalCheck(FUNCTION_NAME); - keyType keyword; + autoPtr ptr(nullptr); // Get the next keyword and if invalid return false - if (!getKeyword(keyword, is)) - { - return autoPtr(nullptr); - } - else // Keyword starts entry ... + keyType keyword; + if (getKeyword(keyword, is)) { + // Keyword starts entry ... token nextToken(is); is.putBack(nextToken); if (nextToken == token::BEGIN_BLOCK) { - return autoPtr - ( - new dictionaryEntry(keyword, dictionary::null, is) - ); + // A sub-dictionary + ptr.reset(new dictionaryEntry(keyword, dictionary::null, is)); } else { - return autoPtr - ( - new primitiveEntry(keyword, is) - ); + ptr.reset(new primitiveEntry(keyword, is)); } } + + return ptr; }