AlkantarClanX12

Your IP : 3.128.198.90


Current Path : /proc/thread-self/root/lib64/python2.7/lib2to3/
Upload File :
Current File : //proc/thread-self/root/lib64/python2.7/lib2to3/patcomp.pyo

�
{fc@s�dZdZddlZddlmZmZmZmZmZm	Z	ddl
mZddl
mZde
fd	��YZd
�Zdefd��YZiejd
6ejd6ejd6dd6Zd�Zd�Zd�ZdS(s�Pattern compiler.

The grammar is taken from PatternGrammar.txt.

The compiler compiles a pattern to a pytree.*Pattern instance.
s#Guido van Rossum <guido@python.org>i����Ni(tdrivertliteralsttokenttokenizetparsetgrammar(tpytree(tpygramtPatternSyntaxErrorcBseZRS((t__name__t
__module__(((s'/usr/lib64/python2.7/lib2to3/patcomp.pyRsc	cswttjtjtjf�}tjtj|�j�}x7|D]/}|\}}}}}||kr@|Vq@q@WdS(s6Tokenizes a string suppressing significant whitespace.N(	tsetRtNEWLINEtINDENTtDEDENTRtgenerate_tokenstStringIOtreadline(	tinputtskipttokenst	quintuplettypetvaluetstarttendt	line_text((s'/usr/lib64/python2.7/lib2to3/patcomp.pyttokenize_wrappers
tPatternCompilercBsAeZdd�Zeed�Zd�Zdd�Zd�ZRS(cCs�|dkr'tj|_tj|_n'tj|�|_tj|j�|_tj	|_
tj|_tj
|jdt�|_dS(s^Initializer.

        Takes an optional alternative filename for the pattern grammar.
        tconvertN(tNoneRtpattern_grammarRtpattern_symbolstsymsRtload_grammartSymbolstpython_grammart	pygrammartpython_symbolstpysymstDrivertpattern_convert(tselftgrammar_file((s'/usr/lib64/python2.7/lib2to3/patcomp.pyt__init__(scCs}t|�}y|jj|d|�}Wn(tjk
rR}tt|���nX|rl|j|�|fS|j|�SdS(s=Compiles a pattern string to a nested pytree.*Pattern object.tdebugN(RRtparse_tokensRt
ParseErrorRtstrtcompile_node(R*RR-t	with_treeRtrootte((s'/usr/lib64/python2.7/lib2to3/patcomp.pytcompile_pattern7scCsT|j|jjkr%|jd}n|j|jjkr�g|jddd�D]}|j|�^qQ}t|�dkr�|dStjg|D]}|g^q�dddd�}|j	�S|j|jj
kr=g|jD]}|j|�^q�}t|�dkr|dStj|gdddd�}|j	�S|j|jjkr�|j|jd�}tj
|�}|j	�Sd}|j}	t|	�dkr�|	djtjkr�|	dj}|	d}	nd}
t|	�dkr|	dj|jjkr|	d}
|	d }	n|j|	|
�}|
dk	r2|
j}|d}|jtjkrod}
tj}nx|jtjkr�d}
tj}nT|jtjkr�|j|d�}
}t|�d	kr�|j|d�}q�n|
dks�|dkr2|j	�}tj|ggd|
d|�}q2n|dk	rJ||_n|j	�S(
sXCompiles a node, recursively.

        This is one big switch on the node type.
        iNiitmintmaxii����i(RR!tMatchertchildrentAlternativesR1tlenRtWildcardPatterntoptimizetAlternativetNegatedUnitt
compile_basictNegatedPatternRRtEQUALRtRepeatertSTARtHUGEtPLUStLBRACEtget_inttname(R*tnodetchtaltstatptunitstpatternRItnodestrepeatR9tchildR6R7((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR1Cs^21
%

	(

+

	
'cCs�|d}|jtjkrJttj|j��}tjt	|�|�S|jtj
krX|j}|j�r�|tkr�t
d|��n|dr�t
d��ntjt|�S|dkr�d}nF|jd�st|j|d�}|dkrt
d|��qn|dr?|j|djd�g}nd}tj||�Sna|jdkrx|j|d�S|jd	kr�|j|d�}tj|ggd
ddd�SdS(NisInvalid token: %risCan't have details for tokentanyt_sInvalid symbol: %rt(t[R6R7(RRtSTRINGtunicodeRt
evalStringRRtLeafPatternt_type_of_literaltNAMEtisuppert	TOKEN_MAPRRt
startswithtgetattrR'R1R9tNodePatternR<(R*RQRRRJRRtcontentt
subpattern((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR@�s8
	
	
 cCs
t|j�S(N(tintR(R*RJ((s'/usr/lib64/python2.7/lib2to3/patcomp.pyRH�sN(	R	R
RR,tFalseR5R1R@RH(((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR&s
	G#R]RXtNUMBERtTOKENcCs9|dj�rtjS|tjkr1tj|SdSdS(Ni(tisalphaRR]RtopmapR(R((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR\�s
cCsW|\}}}}|s'||jkr=tj||d|�Stj||d|�SdS(s9Converts raw node information to a Node or Leaf instance.tcontextN(t
number2symbolRtNodetLeaf(Rt
raw_node_infoRRRkR9((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR)�scCst�j|�S(N(RR5(RP((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR5�s(t__doc__t
__author__Rtpgen2RRRRRRtRRt	ExceptionRRtobjectRR]RXRgRR_R\R)R5(((s'/usr/lib64/python2.7/lib2to3/patcomp.pyt<module>	s.	
�