class_docstr: base exception class for all parsing runtime exceptions
docstr: Method to translate the Python internal traceback into a list
  of the pyparsing expressions that caused the exception to be raised.
  
  Parameters:
  
  - depth (default=16) - number of levels back in the stack trace to list expression
    and function names; if None, the full stack trace names will be listed; if 0, only
    the failing input line, marker, and exception string will be shown
  
  Returns a multi-line string listing the ParserElements and/or function names in the
  exception's stack trace.
  
  Example::
  
      expr = pp.Word(pp.nums) * 3
      try:
          expr.parse_string("123 456 A789")
      except pp.ParseException as pe:
          print(pe.explain(depth=0))
  
  prints::
  
      123 456 A789
              ^
      ParseException: Expected W:(0-9), found 'A'  (at char 8), (line:1, col:9)
  
  Note: the diagnostic output will include string representations of the expressions
  that failed to parse. These representations will be more helpful if you use `set_name` to
  give identifiable names to your expressions. Otherwise they will use the default string
  forms, which may be cryptic to read.
  
  Note: pyparsing's default truncation of exception tracebacks may also truncate the
  stack of expressions that are displayed in the ``explain`` output. To get the full listing
  of parser expressions, you may have to set ``ParserElement.verbose_stacktrace = True``
docstr_tok: ["Method","to","translate","the","Python","internal","traceback","into","a","list","of","the","pyparsing","expressions","that","caused","the","exception","to","be","raised",".","Parameters",":","-","depth","(","default=16",")","-","number","of","levels","back","in","the","stack","trace","to","list","expression","and","function","names",";","if","None",",","the","full","stack","trace","names","will","be","listed",";","if","0",",","only","the","failing","input","line",",","marker",",","and","exception","string","will","be","shown","Returns","a","multi-line","string","listing","the","ParserElements","and\/or","function","names","in","the","exception","'s","stack","trace",".","Example",":",":","expr","=","pp.Word","(","pp.nums",")","*","3","try",":","expr.parse_string","(","``","123","456","A789","''",")","except","pp.ParseException","as","pe",":","print","(","pe.explain","(","depth=0",")",")","prints",":",":","123","456","A789","^","ParseException",":","Expected","W",":","(","0-9",")",",","found","'","A","'","(","at","char","8",")",",","(","line:1",",","col:9",")","Note",":","the","diagnostic","output","will","include","string","representations","of","the","expressions","that","failed","to","parse",".","These","representations","will","be","more","helpful","if","you","use","`","set_name","`","to","give","identifiable","names","to","your","expressions",".","Otherwise","they","will","use","the","default","string","forms",",","which","may","be","cryptic","to","read",".","Note",":","pyparsing","'s","default","truncation","of","exception","tracebacks","may","also","truncate","the","stack","of","expressions","that","are","displayed","in","the","``","explain","``","output",".","To","get","the","full","listing","of","parser","expressions",",","you","may","have","to","set","``","ParserElement.verbose_stacktrace","=","True","``"]
code: def explain(self, depth=16) -> str:
      """
      Method to translate the Python internal traceback into a list
      of the pyparsing expressions that caused the exception to be raised.
  
      Parameters:
  
      - depth (default=16) - number of levels back in the stack trace to list expression
        and function names; if None, the full stack trace names will be listed; if 0, only
        the failing input line, marker, and exception string will be shown
  
      Returns a multi-line string listing the ParserElements and/or function names in the
      exception's stack trace.
  
      Example::
  
          expr = pp.Word(pp.nums) * 3
          try:
              expr.parse_string("123 456 A789")
          except pp.ParseException as pe:
              print(pe.explain(depth=0))
  
      prints::
  
          123 456 A789
                  ^
          ParseException: Expected W:(0-9), found 'A'  (at char 8), (line:1, col:9)
  
      Note: the diagnostic output will include string representations of the expressions
      that failed to parse. These representations will be more helpful if you use `set_name` to
      give identifiable names to your expressions. Otherwise they will use the default string
      forms, which may be cryptic to read.
  
      Note: pyparsing's default truncation of exception tracebacks may also truncate the
      stack of expressions that are displayed in the ``explain`` output. To get the full listing
      of parser expressions, you may have to set ``ParserElement.verbose_stacktrace = True``
      """
      return self.explain_exception(self, depth)
  
imports: import re
  import sys
  import typing
  from .util import col, line, lineno, _collapse_string_to_ranges, replaced_by_pep8
  from .unicode import pyparsing_unicode
label_desc: Use image node_id 13 for calling the ParseBaseException obj's underlying member method code with example usage: obj.explain(depth) and returns: self