ó LzñWc@sOdZddlmZddlZddlmZmZddd„ƒYZdS(sl LaTeX document building system for Rubber. This module defines the class that parses the LaTeX log files. iÿÿÿÿ(t generatorsN(t_tmsgt LogParsercBsseZdZejdƒZejdƒZejdƒZejdƒZejdƒZ ejdƒZ ejdƒZ ejdƒZ ejd ƒZ ejd ƒZejd ƒZejd ƒZejd ƒZejdƒZejdƒZd„Zd„Zd„Zd„Zd„Zdddddd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS(sÞ This class performs all the extraction of information from the log file. For efficiency, the instances contain the whole file as a list of strings so that it can be read several times with no disk access. s This is [0-9a-zA-Z-]*(TeX|Omega)s:(LaTeX|Package longtable|Package bibtopic) Warning:.*Reruns\(Changebar\).*Reruns(\((?P[^ (){}]*)|\))s(Ov|Und)erfull \\[hv]box s+(l\.(?P[0-9]+)( (?P.*))?$|<\*>)s.*(?P\\[^ ]*) ?$s\[(?P[0-9]+)\]sJ( detected| in paragraph)? at lines? (?P[0-9]*)(--(?P[0-9]*))?soLaTeX Warning: Reference `(?P.*)' on page (?P[0-9]*) undefined on input line (?P[0-9]*)\.$s"LaTeX Warning: (?PLabel .*)$s5(LaTeX|Package)( (?P.*))? Warning: (?P.*)$s,(; reported)? on input line (?P[0-9]*)s4; all text was ignored after line (?P[0-9]*).$sEMissing character: There is no (?P[^ ]*) in font (?P.*)!cCs g|_dS(N(tlines(tself((sE/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/grubber/logparser.pyt__init__+scCs‹g|_yt|ƒ}Wntk r-dSX|jƒ}|sN|jƒdS|jj|ƒsn|jƒdS|jƒ|_|jƒdS(s® Read the specified log file, checking that it was produced by the right compiler. Returns true if the log file is invalid or does not exist. iii(RtopentIOErrortreadlinetcloset re_logheadtmatcht readlines(Rtnametfiletline((sE/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/grubber/logparser.pytread.s      cCs˜d}x‹|jD]€}|jƒdkr4d}qn|r@qn|jj|ƒ}|rdd}qn|ddkr|jdƒdkrdSqqWdS(sL Returns true if there was an error during the compilation. itit!spdfTeX warningiÿÿÿÿ(Rtstript re_badboxR tfind(RtskippingRtm((sE/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/grubber/logparser.pyterrorsFs cCsDx=|jD]2}|jj|ƒr&dS|jj|ƒr dSq WdS(sU Returns true if LaTeX indicated that another compilation is needed. ii(Rtre_rerunR t re_rerun2(RR((sE/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/grubber/logparser.pyt run_needed^s cCst|ƒdkS(sð Check if a line in the log is continued on the next line. This is needed because TeX breaks messages at 79 characters per line. We make this into a method because the test is slightly different in Metapost. iO(tlen(RR((sE/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/grubber/logparser.pyt continuedksiccsé|js dSd}|g}d}d} d} d} d} d} x¢|jD]—}|d }|j|ƒry| |7} qJn| |}d} | dkr­|dkr­d} qJn| r¹qJn| rí|dkrü|jj|ƒ}|rüd|jdƒ}qün|jj|ƒ}|r1d} d} |jd ƒdk}|rA|sN|rç| rç|rƒid d 6d d 6||jdƒdd6}nidd 6|d6}|j|j ƒƒ|j j |ƒ}|rû||d<|j dƒrå|d=n|j|j ƒƒn+|ddkr||d(RRtstackR.R((sE/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/grubber/logparser.pyREVs   cCs4|jj|ƒ}|gkr"|St|dƒdS(sµ Parse the given line and return the number of the page that is being built after that line, assuming the current page before the line was `before'. iÿÿÿÿi(tre_pagetfindalltint(RRtbeforetms((sE/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/grubber/logparser.pyRFls (!t__name__t __module__t__doc__tretcompileR RRR]RR4R2R_RCR?R@RAR<R7RDRRRRRRVRWRXRYRZR[RERF(((sE/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/grubber/logparser.pyRsB        Ø      ((Rft __future__RRgRRR(((sE/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/grubber/logparser.pyts