B
    `a[              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-2017 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   )	lightgraydarkgray)teal	turquoise)darkblueblue)purplefuchsia)	darkgreengreen)Z_teal_Z_turquoise_)Z_darkgreen_Z_green_)r   r   )darkredred)r   r   )brownr   )r   r   )z**z**)z*purple*z	*fuchsia*)_red_r                           	   
                  )ZwhiteZblackr   r   r   r   r   Zoranger   ZyellowZ
lightgreenr   r   Z	lightbluer   r   r   r   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=   6lib/python3.7/site-packages/pygments/formatters/irc.py	ircformatO   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 )NZbgZlightZdarkcolorschemelinenosFr   )	r   __init__r   darkbgget
IRC_COLORSr@   rA   _lineno)selfZoptionsr=   r=   r>   rB   }   s    zIRCFormatter.__init__c             C   s"   |  j d7  _ |d| j   d S )Nr   z
%04d: )rF   write)rG   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
)rJ   endswithr@   rD   rC   splitrH   r?   )rG   tokensourcerI   ttypevaluer9   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 )NrL   rK   )rA   rT   r@   rD   rC   rN   rH   r?   )rG   rO   rI   rP   rQ   r9   rR   rS   r=   r=   r>   format_unencoded   s$    


zIRCFormatter.format_unencodedN)__name__
__module____qualname____doc__namealiases	filenamesrB   rJ   rT   rU   r=   r=   r=   r>   r   d   s   )'rY   sysZpygments.formatterr   Zpygments.tokenr   r   r   r   r   r   r	   r
   r   r   Zpygments.utilr   __all__ZPreprocZTypeZWordZBuiltinZFunctionZ	NamespaceZClass	ExceptionZ	DecoratorZVariableZConstantZ	AttributeZTagZDeletedZInsertedZHeadingZ
SubheadingrE   r7   r?   r   r=   r=   r=   r>   <module>
   sf   0