o
    ÀÜÓh‚  ã                   @   sL   d dl Z d dlmZmZ G dd„ deƒZG dd„ deƒZG dd„ deƒZdS )	é    N)ÚOptionalÚUnionc                   @   sl   e Zd ZdZdefdd„Zdee dejde	edf fd	d
„Z
dee fdd„Zdd„ Zdd„ Zdd„ ZdS )ÚCompilationErroré   Úreturnc                 C   sŠ   | j }| jd u rd}n%| j d¡d |j… | j d … }|r.| d|j d ¡ d |¡}nd}d |j|j|¡}| j	rC|d| j	 7 }|S )Nz <source unavailable>Ú
ú ú^z <source empty>zat {}:{}:{})
ÚnodeÚsrcÚsplitÚlinenoÚ source_line_count_max_in_messageÚappendÚ
col_offsetÚjoinÚformatÚerror_message)Úselfr
   Úsource_excerptÚmessage© r   úL/var/www/html/ai/venv/lib/python3.10/site-packages/triton/compiler/errors.pyÚ_format_message   s   
"z CompilationError._format_messager   r
   r   Nc                 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   || _ |  ¡ | _d S r   )r   r   r   )r   r   r   r   r   Úset_source_code   s   z CompilationError.set_source_codec                 C   s   | j S r   )r   ©r   r   r   r   Ú__str__#   s   zCompilationError.__str__c                 C   s   d  t| ƒj| j¡S )Nz{}({!r}))r   ÚtypeÚ__name__r   r   r   r   r   Ú__repr__&   s   zCompilationError.__repr__c                 C   s   t | ƒ| j| j| jffS r   )r   r   r
   r   r   r   r   r   Ú
__reduce__)   s   zCompilationError.__reduce__)r    Ú
__module__Ú__qualname__r   Ústrr   r   ÚastÚASTr   r   r   r   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$   Ú__doc__r   r   r   r   r(   .   s    r(   c                   @   s   e Zd ZdS )ÚUnsupportedLanguageConstructN)r    r#   r$   r   r   r   r   r*   3   s    r*   )r&   Útypingr   r   Ú	Exceptionr   r(   r*   r   r   r   r   Ú<module>   s
    )