U
    Æ½„bó  ã                   @   s0   d Z dgZdd„ Zddd„ZG dd„ deƒZdS )	z!Error classes used by simplejson
ÚJSONDecodeErrorc                 C   s>   |   dd|¡d }|dkr$|d }n||  dd|¡ }||fS )NÚ
é    é   )ÚcountÚrindex)ÚdocÚposÚlinenoÚcolno© r   ú5/tmp/pip-unpacked-wheel-9yxrzpkm/simplejson/errors.pyÚlinecol   s
    
r   Nc           	      C   sn   t ||ƒ\}}|  dt|||d … ƒ¡} |d krFd}|| |||f S t ||ƒ\}}d}|| ||||||f S )Nz%rr   z%s: line %d column %d (char %d)z8%s: line %d column %d - line %d column %d (char %d - %d))r   ÚreplaceÚrepr)	Úmsgr   r   Úendr	   r
   ÚfmtÚ	endlinenoÚendcolnor   r   r   Úerrmsg   s    r   c                   @   s"   e Zd ZdZddd„Zdd„ ZdS )r   aØ  Subclass of ValueError with the following additional properties:

    msg: The unformatted error message
    doc: The JSON document being parsed
    pos: The start index of doc where parsing failed
    end: The end index of doc where parsing failed (may be None)
    lineno: The line corresponding to pos
    colno: The column corresponding to pos
    endlineno: The line corresponding to end (may be None)
    endcolno: The column corresponding to end (may be None)

    Nc              	   C   sn   t  | t||||d�¡ || _|| _|| _|| _t||ƒ\| _| _	|d k	r^t||ƒ\| _
| _nd\| _
| _d S )N)r   )NN)Ú
ValueErrorÚ__init__r   r   r   r   r   r   r	   r
   r   r   )Úselfr   r   r   r   r   r   r   r   (   s    zJSONDecodeError.__init__c                 C   s   | j | j| j| j| jffS )N)Ú	__class__r   r   r   r   )r   r   r   r   Ú
__reduce__4   s    zJSONDecodeError.__reduce__)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s   
)N)r   Ú__all__r   r   r   r   r   r   r   r   Ú<module>   s   	
