Your IP : 18.118.126.69


Current Path : /usr/lib64/python3.6/site-packages/yaml/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/yaml/__pycache__/parser.cpython-36.opt-1.pyc

3

<z�W�c�@sNddgZddlmZddlTddlTddlTGdd�de�ZGdd�d�ZdS)�Parser�ParserError�)�MarkedYAMLError)�*c@seZdZdS)rN)�__name__�
__module__�__qualname__�r	r	�/usr/lib64/python3.6/parser.pyrEsc@seZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdDd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�ZdEd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�ZdFd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"dCS)Gr�!ztag:yaml.org,2002:)rz!!cCs*d|_d|_i|_g|_g|_|j|_dS)N)�
current_event�yaml_version�tag_handles�states�marks�parse_stream_start�state)�selfr	r	r
�__init__QszParser.__init__cCsg|_d|_dS)N)rr)rr	r	r
�disposeYszParser.disposecGsN|jdkr|jr|j�|_|jdk	rJ|s,dSx|D]}t|j|�r2dSq2WdS)NTF)rr�
isinstance)r�choicesZchoicer	r	r
�check_event^s



zParser.check_eventcCs |jdkr|jr|j�|_|jS)N)rr)rr	r	r
�
peek_eventks

zParser.peek_eventcCs*|jdkr|jr|j�|_|j}d|_|S)N)rr)r�valuer	r	r
�	get_eventrs

zParser.get_eventcCs(|j�}t|j|j|jd�}|j|_|S)N)�encoding)�	get_tokenZStreamStartEvent�
start_mark�end_markr�parse_implicit_document_startr)r�token�eventr	r	r
rs


zParser.parse_stream_startcCs\|jttt�sP|j|_|j�}|j}}t||dd�}|j	j
|j�|j|_
|S|j�SdS)NF)�explicit)�check_token�DirectiveToken�DocumentStartToken�StreamEndToken�DEFAULT_TAGSr�
peek_tokenr�DocumentStartEventr�append�parse_document_end�parse_block_noder�parse_document_start)rr!rrr"r	r	r
r �s
z$Parser.parse_implicit_document_startcCs�x|jt�r|j�qW|jt�s�|j�}|j}|j�\}}|jt�sdtddd|j�j	|j�j��|j�}|j
}t||d||d�}|jj
|j�|j|_n|j�}t|j|j
�}d|_|S)Nz)expected '<document start>', but found %rT)r#�version�tags)r$�DocumentEndTokenrr'r)r�process_directivesr&r�idrr*rr+r,�parse_document_contentrZStreamEndEvent)rr!rr/r0rr"r	r	r
r.�s*



zParser.parse_document_startcCsL|j�}|j}}d}|jt�r2|j�}|j}d}t|||d�}|j|_|S)NFT)r#)	r)rr$r1rrZDocumentEndEventr.r)rr!rrr#r"r	r	r
r,�s

zParser.parse_document_endcCs<|jtttt�r0|j|j�j�}|jj	�|_
|S|j�SdS)N)r$r%r&r1r'�process_empty_scalarr)rr�poprr-)rr"r	r	r
r4�s
zParser.parse_document_contentcCsd|_i|_x�|jt�r�|j�}|jdkrp|jdk	rDtddd|j��|j\}}|dkrftddd|j��|j|_q|jdkr|j\}}||jkr�tddd||j��||j|<qW|jr�|j|jj	�f}n
|jdf}x(|j
D]}||jkr�|j
||j|<q�W|S)NZYAMLzfound duplicate YAML directiverz:found incompatible YAML document (version 1.* is required)ZTAGzduplicate tag handle %r)r
rr$r%r�namerrr�copyr()rr!�major�minor�handle�prefixr�keyr	r	r
r2�s8









zParser.process_directivescCs|jdd�S)NT)�block)�
parse_node)rr	r	r
r-szParser.parse_block_nodecCs|j�S)N)r?)rr	r	r
�parse_flow_nodeszParser.parse_flow_nodecCs|jddd�S)NT)r>�indentless_sequence)r?)rr	r	r
�'parse_block_node_or_indentless_sequencesz.Parser.parse_block_node_or_indentless_sequenceFc	CsR|jt�r4|j�}t|j|j|j�}|jj�|_	�nd}d}d}}}	|jt
�r�|j�}|j}|j}|j}|jt�r�|j�}|j}	|j}|j}nF|jt�r�|j�}|j}}	|j}|j}|jt
�r�|j�}|j}|j}|dk	�r&|\}
}|
dk	�r"|
|jk�rt
d|d|
|	��|j|
|}n|}|dk�r>|j�j}}d}|dk�pR|dk}|�r�|jt��r�|j�j}t|||||�}|j|_	�n�|jt��r|j�}|j}|j�r�|dk�s�|dk�r�d
}n|dk�r�d}nd}t||||j|||jd�}|jj�|_	�nH|jt��r<|j�j}t|||||dd�}|j|_	�n|jt��rp|j�j}t|||||dd�}|j|_	n�|�r�|jt��r�|j�j}t|||||dd�}|j|_	n�|�r�|jt��r�|j�j}t|||||dd�}|j|_	nj|dk	�s�|dk	�rt|||dfd||�}|jj�|_	n2|�r(d	}
nd
}
|j�}t
d|
|d|j|j��|S)Nzwhile parsing a nodezfound undefined tag handle %rrTF)�style)�
flow_style�r>Zflowzwhile parsing a %s nodez'expected the node content, but found %r)TF)FT)FF) r$Z
AliasTokenrZ
AliasEventrrrrr6rZAnchorTokenZTagTokenrrr)�BlockEntryTokenZSequenceStartEvent�parse_indentless_sequence_entryZScalarTokenZplain�ScalarEventrCZFlowSequenceStartToken�parse_flow_sequence_first_entryZFlowMappingStartToken�MappingStartEvent�parse_flow_mapping_first_keyZBlockSequenceStartToken� parse_block_sequence_first_entryZBlockMappingStartToken�parse_block_mapping_first_keyr3)rr>rAr!r"Zanchor�tagrrZtag_markr;�suffixZimplicitZnoder	r	r
r?s�


















zParser.parse_nodecCs|j�}|jj|j�|j�S)N)rrr+r�parse_block_sequence_entry)rr!r	r	r
rLxsz'Parser.parse_block_sequence_first_entrycCs�|jt�rH|j�}|jtt�s4|jj|j�|j�S|j|_|j	|j
�S|jt�sv|j�}td|j
dd|j|j��|j�}t|j|j
�}|jj�|_|j
j�|S)Nz while parsing a block collectionrz"expected <block end>, but found %r���)r$rFr�
BlockEndTokenrr+rPr-rr5rr)rrr3r�SequenceEndEventr6)rr!r"r	r	r
rP}s 


z!Parser.parse_block_sequence_entrycCsr|jt�rL|j�}|jtttt�s8|jj|j�|j	�S|j|_
|j|j�S|j
�}t|j|j�}|jj�|_
|S)N)r$rFr�KeyToken�
ValueTokenrRrr+rGr-rr5rr)rSrr6)rr!r"r	r	r
rG�s

z&Parser.parse_indentless_sequence_entrycCs|j�}|jj|j�|j�S)N)rrr+r�parse_block_mapping_key)rr!r	r	r
rM�sz$Parser.parse_block_mapping_first_keycCs�|jt�rJ|j�}|jttt�s6|jj|j�|j�S|j|_	|j
|j�S|jt�sx|j�}t
d|jdd|j|j��|j�}t|j|j�}|jj�|_	|jj�|S)Nzwhile parsing a block mappingrz"expected <block end>, but found %rrQ)r$rTrrUrRrr+�parse_block_mapping_valuerBrr5rr)rrr3r�MappingEndEventr6)rr!r"r	r	r
rV�s 


zParser.parse_block_mapping_keycCsl|jt�rL|j�}|jttt�s6|jj|j�|j�S|j|_	|j
|j�Sn|j|_	|j�}|j
|j
�SdS)N)r$rUrrTrRrr+rVrBrr5rr)r)rr!r	r	r
rW�s
z Parser.parse_block_mapping_valuecCs"|j�}|jj|j�|jdd�S)NT)�first)rrr+r�parse_flow_sequence_entry)rr!r	r	r
rI�sz&Parser.parse_flow_sequence_first_entrycCs�|jt�s�|sF|jt�r"|j�n$|j�}td|jdd|j|j��|jt	�r||j�}t
ddd|j|jdd�}|j|_
|S|jt�s�|jj|j�|j�S|j�}t|j|j�}|jj�|_
|jj�|S)Nzwhile parsing a flow sequencerzexpected ',' or ']', but got %rT)rDrQ)r$�FlowSequenceEndToken�FlowEntryTokenrr)rrr3rrTrJr�%parse_flow_sequence_entry_mapping_keyrrr+rZr@rSr6)rrYr!r"r	r	r
rZ�s,





z Parser.parse_flow_sequence_entrycCsD|j�}|jttt�s,|jj|j�|j�S|j|_	|j
|j�SdS)N)rr$rUr\r[rr+�'parse_flow_sequence_entry_mapping_valuer@rr5r)rr!r	r	r
r]�sz,Parser.parse_flow_sequence_entry_mapping_keycCsj|jt�rJ|j�}|jtt�s4|jj|j�|j�S|j|_	|j
|j�Sn|j|_	|j�}|j
|j
�SdS)N)r$rUrr\r[rr+�%parse_flow_sequence_entry_mapping_endr@rr5rr)r)rr!r	r	r
r^s
z.Parser.parse_flow_sequence_entry_mapping_valuecCs|j|_|j�}t|j|j�S)N)rZrr)rXr)rr!r	r	r
r_sz,Parser.parse_flow_sequence_entry_mapping_endcCs"|j�}|jj|j�|jdd�S)NT)rY)rrr+r�parse_flow_mapping_key)rr!r	r	r
rKsz#Parser.parse_flow_mapping_first_keycCs�|jt�s�|sF|jt�r"|j�n$|j�}td|jdd|j|j��|jt	�r�|j�}|jt
tt�s||jj|j
�|j�S|j
|_|j|j�Sn |jt�s�|jj|j�|j�S|j�}t|j|j�}|jj�|_|jj�|S)Nzwhile parsing a flow mappingrzexpected ',' or '}', but got %rrQ)r$�FlowMappingEndTokenr\rr)rrr3rrTrUrr+�parse_flow_mapping_valuer@rr5r�parse_flow_mapping_empty_valuerXr6)rrYr!r"r	r	r
r`s.





zParser.parse_flow_mapping_keycCsj|jt�rJ|j�}|jtt�s4|jj|j�|j�S|j|_	|j
|j�Sn|j|_	|j�}|j
|j
�SdS)N)r$rUrr\rarr+r`r@rr5rr)r)rr!r	r	r
rb9s
zParser.parse_flow_mapping_valuecCs|j|_|j|j�j�S)N)r`rr5r)r)rr	r	r
rcGsz%Parser.parse_flow_mapping_empty_valuecCstdddd||�S)NTFrE)TF)rH)rZmarkr	r	r
r5KszParser.process_empty_scalarN)FF)F)F)#rrrr(rrrrrrr r.r,r4r2r-r@rBr?rLrPrGrMrVrWrIrZr]r^r_rKr`rbrcr5r	r	r	r
rHsB

	/
g


N)�__all__�errorr�tokensZevents�scannerrrr	r	r	r
�<module>>s

?>