UI: RuleTextParser: Simplify parseLine()

This commit is contained in:
Nodir Temirkhodjaev 2024-11-07 11:35:25 +05:00
parent 973581ada4
commit daa710ff4a
2 changed files with 23 additions and 14 deletions

View File

@ -134,14 +134,27 @@ bool RuleTextParser::parseLine()
if (!parseLineSection(expectedSeparator))
break;
if (m_ruleFilter.isLineEnd || m_ruleFilter.isListEnd)
if (!processSectionFilter())
break;
const bool isSectionEnd = m_ruleFilter.isSectionEnd;
expectedSeparator = CharColon | CharNewLine;
}
endList(filterIndex);
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
@ -150,12 +163,7 @@ bool RuleTextParser::parseLine()
: FORT_RULE_FILTER_TYPE_INVALID;
}
expectedSeparator = CharColon | CharNewLine;
}
endList(filterIndex);
return !hasError();
return true;
}
bool RuleTextParser::parseLineSection(RuleCharTypes expectedSeparator)

View File

@ -96,6 +96,7 @@ private:
bool parseLines();
bool parseLineComments();
bool parseLine();
bool processSectionFilter();
bool parseLineSection(RuleCharTypes expectedSeparator);
bool parseSection();
bool parseSectionBlock();