%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/2379/lib/python3/dist-packages/yaml/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/2379/lib/python3/dist-packages/yaml/__pycache__/parser.cpython-38.pyc

U

�r^�c�@sNddgZddlmZddlTddlTddlTGdd�de�ZGdd�d�ZdS)�Parser�ParserError�)�MarkedYAMLError)�*c@seZdZdS)rN)�__name__�
__module__�__qualname__�r	r	�-/usr/lib/python3/dist-packages/yaml/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|_dSr)rrrr	r	r
�disposeYszParser.disposecGsL|jdkr|jr|��|_|jdk	rH|s,dS|D]}t|j|�r0dSq0dS)NTF)r
r�
isinstance)r�choicesZchoicer	r	r
�check_event^s


zParser.check_eventcCs |jdkr|jr|��|_|jSr�r
rrr	r	r
�
peek_eventks

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

zParser.get_eventcCs(|��}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\|�ttt�sP|j|_|��}|j}}t||dd�}|j	�
|j�|j|_
|S|��SdS)NF��explicit)�check_token�DirectiveToken�DocumentStartToken�StreamEndToken�DEFAULT_TAGSr�
peek_tokenr!�DocumentStartEventr�append�parse_document_end�parse_block_noder�parse_document_start)rr%r!r"r&r	r	r
r#�s�
�z$Parser.parse_implicit_document_startcCs�|�t�r|��q|�t�s�|��}|j}|��\}}|�t�s`tddd|��j	|��j��|��}|j
}t||d||d�}|j�
|j�|j|_n0|��}t|j|j
�}|jr�t�|jr�t�d|_|S)Nz)expected '<document start>', but found %rT)r(�version�tags)r)�DocumentEndTokenr r,r.r!�process_directivesr+r�idr"r/rr0r1�parse_document_contentrZStreamEndEvent�AssertionErrorr)rr%r!r4r5r"r&r	r	r
r3�s8



���


zParser.parse_document_startcCsL|��}|j}}d}|�t�r2|��}|j}d}t|||d�}|j|_|S)NFTr')	r.r!r)r6r r"ZDocumentEndEventr3r)rr%r!r"r(r&r	r	r
r1�s

�zParser.parse_document_endcCs<|�tttt�r0|�|��j�}|j�	�|_
|S|��SdSr)r)r*r+r6r,�process_empty_scalarr.r!r�poprr2)rr&r	r	r
r9�s�zParser.parse_document_contentcCs�d|_i|_|�t�r�|��}|jdkrn|jdk	rBtddd|j��|j\}}|dkrdtddd|j��|j|_q|jdkr|j\}}||jkr�tddd||j��||j|<q|jr�|j|j�	�f}n
|jdf}|j
D]}||jkr�|j
||j|<q�|S)NZYAMLzfound duplicate YAML directiverz:found incompatible YAML document (version 1.* is required)ZTAGzduplicate tag handle %r)rrr)r*r �namerr!r�copyr-)rr%�major�minor�handle�prefixr�keyr	r	r
r7�s@


�
�



�


zParser.process_directivescCs|jdd�S)NT)�block��
parse_noderr	r	r
r2szParser.parse_block_nodecCs|��SrrErr	r	r
�parse_flow_nodeszParser.parse_flow_nodecCs|jddd�S)NT)rD�indentless_sequencerErr	r	r
�'parse_block_node_or_indentless_sequencesz.Parser.parse_block_node_or_indentless_sequenceFc	CsR|�t�r4|��}t|j|j|j�}|j��|_	�nd}d}d}}}	|�t
�r�|��}|j}|j}|j}|�t�r�|��}|j}	|j}|j}nF|�t�r�|��}|j}}	|j}|j}|�t
�r�|��}|j}|j}|dk	�r&|\}
}|
dk	�r"|
|jk�rt
d|d|
|	��|j|
|}n|}|dk�r>|��j}}d}|dk�pR|dk}|�r�|�t��r�|��j}t|||||�}|j|_	�n�|�t��r|��}|j}|j�r�|dk�s�|dk�r�d}n|dk�r�d}nd}t||||j|||jd�}|j��|_	�nH|�t��r<|��j}t|||||dd	�}|j|_	�n|�t��rp|��j}t|||||dd	�}|j|_	n�|�r�|�t��r�|��j}t|||||d
d	�}|j|_	n�|�r�|�t��r�|��j}t|||||d
d	�}|j|_	nj|dk	�s�|dk	�rt|||d
fd||�}|j��|_	n2|�r(d}
nd
}
|��}t
d|
|d|j|j��|S)Nzwhile parsing a nodezfound undefined tag handle %rr�TF)FT)FF)�styleT�Z
flow_styleF�rDZflowzwhile parsing a %s nodez'expected the node content, but found %r) r)Z
AliasTokenr Z
AliasEventrr!r"rr<rZAnchorTokenZTagTokenrrr.�BlockEntryTokenZSequenceStartEvent�parse_indentless_sequence_entryZScalarTokenZplain�ScalarEventrKZFlowSequenceStartToken�parse_flow_sequence_first_entryZFlowMappingStartToken�MappingStartEvent�parse_flow_mapping_first_keyZBlockSequenceStartToken� parse_block_sequence_first_entryZBlockMappingStartToken�parse_block_mapping_first_keyr8)rrDrHr%r&Zanchor�tagr!r"Ztag_markrA�suffixZimplicitZnoder	r	r
rFs�







�

�
�
�
�

�

�
�
�zParser.parse_nodecCs|��}|j�|j�|��Sr)r rr0r!�parse_block_sequence_entry�rr%r	r	r
rTxsz'Parser.parse_block_sequence_first_entrycCs�|�t�rH|��}|�tt�s4|j�|j�|��S|j|_|�	|j
�S|�t�sv|��}td|j
dd|j|j��|��}t|j|j
�}|j��|_|j
��|S)Nz while parsing a block collection����"expected <block end>, but found %r)r)rNr �
BlockEndTokenrr0rXr2rr;r"r.rrr8r!�SequenceEndEventr<r$r	r	r
rX}s$

�
z!Parser.parse_block_sequence_entrycCsr|�t�rL|��}|�tttt�s8|j�|j�|�	�S|j|_
|�|j�S|�
�}t|j|j�}|j��|_
|Sr)r)rNr �KeyToken�
ValueTokenr\rr0rOr2rr;r"r.r]r!r<r$r	r	r
rO�s
�z&Parser.parse_indentless_sequence_entrycCs|��}|j�|j�|��Sr)r rr0r!�parse_block_mapping_keyrYr	r	r
rU�sz$Parser.parse_block_mapping_first_keycCs�|�t�rJ|��}|�ttt�s6|j�|j�|��S|j|_	|�
|j�S|�t�sx|��}t
d|jdd|j|j��|��}t|j|j�}|j��|_	|j��|S)Nzwhile parsing a block mappingrZr[)r)r^r r_r\rr0�parse_block_mapping_valuerIrr;r"r.rrr8r!�MappingEndEventr<r$r	r	r
r`�s$

�
zParser.parse_block_mapping_keycCsl|�t�rL|��}|�ttt�s6|j�|j�|��S|j|_	|�
|j�Sn|j|_	|��}|�
|j
�SdSr)r)r_r r^r\rr0r`rIrr;r"r.r!rYr	r	r
ra�s
z Parser.parse_block_mapping_valuecCs"|��}|j�|j�|jdd�S�NT)�first)r rr0r!�parse_flow_sequence_entryrYr	r	r
rQ�sz&Parser.parse_flow_sequence_first_entrycCs�|�t�s�|sF|�t�r"|��n$|��}td|jdd|j|j��|�t	�r||��}t
ddd|j|jdd�}|j|_
|S|�t�s�|j�|j�|��S|��}t|j|j�}|j��|_
|j��|S)Nzwhile parsing a flow sequencerZzexpected ',' or ']', but got %rTrL)r)�FlowSequenceEndToken�FlowEntryTokenr r.rrr8r!r^rRr"�%parse_flow_sequence_entry_mapping_keyrrr0rerGr]r<�rrdr%r&r	r	r
re�s4


�
�

z Parser.parse_flow_sequence_entrycCsD|��}|�ttt�s,|j�|j�|��S|j|_	|�
|j�SdSr)r r)r_rgrfrr0�'parse_flow_sequence_entry_mapping_valuerGrr;r"rYr	r	r
rh�s�z,Parser.parse_flow_sequence_entry_mapping_keycCsj|�t�rJ|��}|�tt�s4|j�|j�|��S|j|_	|�
|j�Sn|j|_	|��}|�
|j
�SdSr)r)r_r rgrfrr0�%parse_flow_sequence_entry_mapping_endrGrr;r"r.r!rYr	r	r
rjs
z.Parser.parse_flow_sequence_entry_mapping_valuecCs|j|_|��}t|j|j�Sr)rerr.rbr!rYr	r	r
rksz,Parser.parse_flow_sequence_entry_mapping_endcCs"|��}|j�|j�|jdd�Src)r rr0r!�parse_flow_mapping_keyrYr	r	r
rSsz#Parser.parse_flow_mapping_first_keycCs�|�t�s�|sF|�t�r"|��n$|��}td|jdd|j|j��|�t	�r�|��}|�t
tt�s||j�|j
�|��S|j
|_|�|j�Sn |�t�s�|j�|j�|��S|��}t|j|j�}|j��|_|j��|S)Nzwhile parsing a flow mappingrZzexpected ',' or '}', but got %r)r)�FlowMappingEndTokenrgr r.rrr8r!r^r_rr0�parse_flow_mapping_valuerGrr;r"�parse_flow_mapping_empty_valuerbr<rir	r	r
rls6


�
�

zParser.parse_flow_mapping_keycCsj|�t�rJ|��}|�tt�s4|j�|j�|��S|j|_	|�
|j�Sn|j|_	|��}|�
|j
�SdSr)r)r_r rgrmrr0rlrGrr;r"r.r!rYr	r	r
rn9s
zParser.parse_flow_mapping_valuecCs|j|_|�|��j�Sr)rlrr;r.r!rr	r	r
roGsz%Parser.parse_flow_mapping_empty_valuecCstdddd||�S)NrJrM)rP)rZmarkr	r	r
r;KszParser.process_empty_scalarN)FF)F)F)#rrrr-rrrrrrr#r3r1r9r7r2rGrIrFrTrXrOrUr`rarQrerhrjrkrSrlrnror;r	r	r	r
rHsD�

	/
g


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

Zerion Mini Shell 1.0