a
    ç´«jÅ  ã                   @  sP  U d dl mZ d dlZd dlZd dlmZ d dlmZmZ ddl	m
Z
 erZd dlmZmZ eG dd	„ d	ƒƒZG d
d„ deƒZe d¡e d¡e d¡e d¡e d¡e d¡e dej¡e d¡e d¡e d¡e d¡e dej¡e e
jejejB ¡e d¡e d¡e d¡e d¡e d¡e d¡e d¡dœZd ed!< G d"d#„ d#ƒZdS )$é    )ÚannotationsN)Ú	dataclass)ÚTYPE_CHECKINGÚNoReturné   )Ú	Specifier)Ú	GeneratorÚMappingc                   @  s*   e Zd ZU dZded< ded< ded< dS )ÚToken)ÚnameÚpositionÚtextÚstrr   r   Úintr   N)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__Ú__annotations__© r   r   úS/var/www/html/laksyashrimp/venv/lib/python3.9/site-packages/packaging/_tokenizer.pyr
      s   
r
   c                      s:   e Zd ZdZdddddœ‡ fdd„Zddœd	d
„Z‡  ZS )ÚParserSyntaxErrorz7The provided source text could not be parsed correctly.r   ztuple[int, int]ÚNone)ÚmessageÚsourceÚspanÚreturnc                  s    || _ || _|| _tƒ  ¡  d S )N)r   r   r   ÚsuperÚ__init__)Úselfr   r   r   ©Ú	__class__r   r   r      s    zParserSyntaxError.__init__©r   c                 C  sB   d| j d  d| j d | j d    d }| j› d| j› d|› �S )Nú r   ú~r   ú^z
    )r   r   r   )r   Úmarkerr   r   r   Ú__str__'   s    *zParserSyntaxError.__str__)r   r   r   Ú__doc__r   r'   Ú__classcell__r   r   r    r   r      s   r   z\(z\)z\[z\]ú;ú,zk
            (
                ('[^']*')
                |
                ("[^"]*")
            )
        z(===|==|~=|!=|<=|>=|<|>)z\b(or|and)\bz\bin\bz\bnot\ba¬  
            \b(
                python_version
                |python_full_version
                |os[._]name
                |sys[._]platform
                |platform_(release|system)
                |platform[._](version|machine|python_implementation)
                |python_implementation
                |implementation_(name|version)
                |extras?
                |dependency_groups
            )\b
        z\@z[^ \t]+z\b[a-zA-Z0-9][a-zA-Z0-9._-]*\bz\.\*z\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*z[ \t]+z\Z)ZLEFT_PARENTHESISZRIGHT_PARENTHESISZLEFT_BRACKETZRIGHT_BRACKETÚ	SEMICOLONÚCOMMAZQUOTED_STRINGÚOPÚBOOLOPÚINÚNOTÚVARIABLEZ	SPECIFIERÚATÚURLÚ
IDENTIFIERZVERSION_PREFIX_TRAILZVERSION_LOCAL_LABEL_TRAILZWSZENDzdict[str, re.Pattern[str]]ÚDEFAULT_RULESc                   @  s¤   e Zd ZdZdZddddœdd„Zddd	œd
d„Zddœddddœdd„Zddddœdd„Zddœdd„Z	dddœdddddœdd„Z
ejdddd d!œd"d#„ƒZdS )$Ú	Tokenizerz„Context-sensitive token parsing.

    Provides methods to examine the input stream to check whether the next token
    matches.
    )Ú
next_tokenr   Úrulesr   r   zMapping[str, re.Pattern[str]]r   )r   r9   r   c                C  s   || _ || _d | _d| _d S )Nr   )r   r9   r8   r   )r   r   r9   r   r   r   r   i   s    zTokenizer.__init__)r   r   c                 C  s   |   |¡r|  ¡  dS )z8Move beyond provided token name, if at current position.N)ÚcheckÚread)r   r   r   r   r   Úconsumet   s    
zTokenizer.consumeF)ÚpeekÚbool)r   r=   r   c                C  sz   | j du s J d|›d| j ›�ƒ‚|| jv s8J d|›�ƒ‚| j| }| | j| j¡}|du r^dS |svt||d | jƒ| _ dS )zÿCheck whether the next token has the provided name.

        By default, if the check succeeds, the token *must* be read before
        another check. If `peek` is set to `True`, the token is not loaded and
        would need to be checked again.
        NzCannot check for z, already have zUnknown token name: Fr   T)r8   r9   Úmatchr   r   r
   )r   r   r=   Z
expressionr?   r   r   r   r:   y   s    ÿ
zTokenizer.checkr
   )r   Úexpectedr   c                C  s"   |   |¡s|  d|› �¡‚|  ¡ S )zzExpect a certain token name next, failing with a syntax error otherwise.

        The token is read and returned.
        z	Expected )r:   Úraise_syntax_errorr;   )r   r   r@   r   r   r   ÚexpectŽ   s    
zTokenizer.expectr"   c                 C  s0   | j }|dusJ ‚|  jt|jƒ7  _d| _ |S )z%Consume the next token and return it.N)r8   r   Úlenr   )r   Útokenr   r   r   r;   —   s
    zTokenizer.readN)Ú
span_startÚspan_endz
int | Noner   )r   rE   rF   r   c                C  s8   |du r| j n||du r| j n|f}t|| j|d�‚dS )z.Raise ParserSyntaxError at the given position.N)r   r   )r   r   r   )r   r   rE   rF   r   r   r   r   rA   ¡   s    	þýzTokenizer.raise_syntax_errorzGenerator[None, None, None])Ú
open_tokenÚclose_tokenÚaroundr   c                c  sf   |   |¡r| j}|  ¡  nd }d V  |d u r0d S |   |¡sZ| jd|› d|› d|› �|d� |  ¡  d S )NzExpected matching z for z, after )rE   )r:   r   r;   rA   )r   rG   rH   rI   Zopen_positionr   r   r   Úenclosing_tokens³   s    


þzTokenizer.enclosing_tokens)r   r   r   r(   r   r   r<   r:   rB   r;   rA   Ú
contextlibÚcontextmanagerrJ   r   r   r   r   r7   `   s   	ûr7   )Ú
__future__r   rK   ÚreÚdataclassesr   Útypingr   r   Ú
specifiersr   Úcollections.abcr   r	   r
   Ú	Exceptionr   ÚcompileÚVERBOSEZ_specifier_regex_strÚ
IGNORECASEr6   r   r7   r   r   r   r   Ú<module>   sR   ø
ñ
þÐ4