|
| 1 | +\documentclass{minimal} |
| 2 | + |
| 3 | +\usepackage{ted} |
| 4 | + |
| 5 | +\makeatletter |
| 6 | +\let\sptoken= \@sptoken |
| 7 | +\let\hashtoken=# |
| 8 | +\let\tedout\ted@toks |
| 9 | +\def\nosanitize{\let\ted@sanitize\relax} |
| 10 | +\@ifdefinable\Test{% |
| 11 | +\long\def\Test#1\Endtest{% |
| 12 | + \typeout{\unexpanded{#1}}% |
| 13 | + #1}} |
| 14 | +\makeatother |
| 15 | + |
| 16 | +%% begin \Showtokens |
| 17 | + |
| 18 | +\ShowTokens{abc123} |
| 19 | +\ShowTokens{{}$&#^_ a0~b$\truc\relax} |
| 20 | +{ \let~=#% |
| 21 | + \ShowTokens{a\ifx b\bgroup c\sptoken d\egroup e\hashtoken f~g\par} |
| 22 | + } |
| 23 | +{ \uccode32=65 \catcode`B=10 \uccode`#=32 |
| 24 | + \uppercase{\ShowTokens{1 2B3#4}}% |
| 25 | + }% |
| 26 | +\expandafter\let\csname truc chose \space abc\endcsname=# |
| 27 | +\tedout\expandafter{\csname truc chose \space abc\endcsname a {\ifx}b% |
| 28 | + \bgroup lol} |
| 29 | +\ShowTokens*{\the\tedout} |
| 30 | + |
| 31 | +\edef\truc{12 45 789A \space2345 789B12 45 789C 2345 789D123456789E} |
| 32 | +\def\lol{aaaaaaa aaaaaaa aaaaaaaaa aaaaaaaaaaaaaa } |
| 33 | +\ShowTokens{a\truc 1\lol 2} |
| 34 | + |
| 35 | +\Test |
| 36 | +\ShowTokensLogonly |
| 37 | +\ShowTokens{{}$&#^_ a0~b$\truc\relax} |
| 38 | +\ShowTokensOnline |
| 39 | +\Endtest |
| 40 | + |
| 41 | +%% end \ShowTokens |
| 42 | +%% begin empty |
| 43 | + |
| 44 | +\ShowTokens{} |
| 45 | +\Substitute{}{a}{b} |
| 46 | +\showthe\tedout |
| 47 | +\Substitute{abc}{}{1}% donne a1b1c |
| 48 | +\showthe\tedout |
| 49 | +\Substitute{abcdeblabla}{a}{} |
| 50 | +\showthe\tedout |
| 51 | + |
| 52 | +%% end empty |
| 53 | +%% begin \Substitute |
| 54 | + |
| 55 | +\Substitute{a c}{a}{1} |
| 56 | +\ShowTokens*{\the\tedout} |
| 57 | +\Substitute{ }{}{} |
| 58 | +\ShowTokens*{\the\tedout} |
| 59 | +\Substitute{\sptoken}{}{} |
| 60 | +\ShowTokens*{\the\tedout} |
| 61 | +\Substitute{\bgroup}{}{} |
| 62 | +\ShowTokens*{\the\tedout} |
| 63 | +\Substitute{{}}{}{} |
| 64 | +\ShowTokens*{\the\tedout} |
| 65 | +\Substitute{#}{}{} |
| 66 | +\ShowTokens*{\the\tedout} |
| 67 | + |
| 68 | +\def\de{1} |
| 69 | +\def\vers{11} |
| 70 | +\tedout{a1b2c3d11e} |
| 71 | +\Substitute**{\the\tedout}{\de}{\vers} |
| 72 | +\ShowTokens*{\the\tedout} |
| 73 | +\tedout{a\de b\de c\de\de d} |
| 74 | +\Substitute*[\long\def\truc]{\the\tedout}{\de}{\vers} |
| 75 | +\show\truc |
| 76 | + |
| 77 | +{\catcode`(1 \catcode`)2 |
| 78 | +\Substitute{\par@is{\par(par{\par1 )\p}ar}\p@r}\par\ifcat |
| 79 | +\showthe\tedout |
| 80 | +\expandafter}\expandafter\tedout\expandafter{\the\tedout} |
| 81 | +\showthe\tedout |
| 82 | + |
| 83 | +\expandafter\Substitute\expandafter{\the\tedout}\ifcat\par |
| 84 | +\showthe\tedout |
| 85 | + |
| 86 | +\Substitute{Joss est beau, {Joss } est intelligent, { Joss} aime bien jouer % |
| 87 | + avec les catcodes{}. Josselin est un prénom bizarre.}{Joss}{Jean-Côme} |
| 88 | +\showthe\tedout |
| 89 | + |
| 90 | +\Substitute{Joss est beau, {Joss } est intelligent, { Joss} aime bien jouer % |
| 91 | + avec les catcodes{}. Josselin est un prénom bizarre.}{Joss}{Josselin} |
| 92 | +\showthe\tedout |
| 93 | + |
| 94 | +\Substitute{ Paris{,} {cap{ital}e} {du} libre{.} }{a}{aa} |
| 95 | +\showthe\tedout |
| 96 | + |
| 97 | +\Substitute{a#b#c#d}{#b#}{11#11} |
| 98 | +\showthe\tedout |
| 99 | + |
| 100 | +\Substitute{a#b#c#d}{b#c}{1#2#3} |
| 101 | +\showthe\tedout |
| 102 | + |
| 103 | +\Substitute{a{b}c{bcb} { {b}}} {{b}} {b{1}b} |
| 104 | +\showthe\tedout |
| 105 | + |
| 106 | +{ \uccode32 65 \uppercase{\gdef\test{\Substitute{a a b}{A}{X}}}} |
| 107 | +\test |
| 108 | +\ShowTokens*{\the\tedout} |
| 109 | + |
| 110 | +%% end \Substitute |
| 111 | + |
| 112 | +\begin{document} |
| 113 | + |
| 114 | +ab\par |
| 115 | +a\ShowTokens{abc}b\par |
| 116 | +a\Substitute{abc}{b}{d}b\par |
| 117 | + |
| 118 | +\nosanitize |
| 119 | +\begingroup \lccode`0`\% |
| 120 | +\lowercase{\endgroup \wlog{0vim0 tex_stylish}} |
| 121 | +\outer\def\STOP{\relax} |
| 122 | +\tracingmacros1 |
| 123 | +\tracingassigns1 |
| 124 | +%\tracingcommands1 |
| 125 | +%\tracingifs1 |
| 126 | + |
| 127 | +\tracingmacros0 |
| 128 | +\tracingassigns0 |
| 129 | +\tracingcommands0 |
| 130 | +\tracingifs0 |
| 131 | + |
| 132 | +\stop |
0 commit comments