diff --git a/src/ui/util/conf/ruletextparser.cpp b/src/ui/util/conf/ruletextparser.cpp index 57c36dc4..446f6b7d 100644 --- a/src/ui/util/conf/ruletextparser.cpp +++ b/src/ui/util/conf/ruletextparser.cpp @@ -97,14 +97,8 @@ bool RuleTextParser::parseLines() const int nodeIndex = beginList(FORT_RULE_FILTER_TYPE_LIST_OR); for (;;) { - if (!skipComments(CharLineBegin)) { - if (!isEmpty()) { - setError(ErrorUnexpectedStartOfLine, tr("Unexpected start of line")); - return false; - } - + if (!parseLineComments()) break; - } if (!parseLine()) break; @@ -115,6 +109,19 @@ bool RuleTextParser::parseLines() return !hasError(); } +bool RuleTextParser::parseLineComments() +{ + if (!skipComments(CharLineBegin)) { + if (!isEmpty()) { + setError(ErrorUnexpectedStartOfLine, tr("Unexpected start of line")); + } + + return false; + } + + return true; +} + bool RuleTextParser::parseLine() { const int nodeIndex = beginList(FORT_RULE_FILTER_TYPE_LIST_AND); @@ -157,27 +164,27 @@ bool RuleTextParser::parseLineSection(RuleCharTypes expectedSeparator) if (!nextCharType(CharLineBegin | expectedSeparator, CharSpace)) return false; - if (!processSection()) + if (!parseSection()) break; } return !hasError(); } -bool RuleTextParser::processSection() +bool RuleTextParser::parseSection() { if ((m_charType & (CharListBegin | CharBracketBegin | CharDigit | CharValueBegin)) != 0) { - return processSectionBlock(); + return parseSectionBlock(); } - return processSectionChar(); + return parseSectionChar(); } -bool RuleTextParser::processSectionBlock() +bool RuleTextParser::parseSectionBlock() { switch (m_charType) { case CharListBegin: { - processSectionList(); + parseSectionList(); } break; case CharBracketBegin: { parseBracketValues(); @@ -193,7 +200,7 @@ bool RuleTextParser::processSectionBlock() return false; } -bool RuleTextParser::processSectionChar() +bool RuleTextParser::parseSectionChar() { switch (m_charType) { case CharLetter: { @@ -218,7 +225,7 @@ bool RuleTextParser::processSectionChar() return false; } -void RuleTextParser::processSectionList() +void RuleTextParser::parseSectionList() { if (!checkListBegin()) return; diff --git a/src/ui/util/conf/ruletextparser.h b/src/ui/util/conf/ruletextparser.h index 953f3bc5..b3249af6 100644 --- a/src/ui/util/conf/ruletextparser.h +++ b/src/ui/util/conf/ruletextparser.h @@ -94,12 +94,13 @@ private: void setupCharPtr(); bool parseLines(); + bool parseLineComments(); bool parseLine(); bool parseLineSection(RuleCharTypes expectedSeparator); - bool processSection(); - bool processSectionBlock(); - bool processSectionChar(); - void processSectionList(); + bool parseSection(); + bool parseSectionBlock(); + bool parseSectionChar(); + void parseSectionList(); bool checkListBegin(); bool checkListEnd();