m Hq |d*j o|i=|| ||fq nto d(d)GHn||}qYWd||fS(+sTag text[startindex:len_text] using the Tag Table given in table. - returns a tuple (success, taglist, nextindex) - if taglist == None, then no taglist is created s tag()-calliistext[%i]:table[%i] entry %ss in %si(iiiiiismatch must be a strings AllIn matchedt:s AllNotIn matcheds Is matcheds IsIn matcheds IsNotIn matcheds Word matcheds NoWord matchedsmatch must be a tableis Table did not match s Table matcheds TableInList did not match s TableInList matcheds Call matchedsmatch must be a tuple (fct,arg)s CallArg matcheds Loop count =s startpos =s Loop matcheds matched EOFs Skip ttosskipped:stag-command unknown: stag-command-flag unknown: iHt-N(?tlen_texttnot_settlenttextttaglisttverbosetit startindextxt loopcounterttabletentrytlentryt format_entrytreprttagobjtcmdtmatchtjnetjet debuggingt breakpointstdebuggertNonetsubtagstflagstAllInttypetstrtypet TypeErrortstarttAllNotIntIstIsIntIsNotIntWordtNoWordtlwtTablet tabletypetdttagtresultt nextindext TableInListt tablelisttCalltCallArgtfcttargtLoopt loopstartpost LoopControltEOFtMatchOktFailtSkiptytztCallTagt AppendToTagtappendtflag(RRR RR RR8RRR6R*R2R#R0RR>RRR5RRR-R RRR R?R/((tF/data/zmath/lib/python2.4/site-packages/mx/TextTools/Examples/pytag.pytpytag/s         +      8    8    8    8    8  +  8   %  8   ! !  8   % %  8   8    8     4              8     ! icCs |adS(s' set verbosity for tagging: 0=off 1=on N(tlevelR (RF((RDt set_verbosityscCsda|adS(sc use the tag table debugger * bp can be a list of preset breakpoints (bytes into text) iN(RtbpR(RH((RDt use_debuggersc Cs9d} ddGHd|t||fGHd|t|||!d fGHdG|GHddGHx| d jot d } yOt | d jo| d }nd }|d jo d } n|d jo d} n|djoMdG|GdGt||GdGHdG|GdGt|||!d GHdG|GHn|djo d } n|djo d} no|djot iti| d nD|djot iti| d n|djo9dGHxt D]%}dG|GdGt||d GHqWn|d joti| d }n|d!jod tan|d"jod#GHt||nq|d$jod%GHt||GHnM|d&jo9ti| d } d'G| GdGt|| |!d GHnd(Wq\d(j o5d)GHd*GHd+GHd,GHd-GHd.GHd/GHd0GHHd1GHq\d2GHq\Xq\Wto d3dGHn| ||fS(5s the tag table debugger front end * returns (rc,x,i) with rc = 0 ... stop debugging # = 1 ... do one step # = 2 ... step over table # iiKt_s| table[%i]=(%s)s| text[%i:]=%si7s | h = help; vars: loop counter =Ristag-debugger >>> tsitnitwstable[s]=(t)stext [s]:svars: loop counter =tqtritbtctls breakpoints:t stext =i<tgtvttstaglist:tmscurrent matching table:tpstext[thelps Commands:s$s = step next entry | return = steps0w = where are we | q = run without debuggings.b*= add breakpoint * | c*= delete breakpoint *s2l = list breakpoints | v = switch verbosity on/offs5t = show taglist | r = run to next breakpoint/ends1n = step over table | p*= print text from byte *s6g*= goto position * | m = show current matching tables0*...these take an argument, e.g. b1200 or p 1200s7Internal Debugger Error -- last request not processed !iHN(trcR RRR RRRtloopvart raw_inputRKRRRRRBtstringtatoitremoveRQR t print_tagsR t format_tableR>( RR RRR R\R RRRQR[RKR>((RDRs           "        '     &   (t__doc__tsysR^R RRt mx.TextToolsttypest StringTypeR!t TupleTypeR,t FunctionTypetfcttypeRRREt TextToolsR.RGRIR( RGRR^RER!RIRRdRjRR,Rf((RDt?s$    U