B
    `              2   @   s.  d Z ddlZddlmZ ddlmZmZmZmZm	Z	m
Z
mZmZmZmZ ddlmZ dgZedededejd	ed
ejd	ejdejd	ejdejdejdejd	ejdejdejdejd	ejdede
d
ejdej dej!dej"dej	de	diZ#ddddddddddddd d!d!d"d#d$d%d&Z$d'd( Z%G d)d deZ&dS )*z
    pygments.formatters.irc
    ~~~~~~~~~~~~~~~~~~~~~~~

    Formatter for IRC output

    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)	Formatter)
KeywordNameCommentStringErrorNumberOperatorGenericToken
Whitespace)get_choice_optIRCFormatter) r   )graybrightblack)cyan
brightcyan)blue
brightblue)magentar   )greenbrightgreen)Z_cyan_Z_brightcyan_)Z_green_Z_brightgreen_)r   r   )red	brightred)r   r   )yellowr   )r   r   )z**z**)z	*magenta*z*brightmagenta*)_brightred_r                           	   
                  )ZwhiteZblackr   r   r   r   r   Zoranger   ZbrightyellowZ
lightgreenr   r   Z	lightbluer   r   Zbrightmagentar   r   c             C   s   t | dk r|S d }}d| kr:|d7 }d| }| d} d| kr\|d7 }d| }| d} t | dkr|dtt|  d	 7 }d| }|| | S )Nr   r   _*r   r   <>z</)lenstripstrIRC_COLOR_MAPzfill)colortextaddsub r<   _/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/pygments/formatters/irc.py	ircformatN   s     

r>   c               @   s@   e Zd ZdZdZddgZg Zdd Zdd Zdd	 Z	d
d Z
dS )r   aS  
    Format tokens with IRC color sequences

    The `get_style_defs()` method doesn't do anything special since there is
    no support for common styles.

    Options accepted:

    `bg`
        Set to ``"light"`` or ``"dark"`` depending on the terminal's background
        (default: ``"light"``).

    `colorscheme`
        A dictionary mapping token types to (lightbg, darkbg) color names or
        ``None`` (default: ``None`` = use builtin colorscheme).

    `linenos`
        Set to ``True`` to have line numbers in the output as well
        (default: ``False`` = no line numbers).
    ZIRCZircc             K   sP   t j| f| t|dddgddk| _|dd p4t| _|dd| _d| _d S )NbglightZdarkcolorschemelinenosFr   )	r   __init__r   darkbgget
IRC_COLORSrA   rB   _lineno)selfoptionsr<   r<   r=   rC   |   s    zIRCFormatter.__init__c             C   s"   |  j d7  _ |d| j   d S )Nr   z
%04d: )rG   write)rH   outfiler<   r<   r=   _write_lineno   s    zIRCFormatter._write_linenoc          	   C   s   |  | x|D ]\}}|dr8|  | |d d }| j|}x$|d krh|d d }| j|}qFW |r|| j }|d}x:|d d D ]*}|  | |r|t||d d  qW |d r|t||d  q|| qW |d d S )N
)rL   endswithrA   rE   rD   splitrJ   r>   )rH   tokensourcerK   ttypevaluer8   splliner<   r<   r=   _format_unencoded_with_lineno   s(    






z*IRCFormatter._format_unencoded_with_linenoc             C   s   | j r| || d S x|D ]\}}| j|}x$|d krT|d d }| j|}q2W |r|| j }|d}x2|d d D ]"}|r|t|| |d q|W |d r|t||d  q|| qW d S )NrN   rM   )rB   rV   rA   rE   rD   rP   rJ   r>   )rH   rQ   rK   rR   rS   r8   rT   rU   r<   r<   r=   format_unencoded   s$    


zIRCFormatter.format_unencodedN)__name__
__module____qualname____doc__namealiases	filenamesrC   rL   rV   rW   r<   r<   r<   r=   r   c   s   )'r[   sysZpygments.formatterr   Zpygments.tokenr   r   r   r   r   r   r	   r
   r   r   Zpygments.utilr   __all__ZPreprocTypeWordZBuiltinZFunction	NamespaceZClass	ExceptionZ	DecoratorVariableZConstant	AttributeTagZDeletedZInsertedZHeadingZ
SubheadingrF   r6   r>   r   r<   r<   r<   r=   <module>	   sf   0