summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-10-25 23:10:59 +0000
committerKarl Berry <karl@freefriends.org>2010-10-25 23:10:59 +0000
commitec47c1b7880fd4f626f8aa8377e576e03d72c24f (patch)
tree4c3095601b17f91dcd94509be36db313d43d3fa8 /Master/texmf-dist/tex
parent7df33fd1a4e61f23710ae0167ae14e4a01c1d483 (diff)
new latex package parselines (25oct10)
git-svn-id: svn://tug.org/texlive/trunk@20205 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/parselines/parselines.sty116
1 files changed, 116 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/parselines/parselines.sty b/Master/texmf-dist/tex/latex/parselines/parselines.sty
new file mode 100644
index 00000000000..62ae077860e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/parselines/parselines.sty
@@ -0,0 +1,116 @@
+%%
+%% This is file `parselines.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% parselines.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% parselines : 2010/06/20 v1.0 - parselines : catch file between delimiters or tags
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any later
+%% version. The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%%
+%% This work consists of the main source file parselines.dtx
+%% and the derived files
+%% parselines.sty, parselines.pdf, parselines.ins
+%%
+%% parselines : a simple line parser for TeX
+%% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
+%%
+\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX)
+ [2005/12/01]% LaTeX must be 2005/12/01 or younger
+\ProvidesPackage{parselines}
+ [2010/08/13 v1.0 - a simple line parser for TeX]
+\ifdefined\globtoks \globtoks\parselin@tk
+\else \newtoks\parselin@tk
+\fi
+\newcommand\CollectEnvir{}
+\protected\def\CollectEnvir#1{%
+ \gdef\parselin@Finish{#1%
+ \expandafter{\the\parselin@tk}%
+ \global\let\parselin@Finish\@undefined}%
+ \ifx\parselin@tk#1\else
+ \expandafter\def\expandafter\parselin@Finish
+ \expandafter{\parselin@Finish\parselin@tk{}}%
+ \if \relax
+ \expandafter\expandafter\expandafter\parselin@isatoken
+ \expandafter\meaning\expandafter#1\string\toks
+ \relax
+ \expandafter\gdef\expandafter\parselin@Finish
+ \expandafter{\expandafter\expandafter
+ \expandafter\def\expandafter\expandafter
+ \parselin@Finish}%
+ \fi\fi
+ \parselin@tk{}\def\parselin@stack{b}\parselin@Collect@Body
+}% \CollectEnvir
+\long\def\parselin@Collect@Body#1\end#2{%
+ \edef\parselin@stack{\parselin@PushBegins#1\begin\end\expandafter\@gobble\parselin@stack}%
+ \ifx\parselin@stack\@empty
+ \global\parselin@tk\expandafter{\the\parselin@tk#1}%
+ \aftergroup\parselin@Finish
+ \end{#2}%
+ \else
+ \parselin@tk\expandafter{\the\parselin@tk#1\end#2}%
+ \expandafter\parselin@Collect@Body % recurse
+ \fi
+}% \parselin@Collect@Body
+\long\def\parselin@PushBegins#1\begin#2{\ifx\end#2\else b\expandafter\parselin@PushBegins\fi}
+\expandafter\def\expandafter\parselin@isatoken
+ \expandafter#\expandafter1\string\toks#2\relax{\detokenize{#2}\relax}%
+\newenvironment{parse lines}[2][]
+{%
+ #1%
+ \count@\z@\def\row{\number\count@}%
+ \def\parselin@ProcessLine##1{\advance\count@\@ne #2}%
+ \parselin@endlinechar{%
+ \def~##1~{%
+ \ifx\parselin@@@@@@##1\relax
+ \else \parselin@ProcessLine{##1}\expandafter~%
+ \fi}%
+ }%
+ \catcode\endlinechar\active
+ \CollectEnvir\parselin@tk
+}
+{%
+ \parselin@endlinechar{%
+ \parselin@tk\expandafter{\the\parselin@tk\parselin@@@@@@~}%
+ }\the\parselin@tk
+}%
+\long\def\parselin@endlinechar#1{\begingroup
+ \lccode`\~\endlinechar \lowercase{\endgroup#1}%
+}% \parselin@endlinechar
+\def\parselin@@@@@@{\parselin@@@@@@}
+\newread\parselin@read
+\newrobustcmd*\dofilebyline{\let\parselin@Finish\@empty
+ \@ifstar
+ \parselin@dobyline
+ {\edef\parselin@Finish{\endlinechar\the\endlinechar\relax}%
+ \endlinechar\m@ne
+ \parselin@dobyline}%
+}% \dofilebyline
+\newrobustcmd\parselin@dobyline[1]{% #1 = file name
+ \IfFileExists{#1}
+ \parselin@do@byline
+ {\PackageError{parselines}
+ {No file #1 found !
+ \MessageBreak Your command \string\dobyline\space was ignored}\@eha
+ }%
+}% \parselin@dobyline
+\def\parselin@do@byline{%
+ \openin\parselin@read=\@filef@und%
+ \loop
+ \ifeof\parselin@read\else
+ \read\parselin@read to\@tempa
+ \expandafter\do\expandafter{\@tempa}%
+ \repeat
+ \parselin@Finish
+}% \parselin@do@byline
+\endinput
+%%
+%% End of file `parselines.sty'.