ok

Mini Shell

Direktori : /proc/thread-self/root/proc/thread-self/root/lib64/python2.7/Tools/scripts/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/lib64/python2.7/Tools/scripts/texcheck.pyc

�
�fc@s�dZddlZddlZddlZddlmZmZmZddlZdZ	d�Z
gd�Zdd�Z
edkr�eje
��ndS(	s� TeXcheck.py -- rough syntax checking on Python style LaTeX documents.

   Written by Raymond D. Hettinger <python at rcn.com>
   Copyright (c) 2003 Python Software Foundation.  All rights reserved.

Designed to catch common markup errors including:
* Unbalanced or mismatched parenthesis, brackets, and braces.
* Unbalanced or mismatched \begin and \end blocks.
* Misspelled or invalid LaTeX commands.
* Use of forward slashes instead of backslashes for commands.
* Table line size mismatches.

Sample command line usage:
    python texcheck.py -k chapterheading -m lib/librandomtex *.tex

Options:
    -m          Munge parenthesis and brackets. [0,n) would normally mismatch.
    -k keyword: Keyword is a valid LaTeX command. Do not include the backslash.
    -d:         Delimiter check only (useful for non-LaTeX files).
    -h:         Help
    -s lineno:  Start at lineno (useful for skipping complex sections).
    -v:         Verbose.  Trace the matching of //begin and //end blocks.
i����N(tiziptcounttislices�
    \section \module \declaremodule \modulesynopsis \moduleauthor
    \sectionauthor \versionadded \code \class \method \begin
    \optional \var \ref \end \subsection \lineiii \hline \label
    \indexii \textrm \ldots \keyword \stindex \index \item \note
    \withsubitem \ttindex \footnote \citetitle \samp \opindex
    \noindent \exception \strong \dfn \ctype \obindex \character
    \indexiii \function \bifuncindex \refmodule \refbimodindex
    \subsubsection \nodename \member \chapter \emph \ASCII \UNIX
    \regexp \program \production \token \productioncont \term
    \grammartoken \lineii \seemodule \file \EOF \documentclass
    \usepackage \title \input \maketitle \ifhtml \fi \url \Cpp
    \tableofcontents \kbd \programopt \envvar \refstmodindex
    \cfunction \constant \NULL \moreargs \cfuncline \cdata
    \textasciicircum \n \ABC \setindexsubitem \versionchanged
    \deprecated \seetext \newcommand \POSIX \pep \warning \rfc
    \verbatiminput \methodline \textgreater \seetitle \lineiv
    \funclineni \ulink \manpage \funcline \dataline \unspecified
    \textbackslash \mimetype \mailheader \seepep \textunderscore
    \longprogramopt \infinity \plusminus \shortversion \version
    \refmodindex \seerfc \makeindex \makemodindex \renewcommand
    \indexname \appendix \protect \indexiv \mbox \textasciitilde
    \platform \seeurl \leftmargin \labelwidth \localmoduletable
    \LaTeX \copyright \memberline \backslash \pi \centerline
    \caption \vspace \textwidth \menuselection \textless
    \makevar \csimplemacro \menuselection \bfcode \sub \release
    \email \kwindex \refexmodindex \filenq \e \menuselection
    \exindex \linev \newsgroup \verbatim \setshortversion
    \author \authoraddress \paragraph \subparagraph \cmemberline
    \textbar \C \seelink
cCsry|j�\}}Wn!tk
r9d||fGHdSX||j||g�krYdSd||||fGHdS(sCVerify that closing delimiter matches most recent opening delimitersU
Delimiter mismatch.  On line %d, encountered closing '%s' without corresponding openNsJ
Opener '%s' on line %d was not closed before encountering '%s' on line %d(tpopt
IndexErrortget(tc_linenotc_symboltopenerstpairmapto_linenoto_symbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyt
matchclose?s
c#CsPtjd�}tjd�}ttj��}x|D]}|jd|�q7Wd|kruidd6dd6}nid	d6d
d6}td�}tjd�}	tjd�}
tjd
�}tjd�}g}
g}tjd�}tjd�}tjd�}d}d}t|jdd��}d}x�tt	|�t
||dd/��D]�\}}|j�}x�|	j
|�D]�\}}}d|kr�|GdG|G|G|Gn|dkr�d|kr�|
j||f�nr||kr|
j||f�nP|dkr2d|kr2t|||
|�n"||krTt|||
|�nd|kr�dG|
GHq�q�Wxv|
j
|�D]e\}}|dkr�|j|�n|dkr�y|j�Wq�tk
r�d|fGHq�Xq�q�Wd|kr�qZnxW|j
|�D]F}d |ksd!|kr/qnd||krd"||fGHqqWx)|j
|�D]}d#|||fGHqeW|jd$�}|d%kr�|jd|�}|jd|�}|j||d|!�nx5|j
|�D]$}||kr�d&||fGHq�q�W|j|�}|r@|jd�}|}n|j|�}|r�|jd�|kr�d'|jd�|||fGHn|j|�r�d}nd(|ks�d)|kr�d*|fGHnx&|j
|�D]} d+| |fGHq�WqZW|}!x#|
D]\}}"d,|"|fGHqWx|D]}d-|fGHq*Wd.|!fGHdS(0s�Check the LaTeX formatting in a sequence of lines.

    Opts is a mapping of options to option values if any:
        -m          munge parenthesis and brackets
        -d          delimiters only checking
        -v          verbose trace of delimiter matching
        -s lineno:  linenumber to start scan (default is 1).

    Morecmds is a sequence of LaTeX commands (without backslashes) that
    are to be considered valid in the scan.
    s\\[A-Za-z]+s
\/([A-Za-z]+)s\s-ms[(t]s([t)t[t(s&\\(begin|end){([_a-zA-Z]+)}|([()\[\]])s({)|(})s(\b[A-za-z]+\b) \b\1\bs<\\(ABC|ASCII|C|Cpp|EOF|infinity|NULL|plusminus|POSIX|UNIX)\ss\\begin{(?:long)?table([iv]+)}s\\line([iv]+){s\\end{(?:long)?table([iv]+)}tis-st1is-vt|tbegins-dtends   --> t{t}s Warning, unmatched } on line %s.t822s.htmls4Warning, forward slash used on line %d with cmd: /%ss2Warning, \%s should be written as \%s{} on line %ds\newcommandi����s(Warning, unknown tex cmd on line %d: \%ss>Warning, \line%s on line %d does not match \table%s on line %dse.g.si.e.s2Style warning, avoid use of i.e or e.g. on line %ds&Doubled word warning.  "%s" on line %ds(Unmatched open delimiter '%s' on line %dsUnmatched { on line %dsDone checking %d lines.N(tretcompiletsettcmdstrtsplittaddtintRRRRtNonetrstriptfindalltappendRRRtfindtsearchtgroup(#tsourcetoptstmorecmdsttexcmdtfalsetexcmdt	validcmdstcmdR	t	openpunctt
delimiterstbracestdoubledwordst
spacingmarkupRt
bracestackt
tablestartt	tablelinettableendt
tablelevelttablestartlinet	startlinetlinenotlinetbegendtnametpuncttopentclosetnctstartRtmtdwtlastlinetsymbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytcheckitJs�

2
	!	
cCs�|dkrtjd}ntj|d�\}}t|�}d|ksX|gkratGHdSt|�dkr|dGHdSxOt|�D]A\}}d|ks�d|kr�tj|�|||d+q�q�Wg|D]\}}|dkr�|^q�}g}	x}|D]u}
d	d
GHdG|
GHyt	|
�}Wnt
k
rOd|dGHd
SXz|	jt|||��Wd|j
�XqWt|	�S(Nisk:mdhs:vs-his#Please specify a file to be checkedt*t?s-kt=itCheckingsCannot open file %s.i(R tsystargvtgetopttdictt__doc__tlent	enumeratetglobR?tIOErrorR#RGR@tmax(targstoptitemstarglistR(titfilespectktvR)terrtfilenametf((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytmain�s6!+
		

t__main__(RPRRLRNt	itertoolsRRRRSRRRGR R`t__name__texit(((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyt<module>s 	z$

Zerion Mini Shell 1.0