B
    |?_[                 @   sh  d Z G dd deZG dd deZG dd deZG dd deZG d	d
 d
eZG dd deZG dd deZG dd deZ	G dd deZ
G dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd  d eZG d!d" d"eZG d#d$ d$eZG d%d& d&eZG d'd( d(eZG d)d* d*eZG d+d, d,eZd-S ).Tc               @   sV   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Ze	dd Z
dddZdd ZdS )Token)
start_markend_mark_commentc             C   s   || _ || _d S )N)r   r   )selfr   r    r   1lib/python3.7/site-packages/ruamel_yaml/tokens.py__init__   s    zToken.__init__c                sj   dd  j D }|  d fdd|D }trZy|dt jj 7 }W n   Y nX d jj	|S )Nc             S   s   g | ]}| d s|qS )Z_mark)endswith).0keyr   r   r   
<listcomp>   s    z"Token.__repr__.<locals>.<listcomp>z, c                s   g | ]}d |t  |f qS )z%s=%r)getattr)r
   r   )r   r   r   r      s   z, line: z{}({}))
	__slots__sortjoin	SHOWLINESstrr   lineformat	__class____name__)r   Z
attributesZ	argumentsr   )r   r   __repr__   s    
zToken.__repr__c             C   s"   t | dsd d g| _|| jd< d S )Nr       )hasattrr   )r   commentr   r   r   add_post_comment!   s    

zToken.add_post_commentc             C   s4   t | dsd d g| _| jd d ks&t|| jd< d S )Nr      )r   r   AssertionError)r   Zcommentsr   r   r   add_pre_comments'   s    

zToken.add_pre_commentsc             C   s   t | dd S )Nr   )r   )r   r   r   r   get_comment.   s    zToken.get_commentc             C   s   t | dd S )Nr   )r   )r   r   r   r   r   2   s    zToken.commentFc             C   s   | j }|dkrdS t|tr dS t| d |j }|s\|rR|d |d dd|d g}||_| S |d rl|d s||d r|d rtd| ||d r|d |d< |d r|d |d< | S )zmove a comment from this token to target (normally next token)
        used to combine e.g. comments before a BlockEntryToken to the
        ScalarToken that follows it
        empty is a special for empty values -> comment after key
        Nr   r   r   zoverlap in comment %r %r)r   
isinstanceStreamEndTokendelattrr   NotImplementedError)r   targetemptycZtcr   r   r   move_comment7   s&    

 zToken.move_commentc             C   sD   | j }|dks|d dkrdS |d dg}|d dkr@t| d |S )z split the post part of a comment, and return it
        as comment to be added. Delete second part if [None, None]
         abc:  # this goes to sequence
           # this goes to first element
           - first element
        Nr   r   r   )r   r"   )r   r   Zret_valr   r   r   split_commentU   s    
zToken.split_commentN)F)r   
__module____qualname__r   r   r   r   r   r   propertyr   r'   r(   r   r   r   r   r   
   s   
r   c               @   s   e Zd ZdZdZdd ZdS )DirectiveToken)namevaluez<directive>c             C   s   t | || || _|| _d S )N)r   r   r-   r.   )r   r-   r.   r   r   r   r   r   r   m   s    zDirectiveToken.__init__N)r   r)   r*   r   idr   r   r   r   r   r,   i   s   r,   c               @   s   e Zd ZdZdZdS )DocumentStartTokenr   z<document start>N)r   r)   r*   r   r/   r   r   r   r   r0   t   s   r0   c               @   s   e Zd ZdZdZdS )DocumentEndTokenr   z<document end>N)r   r)   r*   r   r/   r   r   r   r   r1   y   s   r1   c               @   s   e Zd ZdZdZdddZdS )StreamStartToken)encodingz<stream start>Nc             C   s   t | || || _d S )N)r   r   r3   )r   r   r   r3   r   r   r   r      s    zStreamStartToken.__init__)NNN)r   r)   r*   r   r/   r   r   r   r   r   r2   ~   s   r2   c               @   s   e Zd ZdZdZdS )r!   r   z<stream end>N)r   r)   r*   r   r/   r   r   r   r   r!      s   r!   c               @   s   e Zd ZdZdZdS )BlockSequenceStartTokenr   z<block sequence start>N)r   r)   r*   r   r/   r   r   r   r   r4      s   r4   c               @   s   e Zd ZdZdZdS )BlockMappingStartTokenr   z<block mapping start>N)r   r)   r*   r   r/   r   r   r   r   r5      s   r5   c               @   s   e Zd ZdZdZdS )BlockEndTokenr   z<block end>N)r   r)   r*   r   r/   r   r   r   r   r6      s   r6   c               @   s   e Zd ZdZdZdS )FlowSequenceStartTokenr   [N)r   r)   r*   r   r/   r   r   r   r   r7      s   r7   c               @   s   e Zd ZdZdZdS )FlowMappingStartTokenr   {N)r   r)   r*   r   r/   r   r   r   r   r9      s   r9   c               @   s   e Zd ZdZdZdS )FlowSequenceEndTokenr   ]N)r   r)   r*   r   r/   r   r   r   r   r;      s   r;   c               @   s   e Zd ZdZdZdS )FlowMappingEndTokenr   }N)r   r)   r*   r   r/   r   r   r   r   r=      s   r=   c               @   s   e Zd ZdZdZdS )KeyTokenr   ?N)r   r)   r*   r   r/   r   r   r   r   r?      s   r?   c               @   s   e Zd ZdZdZdS )
ValueTokenr   :N)r   r)   r*   r   r/   r   r   r   r   rA      s   rA   c               @   s   e Zd ZdZdZdS )BlockEntryTokenr   -N)r   r)   r*   r   r/   r   r   r   r   rC      s   rC   c               @   s   e Zd ZdZdZdS )FlowEntryTokenr   ,N)r   r)   r*   r   r/   r   r   r   r   rE      s   rE   c               @   s   e Zd ZdZdZdd ZdS )
AliasToken)r.   z<alias>c             C   s   t | || || _d S )N)r   r   r.   )r   r.   r   r   r   r   r   r      s    zAliasToken.__init__N)r   r)   r*   r   r/   r   r   r   r   r   rG      s   rG   c               @   s   e Zd ZdZdZdd ZdS )AnchorToken)r.   z<anchor>c             C   s   t | || || _d S )N)r   r   r.   )r   r.   r   r   r   r   r   r      s    zAnchorToken.__init__N)r   r)   r*   r   r/   r   r   r   r   r   rH      s   rH   c               @   s   e Zd ZdZdZdd ZdS )TagToken)r.   z<tag>c             C   s   t | || || _d S )N)r   r   r.   )r   r.   r   r   r   r   r   r      s    zTagToken.__init__N)r   r)   r*   r   r/   r   r   r   r   r   rI      s   rI   c               @   s   e Zd ZdZdZdddZdS )ScalarToken)r.   plainstylez<scalar>Nc             C   s$   t | || || _|| _|| _d S )N)r   r   r.   rK   rL   )r   r.   rK   r   r   rL   r   r   r   r      s    zScalarToken.__init__)N)r   r)   r*   r   r/   r   r   r   r   r   rJ      s   rJ   c               @   s,   e Zd ZdZdZdd Zdd Zdd Zd	S )
CommentToken)r.   pre_donez	<comment>c             C   s   t | || || _d S )N)r   r   r.   )r   r.   r   r   r   r   r   r      s    zCommentToken.__init__c             C   s   t | drt| d d S )NrN   )r   r"   )r   r   r   r   reset   s    
zCommentToken.resetc             C   s@   d | j}tr6y|dt| jj 7 }W n   Y nX d |S )Nz{!r}z, line: zCommentToken({}))r   r.   r   r   r   r   )r   vr   r   r   r      s    zCommentToken.__repr__N)r   r)   r*   r   r/   r   rO   r   r   r   r   r   rM      s
   rM   N)r   objectr   r,   r0   r1   r2   r!   r4   r5   r6   r7   r9   r;   r=   r?   rA   rC   rE   rG   rH   rI   rJ   rM   r   r   r   r   <module>   s.    _
	


