toks-aux.mkxl /size: 1796 b    last modification: 2021-10-28 13:51
1%D \module
2%D   [       file=toks-aux,
3%D        version=2018.11.29,
4%D          title=\CONTEXT\ Token Support,
5%D       subtitle=Helpers,
6%D         author=Wolfgang Schuster,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\writestatus{loading}{ConTeXt Token Support / Helpers}
15
16\unprotect
17
18%D The older \type {\scantokens} overload has been replace by a more modern one (in
19%D \LMTX):
20%D
21%D \starttyping
22%D \protected\def\whatever#1[#2](#3)\relax{oeps #1 and #2 and #3 done ## error}
23%D \scratchtoks{foo \framed{\red 123}456}
24%D
25%D \showluatokens{123\what}
26%D \showluatokens\whatever
27%D \showluatokens\framed
28%D
29%D \showluatokens\scratchtoks
30%D \showluatokens\everypar
31%D \stoptyping
32
33\registerctxluafile{toks-aux}{autosuffix}
34
35\installcorenamespace {tokenlist}
36
37\permanent\protected\def\definetokenlist[#1]%
38  {\ifcsname\??tokenlist#1\endcsname
39     \global\lastnamedcs\emptytoks
40   \else
41     \expandafter\newtoks\csname\??tokenlist#1\endcsname
42   \fi}
43
44\permanent\protected\def\starttokenlist[#1]#2\stoptokenlist
45  {\ifcsname\??tokenlist#1\endcsname \else
46     \expandafter\newtoks\csname\??tokenlist#1\endcsname
47   \fi
48   \toksapp\lastnamedcs{#2}}
49
50\permanent\protected\lettonothing\stoptokenlist
51
52\permanent\def\gettokenlist[#1]%
53  {\ifcsname\??tokenlist#1\endcsname
54     \the\lastnamedcs
55   \fi}
56
57\permanent\protected\def\settokenlist[#1]#2%
58  {\ifcsname\??tokenlist#1\endcsname \else
59     \expandafter\newtoks\csname\??tokenlist#1\endcsname
60   \fi
61   \toksapp\lastnamedcs{#2}}
62
63\permanent\protected\def\resettokenlist[#1]%
64  {\ifcsname\??tokenlist#1\endcsname
65     \lastnamedcs\emptytoks
66   \fi}
67
68\protect
69