a
    kº”hÄ  ã                   @   sT   d dl Z d dlmZ ddlmZ G dd„ deƒZG dd„ deƒZG d	d
„ d
eƒZdS )é    N)ÚOptionalé   )ÚTritonErrorc                   @   sP   e Zd ZdZdZedœdd„Zdee ej	ee dœdd	„Z
d
d„ Zdd„ ZdS )ÚCompilationErrorz3Base class for all errors raised during compilationé   )Úreturnc                 C   sª   | j }| jd u rd}n\t|dƒrl| j d¡d |j… | j d … }|rf| d|j d ¡ d |¡}qrd}n| j}t|dƒrŽd 	|j|j|¡n|}| j
r¦|d| j
 7 }|S )Nz <source unavailable>ÚlinenoÚ
ú ú^z <source empty>zat {}:{}:
{})ÚnodeÚsrcÚhasattrÚsplitr   Ú source_line_count_max_in_messageÚappendÚ
col_offsetÚjoinÚformatÚerror_message)Úselfr   Zsource_excerptÚmessage© r   úD/var/www/auris/lib/python3.9/site-packages/triton/compiler/errors.pyÚ_format_message
   s$    

"ÿÿz CompilationError._format_messageN)r   r   r   c                 C   s    || _ || _|| _|  ¡ | _d S ©N)r   r   r   r   r   )r   r   r   r   r   r   r   Ú__init__   s    zCompilationError.__init__c                 C   s   | j S r   )r   ©r   r   r   r   Ú__str__%   s    zCompilationError.__str__c                 C   s   t | ƒ| j| j| jffS r   )Útyper   r   r   r   r   r   r   Ú
__reduce__(   s    zCompilationError.__reduce__)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústrr   r   ÚastÚASTr   r   r    r   r   r   r   r      s   r   c                   @   s   e Zd ZdZdS )ÚCompileTimeAssertionFailurezBSpecific exception for failed tests in `static_assert` invocationsN)r!   r"   r#   r$   r   r   r   r   r(   -   s   r(   c                   @   s   e Zd ZdS )ÚUnsupportedLanguageConstructN)r!   r"   r#   r   r   r   r   r)   2   s   r)   )r&   Útypingr   Úerrorsr   r   r(   r)   r   r   r   r   Ú<module>   s
   '