mBuilder.endContext(Context.INNER_EXPRESSION);
return mBuilder.getInnerExpression();
}
catch (Exception e)
{
UnsupportedExpressionException wrapper =
new UnsupportedExpressionException(ast.toStringTree());
wrapper.initCause(e);
throw wrapper;
}
}
else if (ast.getType() == DISPEL_v4Parser.FUNCTION_CALL)
{
handleChild(ast);
return mFunctionResult;
}
else if (Operator.isOperator(ast.getText()))
{
Expression left = null;
Expression right = null;
if (ast.getChildCount() > 1)
{
left = buildExpression(ast.getChild(0));
right = buildExpression(ast.getChild(1));
}
else
{
right = buildExpression(ast.getChild(0));
}
Expression expression =
Operator.getOperator(ast.getText()).getExpression();
expression.setChild(1, right);
if (left != null)
{
expression.setChild(0, left);
}
return expression;
}
else if (Comparator.isComparison(ast.getText()))
{
Expression left = buildExpression(ast.getChild(0));
Expression right = buildExpression(ast.getChild(1));
Expression expression =
Comparator.getComparator(ast.getText()).getExpression();
expression.setChild(0, left);
expression.setChild(1, right);
return expression;
}
else
{
handleChild(ast);
return null;
}
throw new UnsupportedExpressionException(ast.toStringTree());
}