From a1a208ba63329394fd4ec80dc3ed2ee628a64ac8 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Mon, 27 Mar 2023 18:52:01 +0300 Subject: [PATCH] v0.3.0-dev.5 --- source/readconf.d | 48 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/source/readconf.d b/source/readconf.d index c1cc86f..fa38309 100644 --- a/source/readconf.d +++ b/source/readconf.d @@ -63,34 +63,30 @@ private: { string line = configuration.readln(); auto match = matchFirst(line, regular); - if (match) + + if (match.length == 0) + continue; + + // if again main section + if (match[GROUP_SECTION_MAIN].length) { - // if again main section - if (match[GROUP_SECTION_MAIN].length) - { - sectionName = match[GROUP_SECTION_MAIN]; - continue; - } - if (match[GROUP_SECTION_OTHER_OUTER].length) - { - sectionName = match[GROUP_SECTION_OTHER_INNER]; - continue; - } - - int group = GROUP_VALUE_1; - - if (match[group][0] == '\"') - group = GROUP_VALUE_2; - else if (match[group][0] == '\'') - group = GROUP_VALUE_3; - - this.configs[configName].add(sectionName, ConfigParameter(match[GROUP_PROPERTY], match[group])); - - // if (sectionName !in this.sections) - // this.sections[sectionName] = ConfigSection(sectionName); - - // this.sections[sectionName].add(ConfigParameter(match[GROUP_PROPERTY], match[group])); + sectionName = match[GROUP_SECTION_MAIN]; + continue; } + if (match[GROUP_SECTION_OTHER_OUTER].length) + { + sectionName = match[GROUP_SECTION_OTHER_INNER]; + continue; + } + + int group = GROUP_VALUE_1; + + if (match[group][0] == '\"') + group = GROUP_VALUE_2; + else if (match[group][0] == '\'') + group = GROUP_VALUE_3; + + this.configs[configName].add(sectionName, ConfigParameter(match[GROUP_PROPERTY], match[group])); } try {