,9Mc @sYdZddkZddkZdddYZyeWn(ej oddkZdZn XdZyddk l Z Wn#e j oddk l Z nXdd gZ ddd YZ ed Zed joveeid jo e Zn#eid Ze eeeZx.eiZeodeeGHq'Pq'ndS(s8A lexical analyzer class for simple shell-like syntaxes.iNtdequecBs,eZdZdZdZdZRS(cCs g|_dS(N(tdata(tself((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyt__init__scCs t|iS(N(tlenR(R((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyt__len__scCs|iid|dS(Ni(Rtinsert(Rtitem((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyt appendleftscCs|iidS(Ni(Rtpop(R((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pytpoplefts(t__name__t __module__RRRR (((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyRs   cCst|tijS(N(ttypettypest StringType(ts((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyt is_basestringscCs t|tS(N(t isinstancet basestring(R((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyRs(tStringIOtshlextsplitcBszeZdZd d edZdZd dZdZdZ dZ dZ d d dZ d Z d ZRS( s8A lexical analyzer class for simple shell-like syntaxes.cCsDt|ot|}n|dj o||_||_nti|_d|_||_|o d|_n d|_d|_ d|_ |io|i d|_ 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(RRtNonetinstreamtinfiletsyststdintposixteoft commenterst wordcharst whitespacetFalsetwhitespace_splittquotestescapet escapedquoteststateRtpushbacktlinenotdebugttokent filestacktsource(RRRR!((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyR+s<                         cCs7|idjodt|GHn|ii|dS(s:Push a token onto the stack popped by the get_token methodisshlex: pushing token N(R.treprR,R(Rttok((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyt push_tokenOscCst|ot|}n|ii|i|i|if||_||_d|_|io3|dj od|ifGHqd|ifGHndS(s9Push an input source onto the lexer's input source stack.isshlex: pushing to file %ssshlex: pushing to stream %sN( RRR0RRRR-R.R(Rt newstreamtnewfile((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyt push_sourceUs "     cCs^|ii|ii\|_|_|_|iod|i|ifGHnd|_dS(sPop the input source stack.sshlex: popping to %s, line %dRN(RtcloseR0R RR-R.R+(R((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyt pop_sourcecs  ! cCsG|io:|ii}|idjodt|GHn|Sn|i}|idj odxa||ijoL|i|i}|o |\}}|i||n|i }qcWnx@||i jo/|i p |i Sq|i |i }qW|idjo,||i jodt|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,R R.R2t read_tokenR1Rt sourcehookR7t get_tokenR"R0R9(RR3trawtspecR6R5((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyR<ls2       cCst}d}xTtoL|iid}|djo|id|_n|idjo$dGt|iGdGt|GHn|idjod|_ Pq|idjom|pd|_Pq^||i jo@|idjo d GHn|i p|i o |oPqqq^||i jo!|ii |id|_q^|i o#||ijod }||_q^||ijo||_ d |_q^||ijo$|i p ||_ n||_q^|io||_ d |_q^||_ |i p|i o |oPq^qq|i|ijot}|p&|idjo d GHntd n||ijo5|i p|i ||_ d|_Pqd |_q^|i o9||ijo)|i|ijo|i}||_q^|i ||_ q|i|ijo|p&|idjo d GHntdn||ijo4||ijo$||jo|i |i|_ n|i ||_ ||_q|id jo|pd|_Pq^||i joI|idjo dGHnd|_|i p|i o |oPqZqq^||i jo[|ii |id|_|i o0d|_|i p|i o |oPqqqZq^|i o||ijo ||_q^|i o#||ijod }||_q^||ijp||ijp |io|i ||_ q^|ii||idjo dGHnd|_|i oPq^qqqW|i }d|_ |i o| o|djo d}n|idjo#|odt|GHqdGHn|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(R&tTrueRtreadR-R.R2R+RR/R%R!R#treadlineR)R$R(R't ValueErrorR*R,R(Rtquotedt escapedstatetnextchartresult((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyR:s                                            cCs|ddjo|dd!}nt|io<tii| o(tiitii|i|}n|t|dfS(s(Hook called on a filename to be sourced.iRiitr(RRtostpathtisabstjointdirnametopen(RR6((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyR; 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(RRR-(RRR-((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyt error_leaders     cCs|S(N((R((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyt__iter__scCs*|i}||ijo tn|S(N(R<R"t StopIteration(RR/((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pytnext s  N(R R t__doc__RR&RR4R7R9R<R:R;RORPRR(((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyR)s$    cCsvt|dt}t|_|p d|_ng}x:to2|i}||ijoPn|i|q8W|S(NR!R(RR@R'R#R<R"tappend(RtcommentstlexRGR/((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyR&s   t__main__isToken: (((RStos.pathRIRRRt NameErrorRRt cStringIORt ImportErrort__all__RR&RR RtargvtlexertfileRNR<tttR2(((s>install/lib/scons-1.2.0.d20100117/SCons/compat/_scons_shlex.pyss4