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,19 +365,8 @@ bool RuleTextParser::parseValue(bool expectValueEnd)
|
|||||||
{
|
{
|
||||||
const QChar *value = parsedCharPtr();
|
const QChar *value = parsedCharPtr();
|
||||||
|
|
||||||
for (;;) {
|
if (!parseValueChars(expectValueEnd))
|
||||||
const char *extraChars = expectValueEnd ? extraValueEndChars : extraValueChars;
|
return false;
|
||||||
|
|
||||||
if (!parseChars(CharLetter | CharValue, extraChars))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!checkValueEnd(expectValueEnd)) {
|
|
||||||
if (hasError())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const QStringView valueView(value, currentCharPtr() - value);
|
const QStringView valueView(value, currentCharPtr() - value);
|
||||||
|
|
||||||
@ -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