HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/pyparsing/__pycache__/exceptions.cpython-310.pyc
o

�h�&�@s�ddlmZddlZddlZddlZddlZddlmZddlm	Z
ddlmZm
Z
mZmZmZGdd�de
je
je
je
je
j�Zeej�Ze�d	ed
�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�Z dS)�)�annotationsN)�cached_property�)�pyparsing_unicode)�_collapse_string_to_ranges�col�line�lineno�replaced_by_pep8c@seZdZdS)�_ExceptionWordUnicodeSetN)�__name__�
__module__�__qualname__�rr�G/usr/local/CyberCP/lib/python3.10/site-packages/pyparsing/exceptions.pyrsrz([z
]{1,16})|.c@seZdZUdZded<ded<ded<ded<d	ed
<dZ		
	
d9d:dd�Zed;d<dd��Ze	d=dd��Z
ed>dd��Zed?dd��Z
ed?dd ��Zed?d!d"��Zed>d#d$��Zed%d&��Zejd'd&��Zd(d)�Zd>d*d+�Zd>d,d-�Zd.d/�Z	
d@d0d1�dAd4d5�Zd;dBd6d7�Zed8e�Zd
S)C�ParseBaseExceptionz7base exception class for all parsing runtime exceptions�int�loc�str�msg�pstrz
typing.Any�parser_elementz%tuple[str, int, typing.Optional[str]]�args�rrrrrrN�typing.Optional[str]�return�NonecCs:|dur	|d}}||_||_||_||_|||f|_dS)N�r)�selfrrr�elemrrr�__init__1s
zParseBaseException.__init__��exc�	Exception�depthcCs�ddl}ddlm}|durt��}g}t|t�r*|�|j�|�dd|j	����|�t
|�j�d|���|dks@|jdurEd�
|�S|j|j|d	�}t�}||d�D]h}|d}|j�d
d�}	t|	|�r�|jj�d�sqqWt|	�|vrxqW|�t|	��t
|	�}
|�|
j�d|
j�d
|	���n$|	dur�t
|	�}
|�|
j�d|
j���n|j}|jdvr�qW|�|j�|d8}|s�nqWd�
|�S)a�
        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.
        rNr)�
ParserElement�^�>z: �
)�contextr)�	parseImpl�
_parseNoCache�.z - )�wrapperz<module>)�inspect�corer%�sys�getrecursionlimit�
isinstancer�appendr�column�typer�
__traceback__�join�getinnerframes�set�f_locals�get�f_code�co_name�
startswith�id�addr
)r"r$r.r%�ret�callers�seen�ff�frm�f_self�	self_type�coderrr�explain_exceptionAsH


 
�
z$ParseBaseException.explain_exceptioncCs||j|j|j|j�S)z�
        internal factory method to simplify creating one type of ParseException
        from another - avoids having __init__ signature conflicts among subclasses
        )rrrr)�cls�perrr�_from_exception�sz"ParseBaseException._from_exceptioncC�t|j|j�S)zG
        Return the line of text where the exception occurred.
        )rrr�rrrrr��zParseBaseException.linecCrM)zV
        Return the 1-based line number of text where the exception occurred.
        )r	rrrNrrrr	�rOzParseBaseException.linenocCrM�z]
        Return the 1-based column on the line of text where the exception occurred.
        �rrrrNrrrr�rOzParseBaseException.colcCrMrPrQrNrrrr4�rOzParseBaseException.columncCsh|jsdS|jt|j�krdSt�|j|j�}|dur!|�d�}n|j|j|jd�}t|��dd�S)Nrzend of textrrz\\�\)rr�len�_exception_word_extractor�match�group�repr�replace)r�found_match�
found_textrrr�found�szParseBaseException.foundcCs|jS�N�rrNrrr�
parserElement�sz ParseBaseException.parserElementcC�
||_dSr\r])rrrrrr^�s
cCs
t�|�Sr\)�copyrNrrrr`��
zParseBaseException.copyc	Cs>|jr	d|j��nd}|j�|�d|j�d|j�d|j�d�	S)Nz, found rz  (at char z	), (line:z, col:�))r[rrr	r4)r�found_phraserrr�formatted_message�s(z$ParseBaseException.formatted_messagecCs|��Sr\)rdrNrrr�__str__��zParseBaseException.__str__cCst|�Sr\)rrNrrr�__repr__�rfzParseBaseException.__repr__z>!<)�markerString�
marker_stringrhcCsL|dur|n|}|j}|jd}|r"|d|��|�||d���}|��S)z�
        Extracts the exception line from the input string, and marks
        the location of the exception with a special symbol.
        Nr)rr4�strip)rrirh�line_str�line_columnrrr�mark_input_line�s
 z"ParseBaseException.mark_input_linecCs|�||�S)a�
        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::

            # an expression to parse 3 integers
            expr = pp.Word(pp.nums) * 3
            try:
                # a failing parse - the third integer is prefixed with "A"
                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``
        )rI)rr$rrr�explain�s'zParseBaseException.explain�
markInputline)rNN)rrrrrrrr)r!)r"r#r$rrr)rr�rr)rrr\)rirrhrrr)r$rrr)rr
r�__doc__�__annotations__�	__slots__r �staticmethodrI�classmethodrLrrr	rr4r[�propertyr^�setterr`rdrergrmrnr
rorrrrrsP

�?



��+rc@�eZdZdZdS)�ParseExceptionaw
    Exception thrown when a parse expression doesn't match the input string

    Example::

        integer = Word(nums).set_name("integer")
        try:
            integer.parse_string("ABC")
        except ParseException as pe:
            print(pe, f"column: {pe.column}")

    prints::

       Expected integer, found 'ABC'  (at char 0), (line:1, col:1) column: 1

    N�rr
rrqrrrrry	�ryc@rx)�ParseFatalExceptionzu
    User-throwable exception thrown when inconsistent parse content
    is found; stops all parsing immediately
    Nrzrrrrr|r{r|c@rx)�ParseSyntaxExceptionz�
    Just like :class:`ParseFatalException`, but thrown internally
    when an :class:`ErrorStop<And._ErrorStop>` ('-' operator) indicates
    that parsing is to stop immediately because an unbacktrackable
    syntax error has been found.
    Nrzrrrrr}#r{r}c@s$eZdZdZd
dd�Zddd�Zd	S)�RecursiveGrammarExceptiona6
    Exception thrown by :class:`ParserElement.validate` if the
    grammar could be left-recursive; parser may need to enable
    left recursion using :class:`ParserElement.enable_left_recursion<ParserElement.enable_left_recursion>`

    Deprecated: only used by deprecated method ParserElement.validate.
    rrcCr_r\��parseElementTrace)r�parseElementListrrrr 5raz"RecursiveGrammarException.__init__rcCsd|j��S)NzRecursiveGrammarException: rrNrrrre8sz!RecursiveGrammarException.__str__N)rrrp)rr
rrqr rerrrrr~,s
r~)!�
__future__rr`�rer0�typing�	functoolsr�unicoder�ppu�utilrrrr	r
�Latin1�LatinA�LatinB�Greek�Cyrillicr�	alphanums�_extract_alphanums�compilerTr#rryr|r}r~rrrr�<module>s&
	�
l