Your IP : 3.12.34.96


Current Path : /opt/alt/python33/lib64/python3.3/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/lib2to3/pgen2/__pycache__/pgen.cpython-33.pyc

�
��f�5c@s�ddlmZmZmZGdd�dej�ZGdd�de�ZGdd�de�ZGdd	�d	e�Z	d
dd�Z
d
S(i(ugrammarutokenutokenizecBs|EeZdZdS(uPgenGrammarN(u__name__u
__module__u__qualname__(u
__locals__((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuPgenGrammarsuPgenGrammarcBs�|EeZdZd%dd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd%dd �Zd!d"�Zd#d$�Zd%S(&uParserGeneratorcCs�d}|dkr*t|�}|j}n||_||_tj|j�|_|j	�|j
�\|_|_|dk	r�|�ni|_
|j�dS(N(uNoneuopenucloseufilenameustreamutokenizeugenerate_tokensureadlineu	generatorugettokenuparseudfasustartsymbolufirstuaddfirstsets(uselfufilenameustreamuclose_stream((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu__init__s		

	uParserGenerator.__init__cCs�t�}t|jj��}|j�|j|j�|jd|j�x;|D]3}dt|j	�}||j	|<||j
|<qRWx�|D]�}|j|}g}x�|D]�}g}xE|jj�D]4\}	}
|j
|j||	�|j|
�f�q�W|jr,|j
d|j|�f�n|j
|�q�W|jj
|�||j||�f|j|j	|<q�W|j	|j|_|S(Nii(uPgenGrammarulistudfasukeysusorturemoveustartsymboluinsertulenu
symbol2numberu
number2symboluarcsuitemsuappendu
make_labeluindexuisfinalustatesu
make_firstustart(uselfucunamesunameuiudfaustatesustateuarcsulabelunext((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyumake_grammars.	





,	*uParserGenerator.make_grammarcCsD|j|}i}x*|D]"}|j||�}d||<qW|S(Ni(ufirstu
make_label(uselfucunameurawfirstufirstulabeluilabel((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu
make_first4s

uParserGenerator.make_firstcCs�t|j�}|dj�r||jkry||jkrH|j|S|jj|j|df�||j|<|Sq�tt|d�}t	|t
�s�t|��|tjks�t|��||j
kr�|j
|S|jj|df�||j
|<|Sn�|ddks!t|��t|�}|dj�r�||jkrW|j|S|jjtj|f�||j|<|SnNtj|}||j
kr�|j
|S|jj|df�||j
|<|SdS(Niu"u'(u"u'(ulenulabelsuisalphau
symbol2numberusymbol2labeluappenduNoneugetattrutokenu
isinstanceuintuAssertionErrorutok_nameutokensuevalukeywordsuNAMEugrammaruopmap(uselfuculabeluilabeluitokenuvalue((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu
make_label=s<




uParserGenerator.make_labelcCsSt|jj��}|j�x-|D]%}||jkr&|j|�q&q&WdS(N(ulistudfasukeysusortufirstu	calcfirst(uselfunamesuname((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuaddfirstsetsks


uParserGenerator.addfirstsetsc	Csj|j|}d|j|<|d}i}i}x�|jj�D]�\}}||jkr�||jkr�|j|}|dkr�td|��q�n|j|�|j|}|j|�|||<q@d||<id|6||<q@Wi}	xd|j�D]V\}}
xG|
D]?}||	krGtd||||	|f��n||	|<qWq�W||j|<dS(Niurecursion for rule %riuArule %s is ambiguous; %s is in the first sets of %s as well as %s(udfasuNoneufirstuarcsuitemsu
ValueErroru	calcfirstuupdate(uselfunameudfaustateutotalsetuoverlapcheckulabelunextufsetuinverseuitsfirstusymbol((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu	calcfirstss2









uParserGenerator.calcfirstc	Cs�i}d}x�|jtjkr�x |jtjkrC|j�q$W|jtj�}|jtjd�|j	�\}}|jtj�|j
||�}t|�}|j|�t|�}|||<|dkr|}qqW||fS(Nu:(
uNoneutypeutokenu	ENDMARKERuNEWLINEugettokenuexpectuNAMEuOPu	parse_rhsumake_dfaulenusimplify_dfa(	uselfudfasustartsymbolunameuauzudfauoldlenunewlen((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuparse�s"


uParserGenerator.parsecsDt|t�st�t|t�s*t��fdd�}�fdd��t||�|�g}x�|D]�}i}xS|jD]H}x?|jD]4\}}	|dk	r��|	|j|i��q�q�Wq�Wxj|j�D]\\}}
x=|D]}|j|
kr�Pq�q�Wt|
|�}|j	|�|j
||�q�WqmW|S(Ncsi}�||�|S(N((ustateubase(u
addclosure(u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuclosure�s
u)ParserGenerator.make_dfa.<locals>.closurecsit|t�st�||kr%dSd||<x3|jD](\}}|dkr9�||�q9q9WdS(Ni(u
isinstanceuNFAStateuAssertionErroruarcsuNone(ustateubaseulabelunext(u
addclosure(u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu
addclosure�s
u,ParserGenerator.make_dfa.<locals>.addclosure(u
isinstanceuNFAStateuAssertionErroruDFAStateunfasetuarcsuNoneu
setdefaultuitemsuappenduaddarc(uselfustartufinishuclosureustatesustateuarcsunfastateulabelunextunfasetust((u
addclosureu7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyumake_dfa�s&
$

uParserGenerator.make_dfac
Cs�td|�|g}x�t|�D]�\}}td|||krJdpMd�x|jD]t\}}||kr�|j|�}	nt|�}	|j|�|dkr�td|	�q[td||	f�q[Wq#WdS(NuDump of NFA foru  Stateu(final)uu	    -> %du    %s -> %d(uprintu	enumerateuarcsuindexulenuappenduNone(
uselfunameustartufinishutodouiustateulabelunextuj((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyudump_nfa�s
	"
uParserGenerator.dump_nfac	Cs�td|�xvt|�D]h\}}td||jr>dpAd�x:|jj�D])\}}td||j|�f�qUWqWdS(NuDump of DFA foru  Stateu(final)uu    %s -> %d(uprintu	enumerateuisfinaluarcsuitemsuindex(uselfunameudfauiustateulabelunext((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyudump_dfa�s

uParserGenerator.dump_dfacCs�d}x�|r�d}x�t|�D]x\}}xit|dt|��D]N}||}||krH||=x|D]}|j||�qrWd}PqHqHWq"Wq	WdS(NiTF(uTrueuFalseu	enumerateurangeulenu
unifystate(uselfudfauchangesuiustate_iujustate_justate((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyusimplify_dfa�s	 

uParserGenerator.simplify_dfacCs�|j�\}}|jdkr+||fSt�}t�}|j|�|j|�xI|jdkr�|j�|j�\}}|j|�|j|�qZW||fSdS(Nu|(u	parse_altuvalueuNFAStateuaddarcugettoken(uselfuauzuaauzz((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu	parse_rhs�s
		



uParserGenerator.parse_rhscCsr|j�\}}xS|jdks?|jtjtjfkrg|j�\}}|j|�|}qW||fS(Nu(u[(u(u[(u
parse_itemuvalueutypeutokenuNAMEuSTRINGuaddarc(uselfuaubucud((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu	parse_alt
s

uParserGenerator.parse_altcCs�|jdkrU|j�|j�\}}|jtjd�|j|�||fS|j�\}}|j}|dkr�||fS|j�|j|�|dkr�||fS||fSdS(Nu[u]u+u*(u+u*(uvalueugettokenu	parse_rhsuexpectutokenuOPuaddarcu
parse_atom(uselfuauzuvalue((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu
parse_items


	



uParserGenerator.parse_itemcCs�|jdkrH|j�|j�\}}|jtjd�||fS|jtjtjfkr�t	�}t	�}|j
||j�|j�||fS|jd|j|j�dS(Nu(u)u+expected (...) or NAME or STRING, got %s/%s(uvalueugettokenu	parse_rhsuexpectutokenuOPutypeuNAMEuSTRINGuNFAStateuaddarcuraise_error(uselfuauz((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu
parse_atom(s

		

	uParserGenerator.parse_atomcCsc|j|ks*|dk	rL|j|krL|jd|||j|j�n|j}|j�|S(Nuexpected %s/%s, got %s/%s(utypeuNoneuvalueuraise_errorugettoken(uselfutypeuvalue((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuexpect9s*		
uParserGenerator.expectcCsit|j�}x/|dtjtjfkr@t|j�}qW|\|_|_|_|_|_	dS(Ni(
unextu	generatorutokenizeuCOMMENTuNLutypeuvalueubeginuenduline(uselfutup((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyugettokenAsuParserGenerator.gettokencGsz|rGy||}WqGdj|gttt|���}YqGXnt||j|jd|jd|jf��dS(Nu ii(ujoinulistumapustruSyntaxErrorufilenameuenduline(uselfumsguargs((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuraise_errorHs-uParserGenerator.raise_errorN(u__name__u
__module__u__qualname__uNoneu__init__umake_grammaru
make_firstu
make_labeluaddfirstsetsu	calcfirstuparseumake_dfaudump_nfaudump_dfausimplify_dfau	parse_rhsu	parse_altu
parse_itemu
parse_atomuexpectugettokenuraise_error(u
__locals__((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuParserGenerator
s$	.$
uParserGeneratorcBs/|EeZdZdd�Zddd�ZdS(uNFAStatecCs
g|_dS(N(uarcs(uself((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu__init__SsuNFAState.__init__cCsP|dks!t|t�s!t�t|t�s6t�|jj||f�dS(N(uNoneu
isinstanceustruAssertionErroruNFAStateuarcsuappend(uselfunextulabel((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuaddarcVs!uNFAState.addarcN(u__name__u
__module__u__qualname__u__init__uNoneuaddarc(u
__locals__((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuNFAStateQsuNFAStatecBsJ|EeZdZdd�Zdd�Zdd�Zdd�Zd	Zd	S(
uDFAStatecCspt|t�st�ttt|��t�s6t�t|t�sKt�||_||k|_i|_dS(N(	u
isinstanceudictuAssertionErrorunextuiteruNFAStateunfasetuisfinaluarcs(uselfunfasetufinal((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu__init__]s!	uDFAState.__init__cCsPt|t�st�||jks*t�t|t�s?t�||j|<dS(N(u
isinstanceustruAssertionErroruarcsuDFAState(uselfunextulabel((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuaddarcesuDFAState.addarccCs@x9|jj�D](\}}||kr||j|<qqWdS(N(uarcsuitems(uselfuoldunewulabelunext((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu
unifystateksuDFAState.unifystatecCs�t|t�st�|j|jkr+dSt|j�t|j�krMdSx9|jj�D](\}}||jj|�k	r]dSq]WdS(NFT(
u
isinstanceuDFAStateuAssertionErroruisfinaluFalseulenuarcsuitemsugetuTrue(uselfuotherulabelunext((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu__eq__psuDFAState.__eq__N(	u__name__u
__module__u__qualname__u__init__uaddarcu
unifystateu__eq__uNoneu__hash__(u
__locals__((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyuDFAState[s
uDFAStateuGrammar.txtcCst|�}|j�S(N(uParserGeneratorumake_grammar(ufilenameup((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyugenerate_grammar�sugenerate_grammarN(uugrammarutokenutokenizeuGrammaruPgenGrammaruobjectuParserGeneratoruNFAStateuDFAStateugenerate_grammar(((u7/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/pgen.pyu<module>s�H
%

?>