* the string holding the input
* @return the internal representation of the expression in form of an expression tree made out of ExpressionNode
* objects
*/
public ExpressionNode parseExpression(String expression) {
ExpressionNode mathematicalExpression = null;
if (USE_CACHE) {
mathematicalExpression = cache.get(expression);
}
if (mathematicalExpression == null) {
Tokenizer tokenizer = Tokenizer.getExpressionTokenizer();
tokenizer.tokenize(expression);
LinkedList<Token> tokens = tokenizer.getTokens();
mathematicalExpression = parseExpression(tokens);
if (USE_CACHE) {
cache.put(expression, mathematicalExpression);
}
} else {
mathematicalExpression.accept(new SetContextVisitor(context));
}
return mathematicalExpression;
}