diff --git a/src/OpenFOAM/db/dictionary/functionEntries/inputSyntaxEntry/inputSyntaxEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/inputSyntaxEntry/inputSyntaxEntry.C index 8cb00668ec..0518d45010 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/inputSyntaxEntry/inputSyntaxEntry.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/inputSyntaxEntry/inputSyntaxEntry.C @@ -37,8 +37,9 @@ const Foam::word Foam::functionEntries::inputSyntaxEntry::typeName // might include inputSyntax entries int Foam::functionEntries::inputSyntaxEntry::debug(0); +// Read the default dictionary syntax from etc/controlDict if specified Foam::functionEntries::inputSyntaxEntry::inputSyntax - Foam::functionEntries::inputSyntaxEntry::syntax_ + Foam::functionEntries::inputSyntaxEntry::defaultSyntax_ ( Foam::debug::optimisationSwitches().found("inputSyntax") ? Foam::functionEntries::inputSyntaxEntry::syntax @@ -51,6 +52,13 @@ Foam::functionEntries::inputSyntaxEntry::inputSyntax : DOT ); +// Initialise the current dictionary syntax to the default +Foam::functionEntries::inputSyntaxEntry::inputSyntax + Foam::functionEntries::inputSyntaxEntry::syntax_ +( + Foam::functionEntries::inputSyntaxEntry::defaultSyntax_ +); + namespace Foam { @@ -76,7 +84,7 @@ Foam::functionEntries::inputSyntaxEntry::syntax ) { word syntax(is); - if (syntax == "slash" || syntax == "default") + if (syntax == "slash") { return SLASH; } @@ -88,9 +96,10 @@ Foam::functionEntries::inputSyntaxEntry::syntax { WarningInFunction << "unsupported input syntax'" << syntax - << "' ... defaulting to 'dot'" + << ", setting to default" << endl; - return DOT; + + return defaultSyntax_; } } @@ -110,7 +119,7 @@ bool Foam::functionEntries::inputSyntaxEntry::execute void Foam::functionEntries::inputSyntaxEntry::clear() { - syntax_ = DOT; + syntax_ = defaultSyntax_; } diff --git a/src/OpenFOAM/db/dictionary/functionEntries/inputSyntaxEntry/inputSyntaxEntry.H b/src/OpenFOAM/db/dictionary/functionEntries/inputSyntaxEntry/inputSyntaxEntry.H index f263868efd..5e3da44e74 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/inputSyntaxEntry/inputSyntaxEntry.H +++ b/src/OpenFOAM/db/dictionary/functionEntries/inputSyntaxEntry/inputSyntaxEntry.H @@ -34,12 +34,13 @@ Description The possible input syntax: - \par slash use '/' as the scope operator - and '../' to go to the parent dictionary + '../' to go to the parent dictionary + and '!' to go to the top-level dictionary - \par dot use '.' as the scope operator - and '..' to go to the parent dictionary - - \par default currently identical to dot + '..' to go to the parent dictionary + and ':' to go to the top-level dictionary - The default dictionary syntax is \c dot but changed to \c slash in + The default dictionary syntax is \c dot but can be changed to \c slash in etc/controlDict \verbatim OptimisationSwitches @@ -83,6 +84,9 @@ class inputSyntaxEntry DOT }; + //- The default input syntax + static inputSyntax defaultSyntax_; + //- The current input syntax static inputSyntax syntax_; @@ -110,7 +114,8 @@ public: //- Execute the functionEntry in a sub-dict context static bool execute(dictionary& parentDict, Istream&); - //- Reset the inputSyntax to %default (ie, %merge) + //- Reset the inputSyntax to the default specified in etc/controlDict + // if not specified to %dot static void clear(); //- Return true if the inputSyntax is %slash