ó ÿgdSc@swdZdefd„ƒYZdefd„ƒYZdefd„ƒYZd„Zed„Zd efd „ƒYZd S( sÉ sphinx.pycode.nodes ~~~~~~~~~~~~~~~~~~~ Parse tree node implementations. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. tBaseNodecBskeZdZd Zd„Zd„Zd„Zd Zd„Z d„Z d„Z d„Z d„Z d „ZRS( sB Node superclass for both terminal and nonterminal nodes. cCs t‚dS(N(tNotImplementedError(tselftother((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt_eqscCs#|j|jk rtS|j|ƒS(N(t __class__tNotImplementedR(RR((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt__eq__scCs$|j|jk rtS|j|ƒ S(N(RRR(RR((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt__ne__scCsh|jdkrdSxNt|jjƒD]:\}}||kr&|dkrNdS|jj|dSq&WdS(s4Return previous child in parent's children, or None.iiN(tparenttNonet enumeratetchildren(Rtitchild((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pytget_prev_sibling"s  cCst|jdkrdSxZt|jjƒD]F\}}||kr&y|jj|dSWqltk rhdSXq&q&WdS(s0Return next child in parent's children, or None.iN(R R R R t IndexError(RR R((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pytget_next_sibling,s  csd‡fd†‰|jdkr"dS|jƒ}t|tƒrA|S|dk rWˆ|ƒS|jjƒS(s?Return the leaf node that precedes this node in the parse tree.cs5t|tƒr|S|js dSˆ|jdƒSdS(Niÿÿÿÿ(t isinstancetLeafR R (tnode(t last_child(s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR9s  N(R R RRRt get_prev_leaf(Rtprev((Rs=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR7s   cCs-|}x t|tƒs(|jd}q W|S(shReturn self if leaf, otherwise the leaf node that succeeds this node in the parse tree. i(RRR (RR((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt get_next_leafIscCs |jƒjS(s9Return the line number which generated the invocant node.(Rtlineno(R((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt get_linenoSscCs |jƒjS(s(Return the prefix of the next leaf node.(Rtprefix(R((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt get_prefixWsN(t__name__t __module__t__doc__R R RRRt__hash__RRRRRR(((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR s     tNodecBsPeZdZdd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( s/ Node implementation for nonterminals. cCs9||_t|ƒ|_x|jD]}||_q"WdS(N(ttypetlistR R (RR"R tcontexttch((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt__init__bs cCsd|jj|j|jfS(Ns %s(%s, %r)(RRR"R (R((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt__repr__ks cCsdjtt|jƒƒS(s)This reproduces the input source exactly.t(tjointmaptstrR (R((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt__str__oscCs"|j|jf|j|jfkS(N(R"R (RR((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyRsscCs |j|S(N(R (Rtindex((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt __getitem__xscCs t|jƒS(N(titerR (R((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt__iter__{scCs t|jƒS(N(tlenR (R((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt__len__~sN( RRRR R&R'R,RR.R0R2(((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR!]s     RcBsGeZdZdZdZdZdd„Zd„Zd„Z d„Z RS(s9 Node implementation for leaf nodes (terminals). R(icCs@||_||_|dk r<|\|_\|_|_ndS(N(R"tvalueR RRtcolumn(RR"R3R$((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR&Šs   cCs#d|jj|j|j|jfS(Ns%s(%r, %r, %r)(RRR"R3R(R((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR'’s cCs|jt|jƒS(s)This reproduces the input source exactly.(RR+R3(R((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR,–scCs"|j|jf|j|jfkS(s Compares two nodes for equality.(R"R3(RR((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyRšsN( RRRRRR4R R&R'R,R(((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR‚s   cCsk|\}}}}|s'||jkrTt|ƒdkrA|dSt||d|ƒSt||d|ƒSdS(s,Convert raw node to a Node or Leaf instance.iiR$N(t number2symbolR1R!R(tgrammartraw_nodeR"R3R$R ((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pytconvertŸs cs:‡‡fd†‰‡‡fd†‰|r0ˆp3ˆ|ƒS(NcsUt|tƒr'dˆ|j|jfSdˆ|jdjtˆ|jƒƒfSdS(Ns%s(%r)s%s(%s)s, (RRR"R3R)R*R (R(t_reprt number2name(s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR9­s cs[t|tƒr-dˆ|j|j|jfSdˆ|jdjtˆ|jƒƒfSdS(Ns %s(%r, %r)s%s(%s)s, (RRR"RR3R)R*R (R(t_preprR:(s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR;³s   ((RR:R((R;R9R:s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt nice_repr¬st NodeVisitorcBs,eZd„Zd„Zd„Zd„ZRS(cGs||_|j|ŒdS(N(R:tinit(RR:targs((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR&¾s cGsdS(N((RR?((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR>ÂscCs3d|j|j}t|||jƒ}||ƒS(s Visit a node.tvisit_(R:R"tgetattrt generic_visit(RRtmethodtvisitor((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pytvisitÅscCs4t|tƒr0x|D]}|j|ƒqWndS(s9Called if no explicit visitor function exists for a node.N(RR!RE(RRR((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyRBËs (RRR&R>RERB(((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyR=½s   N( RtobjectRR!RR8tFalseR<R=(((s=/usr/local/lib/python2.7/site-packages/sphinx/pycode/nodes.pyt s P%