net.sf.basedb.util.jep
Class FunctionSafeJep
java.lang.Object
org.nfunk.jep.JEP
net.sf.basedb.util.jep.FunctionSafeJep
public class FunctionSafeJep
- extends JEP
Extension to the JEP parser that provides better error handling for
unknown functions. The normal error message when JEP encounters
an unknown function is: Syntax Error (implicit multiplication not enabled).
This is not very informative so this class improves the error handling
by giving a message: Unknown function foo() instead.
- Since:
- 2.15
- Author:
- Nicklas
- Last modified
- $Date $
Nested Class Summary |
(package private) static class |
FunctionSafeJep.SafeFunctionTable
Function table implementation that pretends that all possible functions
exists, but sends an error message if someone tries to use a function that
doesn't really exists. |
(package private) static class |
FunctionSafeJep.UnknownFunction
Represents an unknown function that appears in an expression. |
Constructor Summary |
FunctionSafeJep()
Create a new function-safe JEP parser. |
Method Summary |
(package private) void |
addError(String error)
Adds an error message to the "real" JEP parser. |
void |
initFunTab()
Overrides the regular function lookup table by replacing it with a
function table that pretends that all functions has been registered,
but then generates an error message if it doesn't exists. |
Methods inherited from class org.nfunk.jep.JEP |
addComplex, addConstant, addFunction, addStandardConstants, addStandardFunctions, addVariable, addVariable, addVariable, evaluate, getAllowAssignment, getAllowUndeclared, getComplexValue, getErrorInfo, getEvaluatorVisitor, getFunctionTable, getImplicitMul, getNumberFactory, getOperatorSet, getParser, getSymbolTable, getTopNode, getTraverse, getValue, getValueAsObject, getVar, getVarValue, hasError, initSymTab, parse, parseExpression, removeFunction, removeVariable, setAllowAssignment, setAllowUndeclared, setImplicitMul, setTraverse, setVarValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FunctionSafeJep
public FunctionSafeJep()
- Create a new function-safe JEP parser.
initFunTab
public void initFunTab()
- Overrides the regular function lookup table by replacing it with a
function table that pretends that all functions has been registered,
but then generates an error message if it doesn't exists.
- Overrides:
initFunTab
in class JEP
addError
void addError(String error)
- Adds an error message to the "real" JEP parser.