%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.pyo

ó
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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/local/lib/python2.7/lib2to3/patcomp.pyR1Cs^21
%

	(

+

	
'cCs½|d}|jtjkrJttj|jƒƒ}tjt	|ƒ|ƒS|jtj
krX|j}|jƒrº|tkrt
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/local/lib/python2.7/lib2to3/patcomp.pyR@Šs8
	
	
 cCs
t|jƒS(N(tintR(R*RJ((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyRH­sN(	R	R
RR,tFalseR5R1R@RH(((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyR&s
	G#R]RXtNUMBERtTOKENcCs9|djƒrtjS|tjkr1tj|SdSdS(Ni(tisalphaRR]RtopmapR(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_infoRRRkR9((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyR)ÂscCstƒj|ƒS(N(RR5(RP((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyR5Ës(t__doc__t
__author__Rtpgen2RRRRRRtRRt	ExceptionRRtobjectRR]RXRgRR_R\R)R5(((s+/usr/local/lib/python2.7/lib2to3/patcomp.pyt<module>	s.	




				

Zerion Mini Shell 1.0