mpl.mathtext.ParserElement.setFailAction

ParserElement.setFailAction(fn)[source]

Define action to perform if parsing fails at this expression. Fail acton fn is a callable function that takes the arguments C{fn(s,loc,expr,err)} where:

  • s = string being parsed
  • loc = location where expression match was attempted and failed
  • expr = the parse expression that failed
  • err = the exception thrown

The function returns no value. It may throw C{L{ParseFatalException}} if it is desired to stop parsing immediately.