Current File : //usr/share/texlive/texmf-dist/tex/latex/qstest/makematch.sty |
%%
%% This is file `makematch.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% makematch.dtx (with options: `package,etex')
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from makematch.sty.
%%
%% For distribution of the original source see the terms
%% for copying and modification in the file makematch.dtx.
%%
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% Copyright (C) 2006, 2007 QuinScape GmbH
%% http://www.quinscape.de
\NeedsTeXFormat{LaTeX2e}
\def\next$#1: #2.dtx #3 #4-#5-#6 #7${%
\ProvidesPackage{#2}[#4/#5/#6 1.#3 Pattern matching with
wildcards]
}
\next
$Id: makematch.dtx 7925 2007-02-23 14:22:19Z dkastrup $
\newcommand\MakeMatcher[3][\relax]{%
\edef#2{\detokenize{#3}}%
\def\qst@mmtmp##1##2#1{\qst@parseonecase{##1}{##2}}%
\let\qst@comma= #1\relax
\edef#2##1{\noexpand\qst@setup##1%
\expandafter\qst@parsestart\expandafter\@firstoftwo
#2#1{#1\m@ne}\noexpand\qst@finish}}
\long\def\qst@matchalways#1#2#3{#2}
\long\def\qst@matchnever#1#2#3{#3}
\def\qst@setup{\let\MatchedTarget\@undefined
\let\qst@finish\@secondoftwo
\futurelet\qst@matchlist\qst@setupii}
\def\qst@setupii{\ifcase
\ifcat\noexpand\qst@matchlist\bgroup\@ne\fi
\ifx\qst@matchlist[\tw@\fi %]
\m@ne
\or
\expandafter\MakeMatchTarget\expandafter\qst@matchlist
\or
\expandafter\qst@setupiii
\else \expandafter\@gobble
\fi}
\def\qst@setupiii[#1]{\MakeMatchTarget[{#1}]\qst@matchlist}
\def\qst@parsestart#1#2{%
\ifcase
\ifx\qst@comma#2\@ne\fi
\ifx\qst@comma\relax
\else\ifx!#2#1\tw@\@ne\fi
\fi
\thr@@
\or
\expandafter\qst@parsestart
\expandafter\@firstoftwo
\or
\expandafter\qst@parsestart
\expandafter\@secondoftwo
\or
\expandafter\qst@mmtmp
\expandafter#1%
\expandafter#2%
\fi
}
\def\qst@afterfi#1#2\fi{\fi#1}
\def\qst@parseonecase#1#2{%
\noexpand\qst@checkname {\qst@parsewild#2*\,23456789*}%
\noexpand#1\qst@parsestart\@firstoftwo}
\def\qst@parsewild#1*#2\,#3#4*{%
#1%
\ifx\,#2\,%
\else
#####3%
\qst@afterfi{\qst@skipwild#2\,#4*}%
\fi}
\def\qst@skipwild#1*#2\,{%
#1%
\ifcase
\ifx *#1*\ifx\,#2\,\else \@ne \fi \fi
\tw@
\or
\expandafter\qst@skipwild
\or
\expandafter\qst@parsewild\expandafter*%
\fi#2\,}
\def\qst@checkname#1{%
\def\qst@mmtmp##1\,#1\,{#1\,\@nil}%
\expandafter\expandafter\expandafter\qst@checknameii
\expandafter\qst@mmtmp
\expandafter\,\qst@matchlist\,#1\,\@nil}
\def\qst@checknameii#1\,#2\@nil#3{%
\ifcase
\ifx\@nil#3\@ne\fi
\ifx\@nil#2\@nil \tw@\fi
\m@ne
\or
\expandafter\qst@checknamenomatch
\or
\expandafter\qst@checknamematch
\fi \expandafter\qst@checknameii\qst@mmtmp#1\,#2#3}
\def\qst@checknamenomatch#1\@nil#2{}
\def\qst@checknamematch#1\qst@mmtmp#2\,#3\@nil{%
\def\MatchedTarget{#2}%
\let\qst@finish}
\def\RemoveMatched#1{\ifx#1\MatchedTarget
\let#1\@empty
\else
\expandafter\def\expandafter\qst@mmtmp
\expandafter##\expandafter1\expandafter\,\MatchedTarget\,{##1\,}%
\expandafter\def\expandafter#1\expandafter{%
\romannumeral\expandafter\expandafter\expandafter\z@
\expandafter\qst@remmat
\romannumeral\expandafter\expandafter\expandafter\z@
\expandafter\qst@mmtmp\expandafter\,#1\,\@nil}%
\fi}
\def\qst@remmat\,#1\,\@nil{#1}
\newcommand\MakeMatchTarget[3][\relax]{%
\def\qst@mmtmp##1#1##2{##1\noexpand\,\qst@mmtmp##2}%
\edef#2{\expandafter\qst@mmtmp\expandafter
\@gobbletwo\expandafter#1\detokenize{#3}\iffalse#1\fi}%
}
\endinput
%%
%% End of file `makematch.sty'.