Package net.sf.basedb.util.jep
Class FunctionSafeJep
java.lang.Object
org.nfunk.jep.JEP
net.sf.basedb.util.jep.FunctionSafeJep
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
Modifier and TypeClassDescription(package private) static class
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
Represents an unknown function that appears in an expression. -
Field Summary
Fields inherited from class org.nfunk.jep.JEP
allowAssignment, allowUndeclared, errorList, ev, funTab, implicitMul, numberFactory, opSet, parser, symTab
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) void
Adds an error message to the "real" JEP parser.Override the superclass method so that exceptions are passed on instead of swallowed.void
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, getVar, getVarValue, hasError, initSymTab, parse, parseExpression, removeFunction, removeVariable, setAllowAssignment, setAllowUndeclared, setImplicitMul, setTraverse, setVarValue
-
Constructor Details
-
FunctionSafeJep
public FunctionSafeJep()Create a new function-safe JEP parser.
-
-
Method Details
-
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 classJEP
-
addError
Adds an error message to the "real" JEP parser. -
getValueAsObject
Override the superclass method so that exceptions are passed on instead of swallowed.- Overrides:
getValueAsObject
in classJEP
- Since:
- 3.0
-