a
    Zä%b”  ã                   @   s    d dl Z e  d¡Zddd„ZdS )é    NzA(?P<filename>([a-zA-Z]:)?[^:]+):(?P<line>[0-9]+):\s*(?P<error>.*)é   c              	   C   s‚   |   ¡ }g }t|ƒD ]h\}}t |¡}|r| ¡  ¡ }|||| … |d< zt|d ƒ|d< W n typ   Y n0 | |¡ q|S )a0  Parses latex log output and tries to extract error messages.

    Requires ``-file-line-error`` to be active.

    :param log: The contents of the logfile as a string.
    :param context_size: Number of lines to keep as context, including the
                         original error line.
    :return: A dictionary containig ``line`` (line number, an int), ``error``,
             (the error message), ``filename`` (name of the temporary file
             used for building) and ``context`` (list of lines, starting with
             with the error line).
    ÚcontextÚline)	Ú
splitlinesÚ	enumerateÚLATEX_ERR_REÚmatchÚ	groupdictÚcopyÚintÚ	TypeErrorÚappend)ÚlogZcontext_sizeÚlinesÚerrorsÚnr   ÚmÚerr© r   ú\/Users/vegardjervell/Documents/master/model/venv/lib/python3.9/site-packages/latex/errors.pyÚ	parse_log   s    
r   )r   )ÚreÚcompiler   r   r   r   r   r   Ú<module>   s   
