diff --git a/src/common/config/config_file.cpp b/src/common/config/config_file.cpp index bb14b4be4b..3d5437603c 100644 --- a/src/common/config/config_file.cpp +++ b/src/common/config/config_file.cpp @@ -616,6 +616,7 @@ void ConfigFile::parse(Stream* stream) switch (parseLine(streamName, inputLine, current)) { + case LINE_END_SUB: case LINE_BAD: badLine(streamName, inputLine); return; @@ -643,16 +644,35 @@ void ConfigFile::parse(Stream* stream) { // subconf scope SubStream subStream(stream->getFileName()); + int level = 1; while (getLine(stream, inputLine, line)) { switch(parseLine(streamName, inputLine, current)) { - case LINE_END_SUB: - if (current.value.hasData()) - subStream.putLine(current.value, line); - break; + case LINE_START_SUB: + fb_assert(level > 0); + level++; + subStream.putLine(inputLine, line); + continue; + + case LINE_END_SUB: + level--; + if (level > 0) + { + subStream.putLine(inputLine, line); + continue; + } + else if (level == 0) + { + if (current.value.hasData()) + subStream.putLine(current.value, line); + break; + } + else // level < 0 impossible + { + fb_assert(false); + } - //case LINE_START_SUB: will be ignored at next level. Ignore here? case LINE_BAD: badLine(streamName, inputLine); return; @@ -664,6 +684,9 @@ void ConfigFile::parse(Stream* stream) break; } + if (level > 0) + badLine(streamName, "< missed closing bracket '}' >"); + previous->sub = FB_NEW_POOL(getPool()) ConfigFile(getPool(), &subStream, flags); } diff --git a/src/yvalve/PluginManager.cpp b/src/yvalve/PluginManager.cpp index 32b612cf00..9e7dbd512d 100644 --- a/src/yvalve/PluginManager.cpp +++ b/src/yvalve/PluginManager.cpp @@ -1109,7 +1109,7 @@ IConfig* PluginManager::getConfig(CheckStatusWrapper* status, const char* filena try { IConfig* rc = FB_NEW ConfigAccess(RefPtr( - FB_NEW_POOL(*getDefaultMemoryPool()) ConfigFile(*getDefaultMemoryPool(), filename))); + FB_NEW_POOL(*getDefaultMemoryPool()) ConfigFile(*getDefaultMemoryPool(), filename, ConfigFile::HAS_SUB_CONF))); rc->addRef(); return rc; }