mò %U²Ic@s dZdkZdkZdklZydklZWn ej odklZnXddgZ dfd„ƒYZ e d„Z e djoxeeiƒd jo e ƒZn#eid Ze eeƒeƒZx0eiƒZeod eeƒGHqÙPqÙWndS( s8A lexical analyzer class for simple shell-like syntaxes.N(sdeque(sStringIOtshlextsplitcBsztZdZeeed„Zd„Zed„Zd„Zd„Z d„Z d„Z eed„Z d „Z d „ZRS( s8A lexical analyzer class for simple shell-like syntaxes.cCsFt|tƒot|ƒ}n|dj o||_||_nti|_d|_||_ |o d|_ n d|_ d|_ d|_ |i o|i d7_ nd|_ t|_d|_d|_d|_d |_tƒ|_d |_d |_d|_tƒ|_d|_|iod |i|ifGHndS( Ntt#t?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_s>ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞs s'"s\t"t iisshlex: reading from %s, line %d(t isinstancetinstreamt basestringtStringIOtNonetselftinfiletsyststdintposixteoft commenterst wordcharst whitespacetFalsetwhitespace_splittquotestescapet escapedquoteststatetdequetpushbacktlinenotdebugttokent filestacktsource(R RR R((t"/data/zmath/lib/python2.4/shlex.pyt__init__s:                        cCs7|idjodt|ƒGHn|ii|ƒdS(s:Push a token onto the stack popped by the get_token methodisshlex: pushing token N(R RtreprttokRt appendleft(R R%((R"t push_token;scCsžt|tƒot|ƒ}n|ii|i|i|i fƒ||_||_d|_ |i o3|dj od|ifGHqšd|ifGHndS(s9Push an input source onto the lexer's input source stack.isshlex: pushing to file %ssshlex: pushing to stream %sN( Rt newstreamR R R R R&R RRtnewfileRR (R R(R)((R"t push_sourceAs"     cCs^|iiƒ|iiƒ\|_|_|_|iod|i|ifGHnd|_dS(sPop the input source stack.sshlex: popping to %s, line %dRN( R RtcloseR tpopleftR RRR(R ((R"t pop_sourceOs  ! cCsG|io:|iiƒ}|idjodt|ƒGHn|Sn|iƒ}|idj odxa||ijoL|i |iƒƒ}|o |\}}|i||ƒn|iƒ}qcWnx@||ijo/|ip |iSqÇ|iƒ|iƒ}qÇW|idjo,||ijodt|ƒGHqCdGHn|S(sBGet a token from the input stream (or from stack if it's nonempty)isshlex: popping token s shlex: token=sshlex: token=EOFN(R RR,R%RR$t read_tokentrawR!R t sourcehooktspecR)R(R*t get_tokenRR R-(R R/R%R(R1R)((R"R2Xs4       cCsÕt}d}xTtoL|iidƒ}|djo|id|_n|i djo$dGt |i ƒGdGt |ƒGHn|i djod|_ Pq|i djom|pd|_ Pq^||ijo@|i djo d GHn|i p|io |oPqqq^||ijo!|iiƒ|id|_q^|io#||ijod }||_ q^||ijo||_ d |_ q^||ijo$|ip ||_ n||_ q^|io||_ d |_ q^||_ |i p|io |oPq^qq|i |ijoÏt}|p&|i djo d GHntd ‚n||i jo5|ip|i ||_ d|_ Pqöd |_ q^|io9||ijo)|i |ijo|i }||_ q^|i ||_ q|i |ijoŽ|p&|i djo d GHntd‚n||ijo4||i jo$||jo|i |i |_ n|i ||_ ||_ q|i d jo³|pd|_ Pq^||ijoI|i djo dGHnd|_ |i p|io |oPqZqq^||ijo[|iiƒ|id|_|io0d|_ |i p|io |oPq€qqZq^|io||ijo ||_ q^|io#||ijod }||_ q^||ijp||ijp |io|i ||_ q^|ii|ƒ|i djo dGHnd|_ |i oPq^qqqW|i }d|_ |io| o|djo d}n|i djo#|odt |ƒGHqÑdGHn|S(NRis isshlex: in statesI see character:Ris+shlex: I see whitespace in whitespace statetas shlex: I see EOF in quotes statesNo closing quotations shlex: I see EOF in escape statesNo escaped characters%shlex: I see whitespace in word states&shlex: I see punctuation in word statesshlex: raw token=sshlex: raw token=EOF(Rtquotedt escapedstatetTrueR RtreadtnextcharRRR$RR RRRRtreadlineRRRRt ValueErrorRRR&tresult(R R4R;R8R5((R"R.xsÚ $                   -    -          *        cCs„|ddjo|dd!}nt|itƒo<tii|ƒ o(tiitii |iƒ|ƒ}n|t |dƒfS(s(Hook called on a filename to be sourced.iRiiÿÿÿÿtrN( R)RR R R tostpathtisabstjointdirnametopen(R R)((R"R0øs '(cCsB|djo |i}n|djo |i}nd||fS(s<Emit a C-compiler-like, Emacs-friendly error-message leader.s"%s", line %d: N(R R R R(R R R((R"t error_leaders     cCs|S(N(R (R ((R"t__iter__ scCs*|iƒ}||ijo t‚n|S(N(R R2RRt StopIteration(R R((R"tnext s  (t__name__t __module__t__doc__R RR#R'R*R-R2R.R0RCRDRF(((R"Rs $   €  cCs9t|dtƒ}t|_|p d|_nt|ƒS(NRR(RtsR6tlexRtcommentsRtlist(RJRLRK((R"Rs   t__main__isToken: (RItos.pathR=Rt collectionsRt cStringIOR t ImportErrort__all__RRRRGtlentargvtlexertfileRBR2tttR$( RRSR RXRVRRRWR=R((R"t?s*    ý