Commit 76fafd21 authored by Olivier Teulière's avatar Olivier Teulière

* skins2/parser/interpreter.cpp: parse the "or" operator

 * skins2/parser/expr_evaluator.cpp: small fix for enhanced flexibility
parent fec56cbe
......@@ -69,7 +69,7 @@ void ExprEvaluator::parse( const string &rExpr )
{
// Skip white spaces
end = begin;
while( pString[end] && pString[end] != ' ' )
while( pString[end] && pString[end] != ' ' && pString[end] != ')' )
{
end++;
}
......
......@@ -211,6 +211,32 @@ VarBool *Interpreter::getVarBool( const string &rName, Theme *pTheme )
// Register this variable in the manager
pVarManager->registerVar( VariablePtr( pNewVar ) );
}
else if( token == "or" )
{
// Get the 2 last variables on the stack
if( varStack.empty() )
{
msg_Err( getIntf(), "Invalid boolean expression: %s",
rName.c_str());
return NULL;
}
VarBool *pVar1 = varStack.back();
varStack.pop_back();
if( varStack.empty() )
{
msg_Err( getIntf(), "Invalid boolean expression: %s",
rName.c_str());
return NULL;
}
VarBool *pVar2 = varStack.back();
varStack.pop_back();
// Create a composite boolean variable
VarBool *pNewVar = new VarBoolOrBool( getIntf(), *pVar1, *pVar2 );
varStack.push_back( pNewVar );
// Register this variable in the manager
pVarManager->registerVar( VariablePtr( pNewVar ) );
}
else if( token == "not" )
{
// Get the last variable on the stack
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment