o
    灛i                     @   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                   @   sT   e Zd ZdZdZdefddZddee dej	d	ee f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r6| jdd |j | j d  }|r3|d|j d  d|}nd}n| j}t|drGd	|j|j|n|}| j
rS|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   source_excerptmessage r   X/sda-disk/www/egybert/egybert_env/lib/python3.10/site-packages/triton/compiler/errors.py_format_message
   s$   

"z CompilationError._format_messageNr   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__r   )__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    '