38 if (expr.
isEmpty())
return false;
51 else if (
m_err.isEmpty())
57 warn(fileName,lineNr,
"problem evaluating expression '%s': %s",
71 return c==
'&' || c==
'|' || c==
'!';
79 return (c>=
'A' && c<=
'Z') || (c>=
'a' && c<=
'z') || c==
'_';
84 return isAlpha(c) || (c>=
'0' && c<=
'9') || c==
'-' || c==
'.' || (
static_cast<unsigned char>(c)>=0x80);
94 if (opName==
"&&") {
return AND; }
95 if (opName==
"||") {
return OR; }
98 if (opName==
"!") {
return NOT; }
116 while (*
m_e ==
' ' || *
m_e ==
'\t' || *
m_e ==
'\n')
130 if (*
m_e ==
'(' || *
m_e ==
')')
178 while (opId==
AND || opId==
OR)
220 m_err=
"Parenthesis ) missing";
248 m_err=
"Unexpected end of expression";
253 m_err=
"Value expected";
269 case AND:
return lhs && rhs;
270 case OR:
return lhs || rhs;
283 return std::find(list.begin(),list.end(),varName.
str())!=list.end();
QCString m_token
holds the token
QCString m_err
error state
TOKENTYPE m_tokenType
type of the token
bool evalVariable(const QCString &varName)
evaluate a variable
bool parseLevel1()
conditional operators AND and OR
void getToken()
Get next token in the current string expr.
QCString m_expr
holds the expression
bool evalOperator(const int opId, bool lhs, bool rhs)
evaluate an operator for given values
const char * m_e
points to a character in expr
bool parse(const QCString &fileName, int lineNr, const QCString &expr)
Copyright (C) 1997-2015 by Dimitri van Heesch.
bool parseLevel3()
parenthesized expression or variable
int getOperatorId(const QCString &opName)
returns the id of the given operator returns -1 if the operator is not recognized
This is an alternative implementation of QCString.
bool isEmpty() const
Returns TRUE iff the string is empty.
const std::string & str() const
QCString & setNum(short n)
static bool isDelimiter(const char c)
checks if the given char c is a delimiter minus is checked apart, can be unary minus
static bool isAlphaNumSpec(const char c)
static bool isAlpha(const char c)
checks if the given char c is a letter or underscore
#define Config_getList(name)
std::vector< std::string > StringVector
#define warn(file, line, fmt,...)
const char * qPrint(const char *s)