mirror of
https://github.com/tnodir/fort
synced 2024-11-15 01:36:22 +00:00
UI: RuleTextParser: Simplify parseValue()
This commit is contained in:
parent
daa710ff4a
commit
cfcf4539ab
@ -365,20 +365,9 @@ bool RuleTextParser::parseValue(bool expectValueEnd)
|
|||||||
{
|
{
|
||||||
const QChar *value = parsedCharPtr();
|
const QChar *value = parsedCharPtr();
|
||||||
|
|
||||||
for (;;) {
|
if (!parseValueChars(expectValueEnd))
|
||||||
const char *extraChars = expectValueEnd ? extraValueEndChars : extraValueChars;
|
|
||||||
|
|
||||||
if (!parseChars(CharLetter | CharValue, extraChars))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!checkValueEnd(expectValueEnd)) {
|
|
||||||
if (hasError())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const QStringView valueView(value, currentCharPtr() - value);
|
const QStringView valueView(value, currentCharPtr() - value);
|
||||||
|
|
||||||
m_ruleFilter.addValue(valueView);
|
m_ruleFilter.addValue(valueView);
|
||||||
@ -386,6 +375,21 @@ bool RuleTextParser::parseValue(bool expectValueEnd)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RuleTextParser::parseValueChars(bool &expectValueEnd)
|
||||||
|
{
|
||||||
|
for (;;) {
|
||||||
|
const char *extraChars = expectValueEnd ? extraValueEndChars : extraValueChars;
|
||||||
|
|
||||||
|
if (!parseChars(CharLetter | CharValue, extraChars))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!checkValueEnd(expectValueEnd))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !hasError();
|
||||||
|
}
|
||||||
|
|
||||||
bool RuleTextParser::checkValueEnd(bool &expectValueEnd)
|
bool RuleTextParser::checkValueEnd(bool &expectValueEnd)
|
||||||
{
|
{
|
||||||
const bool isValueBegin = (m_charType == CharValueBegin);
|
const bool isValueBegin = (m_charType == CharValueBegin);
|
||||||
|
@ -112,6 +112,7 @@ private:
|
|||||||
bool checkBracketValuesSeparator(RuleCharTypes expectedSeparator);
|
bool checkBracketValuesSeparator(RuleCharTypes expectedSeparator);
|
||||||
bool checkBracketValueEnd();
|
bool checkBracketValueEnd();
|
||||||
bool parseValue(bool expectValueEnd);
|
bool parseValue(bool expectValueEnd);
|
||||||
|
bool parseValueChars(bool &expectValueEnd);
|
||||||
bool checkValueEnd(bool &expectValueEnd);
|
bool checkValueEnd(bool &expectValueEnd);
|
||||||
|
|
||||||
bool checkAddFilter();
|
bool checkAddFilter();
|
||||||
|
Loading…
Reference in New Issue
Block a user