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 $
  • 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 class JEP
    • addError

      void addError​(String error)
      Adds an error message to the "real" JEP parser.
    • getValueAsObject

      public Object getValueAsObject()
      Override the superclass method so that exceptions are passed on instead of swallowed.
      Overrides:
      getValueAsObject in class JEP
      Since:
      3.0