ok

Mini Shell

Direktori : /usr/lib64/python3.6/site-packages/yaml/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/yaml/__pycache__/parser.cpython-36.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|_n4|j�}t|j|j
�}|js�t�|js�t�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�AssertionErrorr)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
AliasEventrrrrr7rZAnchorTokenZTagTokenrrr)�BlockEntryTokenZSequenceStartEvent�parse_indentless_sequence_entryZScalarTokenZplain�ScalarEventrDZFlowSequenceStartToken�parse_flow_sequence_first_entryZFlowMappingStartToken�MappingStartEvent�parse_flow_mapping_first_keyZBlockSequenceStartToken� parse_block_sequence_first_entryZBlockMappingStartToken�parse_block_mapping_first_keyr3)rr?rBr!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
rMxsz'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$rGr�
BlockEndTokenrr+rQr-rr6rr)rrr3r�SequenceEndEventr7)rr!r"r	r	r
rQ}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$rGr�KeyToken�
ValueTokenrSrr+rHr-rr6rr)rTrr7)rr!r"r	r	r
rH�s

z&Parser.parse_indentless_sequence_entrycCs|j�}|jj|j�|j�S)N)rrr+r�parse_block_mapping_key)rr!r	r	r
rN�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 %rrR)r$rUrrVrSrr+�parse_block_mapping_valuerCrr6rr)rrr3r�MappingEndEventr7)rr!r"r	r	r
rW�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$rVrrUrSrr+rWrCrr6rr)r)rr!r	r	r
rX�s
z Parser.parse_block_mapping_valuecCs"|j�}|jj|j�|jdd�S)NT)�first)rrr+r�parse_flow_sequence_entry)rr!r	r	r
rJ�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)rErR)r$�FlowSequenceEndToken�FlowEntryTokenrr)rrr3rrUrKr�%parse_flow_sequence_entry_mapping_keyrrr+r[rArTr7)rrZr!r"r	r	r
r[�s,





z Parser.parse_flow_sequence_entrycCsD|j�}|jttt�s,|jj|j�|j�S|j|_	|j
|j�SdS)N)rr$rVr]r\rr+�'parse_flow_sequence_entry_mapping_valuerArr6r)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$rVrr]r\rr+�%parse_flow_sequence_entry_mapping_endrArr6rr)r)rr!r	r	r
r_s
z.Parser.parse_flow_sequence_entry_mapping_valuecCs|j|_|j�}t|j|j�S)N)r[rr)rYr)rr!r	r	r
r`sz,Parser.parse_flow_sequence_entry_mapping_endcCs"|j�}|jj|j�|jdd�S)NT)rZ)rrr+r�parse_flow_mapping_key)rr!r	r	r
rLsz#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 %rrR)r$�FlowMappingEndTokenr]rr)rrr3rrUrVrr+�parse_flow_mapping_valuerArr6r�parse_flow_mapping_empty_valuerYr7)rrZr!r"r	r	r
ras.





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$rVrr]rbrr+rarArr6rr)r)rr!r	r	r
rc9s
zParser.parse_flow_mapping_valuecCs|j|_|j|j�j�S)N)rarr6r)r)rr	r	r
rdGsz%Parser.parse_flow_mapping_empty_valuecCstdddd||�S)NTFrF)TF)rI)rZmarkr	r	r
r6KszParser.process_empty_scalarN)FF)F)F)#rrrr(rrrrrrr r.r,r4r2r-rArCr@rMrQrHrNrWrXrJr[r^r_r`rLrarcrdr6r	r	r	r
rHsB

	/
g


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

Zerion Mini Shell 1.0