diff options
author | Karl Berry <karl@freefriends.org> | 2012-08-13 22:40:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-08-13 22:40:06 +0000 |
commit | 99f6ebc940e504927ea38d6600f8ca9f893667bb (patch) | |
tree | 3d5ad87dd691152e3f00d0bbb056f6933654ff1f /Master/texmf-dist/tex/latex/xpeek | |
parent | dd8cdebd361b58d83e12316d2f533932bfea8ae9 (diff) |
new (semi-old) latex package xpeek (13aug12)
git-svn-id: svn://tug.org/texlive/trunk@27393 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/xpeek')
-rw-r--r-- | Master/texmf-dist/tex/latex/xpeek/xpeek.sty | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/xpeek/xpeek.sty b/Master/texmf-dist/tex/latex/xpeek/xpeek.sty new file mode 100644 index 00000000000..b94499e2146 --- /dev/null +++ b/Master/texmf-dist/tex/latex/xpeek/xpeek.sty @@ -0,0 +1,76 @@ +%% +%% This is file `xpeek.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xpeek.dtx (with options: `package') +%% ---------------------------------------------------------------- +%% +%% xpeek: Define commands that peek ahead in the input stream +%% +%% Copyright © 2012 by Joel C. Salomon. +%% +%% This work consists of the file xpeek.dtx, +%% and the derived files xpeek.ins, +%% xpeek.pdf, & +%% xpeek.sty. +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is at ‹http://www.latex-project.org/lppl.txt›. +%% +%% This work is “maintained” (per LPPL maintenance status) by +%% Joel C. Salomon ‹joelcsalomon@gmail.com›. +%% +%% ---------------------------------------------------------------- +\RequirePackage{expl3, xparse} +\ProvidesExplPackage + {xpeek} {2012/08/09} {0.1} + {Define commands that peek ahead in the input stream} +\tl_new:N \g_xpeek_matchlist_tl +\tl_new:N \g_xpeek_ignorelist_tl +\tl_new:N \l__xpeek_code_tl +\cs_new_protected:Npn \xpeek_after:nw #1 + { + \tl_set:Nn \l__xpeek_code_tl {#1} + \peek_after:Nw \l__xpeek_code_tl + } +\tl_new:N \l__xpeek_collected_tokens_tl +\cs_new_protected:Npn \xpeek_collect_do:nn #1#2 + { + \tl_clear:N \l__xpeek_collected_tokens_tl + \__xpeek_collect_do:nnn {#1} {#2} {} + } +\cs_new_protected:Npn \__xpeek_collect_do:nnn #1#2#3 + { + \xpeek_after:nw + { + \xpeek_if_in:NNTF #1 \l_peek_token + { + \tl_put_right:Nn \l__xpeek_collected_tokens_tl {#3} + \__xpeek_collect_do:nnn {#1} {#2} + } + { + #2 { \l__xpeek_collected_tokens_tl #3 } + } + } + } +\bool_new:N \l__xpeek_bool +\prg_new_protected_conditional:Npnn \xpeek_if_in:NN #1#2 { TF } + { + \bool_set_false:N \l__xpeek_bool + \tl_map_inline:Nn #1 + { + \token_if_eq_charcode:NNT #2 ##1 + { + \bool_set_true:N \l__xpeek_bool + \tl_map_break: + } + } + \bool_if:NTF \l__xpeek_bool + { \prg_return_true: } { \prg_return_false: } + } +%% +%% +%% End of file `xpeek.sty'. |