%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/lib2to3/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/lib2to3/patcomp.pyc

ó
Pêáac@sådZdZddlZddlmZmZmZmZmZm	Z	ddl
mZddl
mZde
fd	„ƒYZd
„Zdefd„ƒYZiejd
6ejd6ejd6dd6Zd„Zd„Zd„ZdS(sPattern 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/local/lib/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/local/lib/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/local/lib/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/local/lib/python2.7/lib2to3/patcomp.pytcompile_pattern7scCsÊ|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	ƒS|j|jjksœt‚d}|j}	t|	ƒdkrí|	djtjkrí|	dj}|	d}	nd}
t|	ƒdkr5|	dj|jjkr5|	d}
|	d }	n|j|	|
ƒ}|
dk	r¨|
j|jjksnt‚|
j}|d}|jtjkr¥d}
tj}n¸|jtjkrÉd}
tj}n”|jtjkrQ|djtjks÷t‚t|ƒd
kst‚|j|dƒ}
}t|ƒd	kr]|j|dƒ}q]nts]t‚|
dksu|dkr¨|j	ƒ}tj|ggd|
d|ƒ}q¨n|dk	rÀ||_n|j	ƒS(sXCompiles a node, recursively.

        This is one big switch on the node type.
        iNiitmintmaxiiÿÿÿÿi(ii(RR!tMatchertchildrentAlternativesR1tlenRtWildcardPatterntoptimizetAlternativetNegatedUnitt
compile_basictNegatedPatterntUnittAssertionErrorRRtEQUALRtRepeatertSTARtHUGEtPLUStLBRACEtRBRACEtget_inttFalsetname(R*tnodetchtaltstatptunitstpatternRMtnodestrepeatR9tchildR6R7((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyR1Csh21
%

	(

+

	
'cCsùt|ƒdkst‚|d}|jtjkrbttj|jƒƒ}t	j
t|ƒ|ƒS|jtjkrp|j}|j
ƒrÒ|tkr¨td|ƒ‚n|drÁtdƒ‚nt	j
t|ƒS|dkrçd}nF|jdƒs-t|j|dƒ}|dkr-td|ƒ‚q-n|drW|j|djdƒg}nd}t	j||ƒSns|jdkr|j|dƒS|jd	krã|dks±t‚|j|dƒ}t	j|ggd
dddƒStsõt|ƒ‚dS(NiisInvalid token: %rsCan't have details for tokentanyt_sInvalid symbol: %rt(t[R6R7(R;RCRRtSTRINGtunicodeRt
evalStringRRtLeafPatternt_type_of_literaltNAMEtisuppert	TOKEN_MAPRRt
startswithtgetattrR'R1R9tNodePatternR<RL(R*RURVRNRRtcontentt
subpattern((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyR@Šs<
	
	
 cCs%|jtjkst‚t|jƒS(N(RRtNUMBERRCtintR(R*RN((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyRK­sN(	R	R
RR,RLR5R1R@RK(((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyR&s
	G#RaR\RitTOKENcCs9|djƒrtjS|tjkr1tj|SdSdS(Ni(tisalphaRRaRtopmapR(R((s+/usr/local/lib/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_infoRRRnR9((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyR)ÂscCstƒj|ƒS(N(RR5(RT((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyR5Ës(t__doc__t
__author__Rtpgen2RRRRRRtRRt	ExceptionRRtobjectRRaR\RiRRcR`R)R5(((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyt<module>	s.	




				

Zerion Mini Shell 1.0