|
|
| __init__ (self, str pstr, int loc=0, typing.Optional[str] msg=None, elem=None) |
| |
| str | line (self) |
| |
| int | lineno (self) |
| |
| int | col (self) |
| |
| int | column (self) |
| |
|
| parserElement (self) |
| |
|
| parserElement (self, elem) |
| |
|
str | __str__ (self) |
| |
|
| __repr__ (self) |
| |
| str | mark_input_line (self, typing.Optional[str] marker_string=None, *str markerString=">!<") |
| |
| str | explain (self, depth=16) |
| |
|
| markInputline (self) |
| |
|
|
| loc |
| |
|
| msg |
| |
|
| pstr |
| |
|
| parser_element |
| |
|
| args |
| |
|
|
int | loc |
| |
|
str | msg |
| |
|
str | pstr |
| |
|
typing | parser_element .Any |
| |
|
typing | args .Tuple[str, int, typing.Optional[str]] |
| |
base exception class for all parsing runtime exceptions
◆ _from_exception()
| pip._vendor.pyparsing.exceptions.ParseBaseException._from_exception |
( |
|
cls, |
|
|
|
pe |
|
) |
| |
|
protected |
internal factory method to simplify creating one type of ParseException
from another - avoids having __init__ signature conflicts among subclasses
◆ col()
| int pip._vendor.pyparsing.exceptions.ParseBaseException.col |
( |
|
self | ) |
|
Return the 1-based column on the line of text where the exception occurred.
◆ column()
| int pip._vendor.pyparsing.exceptions.ParseBaseException.column |
( |
|
self | ) |
|
Return the 1-based column on the line of text where the exception occurred.
◆ explain()
| str pip._vendor.pyparsing.exceptions.ParseBaseException.explain |
( |
|
self, |
|
|
|
depth = 16 |
|
) |
| |
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``
◆ explain_exception()
| pip._vendor.pyparsing.exceptions.ParseBaseException.explain_exception |
( |
|
exc, |
|
|
|
depth = 16 |
|
) |
| |
|
static |
Method to take an exception and translate the Python internal traceback into a list
of the pyparsing expressions that caused the exception to be raised.
Parameters:
- exc - exception raised during parsing (need not be a ParseException, in support
of Python exceptions that might be raised in a parse action)
- 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.
◆ line()
| str pip._vendor.pyparsing.exceptions.ParseBaseException.line |
( |
|
self | ) |
|
Return the line of text where the exception occurred.
◆ lineno()
| int pip._vendor.pyparsing.exceptions.ParseBaseException.lineno |
( |
|
self | ) |
|
Return the 1-based line number of text where the exception occurred.
◆ mark_input_line()
| str pip._vendor.pyparsing.exceptions.ParseBaseException.mark_input_line |
( |
|
self, |
|
|
typing.Optional[str] |
marker_string = None, |
|
|
*str |
markerString = ">!<" |
|
) |
| |
Extracts the exception line from the input string, and marks
the location of the exception with a special symbol.
The documentation for this class was generated from the following file:
- docs/help/help-venv/lib/python3.12/site-packages/pip/_vendor/pyparsing/exceptions.py