U
    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 krd}n\t|drl| jdd |j | j d  }|rf|d|j d  d|}qrd}n| j}t|drd	|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   H/var/www/html/venv/lib/python3.8/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
   '