diff --git a/src/ui/util/conf/ruletextparser.cpp b/src/ui/util/conf/ruletextparser.cpp index 8b2040bc..99f9ba51 100644 --- a/src/ui/util/conf/ruletextparser.cpp +++ b/src/ui/util/conf/ruletextparser.cpp @@ -134,22 +134,9 @@ bool RuleTextParser::parseLine() if (!parseLineSection(expectedSeparator)) break; - if (m_ruleFilter.isLineEnd || m_ruleFilter.isListEnd) + if (!processSectionFilter()) break; - const bool isSectionEnd = m_ruleFilter.isSectionEnd; - - if (!checkAddFilter()) - return false; - - resetFilter(); - - // Next default type, if applicable - if (!isSectionEnd && !m_ruleFilter.hasFilterName) { - m_ruleFilter.type = m_ruleFilter.isTypeAddress() ? FORT_RULE_FILTER_TYPE_PORT - : FORT_RULE_FILTER_TYPE_INVALID; - } - expectedSeparator = CharColon | CharNewLine; } @@ -158,6 +145,27 @@ bool RuleTextParser::parseLine() return !hasError(); } +bool RuleTextParser::processSectionFilter() +{ + if (m_ruleFilter.isLineEnd || m_ruleFilter.isListEnd) + return false; + + if (!checkAddFilter()) + return false; + + const bool isSectionEnd = m_ruleFilter.isSectionEnd; + + resetFilter(); + + // Next default type, if applicable + if (!isSectionEnd && !m_ruleFilter.hasFilterName) { + m_ruleFilter.type = m_ruleFilter.isTypeAddress() ? FORT_RULE_FILTER_TYPE_PORT + : FORT_RULE_FILTER_TYPE_INVALID; + } + + return true; +} + bool RuleTextParser::parseLineSection(RuleCharTypes expectedSeparator) { for (;;) { diff --git a/src/ui/util/conf/ruletextparser.h b/src/ui/util/conf/ruletextparser.h index 2fdd2e1f..6307006d 100644 --- a/src/ui/util/conf/ruletextparser.h +++ b/src/ui/util/conf/ruletextparser.h @@ -96,6 +96,7 @@ private: bool parseLines(); bool parseLineComments(); bool parseLine(); + bool processSectionFilter(); bool parseLineSection(RuleCharTypes expectedSeparator); bool parseSection(); bool parseSectionBlock();