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