| 1 |
\def\mylstwd{.55em} |
| 2 |
\lstdefinelanguage{expkv}[primitive]{TeX} |
| 3 |
{ |
| 4 |
,moretexcs=[2]% e-TeX |
| 5 |
{ |
| 6 |
expanded, |
| 7 |
numexpr, |
| 8 |
protected, |
| 9 |
unexpanded, |
| 10 |
ifdefined, |
| 11 |
detokenize, |
| 12 |
} |
| 13 |
,moretexcs=[3]% plain/LaTeX/ConTeXt |
| 14 |
{ |
| 15 |
approx, |
| 16 |
begin,end, |
| 17 |
cdot, |
| 18 |
emph,empty, |
| 19 |
item, |
| 20 |
LaTeX, |
| 21 |
makeatletter,makeatother,multicolumn, |
| 22 |
newcommand,renewcommand,newdimen,newif,newcount,NewDocumentCommand, |
| 23 |
usepackage,RequirePackage,ProvidesPackage, |
| 24 |
raggedright, |
| 25 |
rule, |
| 26 |
space,stop, |
| 27 |
smallskip,medskip,bigskip, |
| 28 |
TeX, |
| 29 |
textit,texttt, |
| 30 |
usepackage, |
| 31 |
usemodule, |
| 32 |
@gobble,@gobbletwo,@firstofone,@empty,@firstoftwo,@secondoftwo, |
| 33 |
ExplSyntaxOn,ExplSyntaxOff, |
| 34 |
} |
| 35 |
,moretexcs=[4]% used packages |
| 36 |
{ |
| 37 |
% xfp |
| 38 |
fpeval, |
| 39 |
% keyval |
| 40 |
setkeys, |
| 41 |
% kvsetkeys |
| 42 |
kvsetkeys, |
| 43 |
% color |
| 44 |
textcolor, |
| 45 |
% yax |
| 46 |
defactiveparameter,storevalue,setparameterlist, |
| 47 |
% graphics |
| 48 |
includegraphics, |
| 49 |
} |
| 50 |
,moretexcs=[5]% expkv macros |
| 51 |
{ |
| 52 |
ekvdef,ekvdefNoVal,% |
| 53 |
ekvlet,ekvletNoVal,ekvletkv,ekvletkvNoVal,% |
| 54 |
ekvdefunknown,ekvdefunknownNoVal,% |
| 55 |
ekvletunknown,ekvletunknownNoVal,% |
| 56 |
ekvredirectunknown,ekvredirectunknownNoVal,% |
| 57 |
ekvset,ekvsetSneaked,% |
| 58 |
ekvsetdef,ekvsetSneakeddef,ekvsetdefSneaked,% |
| 59 |
ekvcompile,% |
| 60 |
ekvparse,% |
| 61 |
ekvVersion,ekvDate,% |
| 62 |
ekvifdefined,ekvifdefinedNoVal,ekvifdefinedset,% |
| 63 |
ekvbreak,ekvbreakPreSneak,ekvbreakPostSneak,% |
| 64 |
ekvsneak,ekvsneakPre,% |
| 65 |
ekvchangeset,% |
| 66 |
ekvmorekv,% |
| 67 |
ekvoptarg,ekvoptargTF,% |
| 68 |
ekvcsvloop,% |
| 69 |
ekverr,% |
| 70 |
ekv@name,% |
| 71 |
} |
| 72 |
,moretexcs=[6]% expkv-cs macros |
| 73 |
{ |
| 74 |
ekvcSecondaryKeys,% |
| 75 |
ekvcSplit,ekvcSplitAndForward,ekvcSplitAndUse,% |
| 76 |
ekvcHash,ekvcHashAndForward,ekvcHashAndUse,% |
| 77 |
ekvcValue,ekvcValueFast,ekvcValueSplit,ekvcValueSplitFast,% |
| 78 |
ekvcChange,% |
| 79 |
ekvcPass,% |
| 80 |
} |
| 81 |
,moretexcs=[7]% expkv-def macros |
| 82 |
{ |
| 83 |
ekvdefinekeys |
| 84 |
} |
| 85 |
,moretexcs=[8]% expkv-pop macros |
| 86 |
{ |
| 87 |
ekvpNewParser, |
| 88 |
ekvpDefType, |
| 89 |
ekvpDefPrefix,ekvpDefAutoPrefix,ekvpDefPrefixStore,ekvpDefPrefixLet, |
| 90 |
ekvpLet, |
| 91 |
ekvpValueAlwaysRequired,ekvpDefNoValue,ekvpUseNoValueMarker, |
| 92 |
ekvpDefNoValuePrefix,ekvpDefNoType,ekvpDefNoValue, |
| 93 |
ekvpEOP,ekvpGobbleP,ekvpEOT,ekvpGobbleT,ekvpEOA,ekvpGobbleA, |
| 94 |
ekvpIfNoVal, |
| 95 |
ekvpAssertIf,ekvpAssertIfNot,ekvpAssertTF,ekvpAssertTFNot, |
| 96 |
ekvpAssertValue,ekvpAssertNoValue, |
| 97 |
ekvpAssertOneValue,ekvpAssertTwoValues, |
| 98 |
ekvpParse, |
| 99 |
} |
| 100 |
,moretexcs=[9]% expkv-opt macros |
| 101 |
{ |
| 102 |
ekvoProcessOptions,% |
| 103 |
ekvoProcessLocalOptions,ekvoProcessGlobalOptions,% |
| 104 |
ekvoProcessFutureOptions,ekvoProcessOptionsList,% |
| 105 |
ekvoUseUnknownHandlers,% |
| 106 |
ekvoVersion,ekvoDate,% |
| 107 |
} |
| 108 |
,alsoletter={_:} |
| 109 |
,moretexcs=[10]% expl3 |
| 110 |
{ |
| 111 |
cs_new_eq:NN, |
| 112 |
tl_count_tokens:n, |
| 113 |
} |
| 114 |
} |
| 115 |
\colorlet{codeparam}{cyan!65!black} |
| 116 |
\lstdefinestyle{expkv} |
| 117 |
{ |
| 118 |
texcsstyle=*[5]{\bfseries\color{ekvred}} % expkv |
| 119 |
,texcsstyle=*[6]{\color{ekvred}} % expkv-cs |
| 120 |
,texcsstyle=*[7]{\color{ekvred}} % expkv-def |
| 121 |
,texcsstyle=*[8]{\color{ekvred}} % expkv-pop |
| 122 |
,texcsstyle=*[9]{\color{ekvred}} % expkv-opt |
| 123 |
} |
| 124 |
\lstdefinestyle{expkv-cs} |
| 125 |
{ |
| 126 |
texcsstyle=*[5]{\color{ekvred}} % expkv |
| 127 |
,texcsstyle=*[6]{\bfseries\color{ekvred}} % expkv-cs |
| 128 |
,texcsstyle=*[7]{\color{ekvred}} % expkv-def |
| 129 |
,texcsstyle=*[8]{\color{ekvred}} % expkv-pop |
| 130 |
,texcsstyle=*[9]{\color{ekvred}} % expkv-opt |
| 131 |
} |
| 132 |
\lstdefinestyle{expkv-def} |
| 133 |
{ |
| 134 |
texcsstyle=*[5]{\color{ekvred}} % expkv |
| 135 |
,texcsstyle=*[6]{\color{ekvred}} % expkv-cs |
| 136 |
,texcsstyle=*[7]{\bfseries\color{ekvred}} % expkv-def |
| 137 |
,texcsstyle=*[8]{\color{ekvred}} % expkv-pop |
| 138 |
,texcsstyle=*[9]{\color{ekvred}} % expkv-opt |
| 139 |
} |
| 140 |
\lstdefinestyle{expkv-pop} |
| 141 |
{ |
| 142 |
texcsstyle=*[5]{\color{ekvred}} % expkv |
| 143 |
,texcsstyle=*[6]{\color{ekvred}} % expkv-cs |
| 144 |
,texcsstyle=*[7]{\color{ekvred}} % expkv-def |
| 145 |
,texcsstyle=*[8]{\bfseries\color{ekvred}} % expkv-pop |
| 146 |
,texcsstyle=*[9]{\color{ekvred}} % expkv-opt |
| 147 |
} |
| 148 |
\lstdefinestyle{expkv-opt} |
| 149 |
{ |
| 150 |
texcsstyle=*[5]{\color{ekvred}} % expkv |
| 151 |
,texcsstyle=*[6]{\color{ekvred}} % expkv-cs |
| 152 |
,texcsstyle=*[7]{\color{ekvred}} % expkv-def |
| 153 |
,texcsstyle=*[8]{\color{ekvred}} % expkv-pop |
| 154 |
,texcsstyle=*[9]{\bfseries\color{ekvred}} % expkv-opt |
| 155 |
} |
| 156 |
\lstdefinestyle{expkv-all} |
| 157 |
{ |
| 158 |
texcsstyle=*[5]{\bfseries\color{ekvred}} % expkv |
| 159 |
,texcsstyle=*[6]{\bfseries\color{ekvred}} % expkv-cs |
| 160 |
,texcsstyle=*[7]{\bfseries\color{ekvred}} % expkv-def |
| 161 |
,texcsstyle=*[8]{\bfseries\color{ekvred}} % expkv-pop |
| 162 |
,texcsstyle=*[9]{\bfseries\color{ekvred}} % expkv-opt |
| 163 |
} |
| 164 |
\lstset |
| 165 |
{ |
| 166 |
,language=expkv |
| 167 |
,style=expkv |
| 168 |
,flexiblecolumns=false |
| 169 |
,basewidth=\mylstwd |
| 170 |
%,basicstyle=\fontfamily{lmtt}\selectfont |
| 171 |
%,basicstyle=\fontfamily{GoMono-TLF}\selectfont%\itshape |
| 172 |
%,basicstyle=\fontfamily{jkp}\selectfont%\itshape |
| 173 |
%,basicstyle=\fontfamily{jkptt}\selectfont%\itshape |
| 174 |
,basicstyle=\fontfamily{txtt}\selectfont%\itshape |
| 175 |
,texcsstyle=*[1]{\bfseries\color{ekvgrey}} % primitives |
| 176 |
,texcsstyle=*[2]{\bfseries\color{ekvgrey}} % e-TeX |
| 177 |
,texcsstyle=*[3]{\bfseries\color{ekvgrey}} % plain/LaTeX macros |
| 178 |
,texcsstyle=*[4]{\bfseries\color{ekvgrey}} % macros of other packages |
| 179 |
,texcsstyle=*[10]{\bfseries\color{ekvgrey}} % macros of expl3 |
| 180 |
,commentstyle=\color[gray]{0.4} |
| 181 |
,literate= |
| 182 |
{\{} {{\CodeUpBf\{}}{1} |
| 183 |
{\}} {{\CodeUpBf\}}}{1} |
| 184 |
{$} {{\CodeUpBf\$}}{1} |
| 185 |
{[} {{\CodeUp[}}{1} |
| 186 |
{]} {{\CodeUp]}}{1} |
| 187 |
{(} {{\CodeUp(}}{1} |
| 188 |
{)} {{\CodeUp)}}{1} |
| 189 |
{*} {{$*$}}{1} |
| 190 |
{1} {{\CodeUp{1}}}{1} |
| 191 |
{2} {{\CodeUp{2}}}{1} |
| 192 |
{3} {{\CodeUp{3}}}{1} |
| 193 |
{4} {{\CodeUp{4}}}{1} |
| 194 |
{5} {{\CodeUp{5}}}{1} |
| 195 |
{6} {{\CodeUp{6}}}{1} |
| 196 |
{7} {{\CodeUp{7}}}{1} |
| 197 |
{8} {{\CodeUp{8}}}{1} |
| 198 |
{9} {{\CodeUp{9}}}{1} |
| 199 |
{0} {{\CodeUp{0}}}{1} |
| 200 |
{##} {{\CodeColored{codeparam}{1}{\#}}}{1} |
| 201 |
{##1}{{\CodeColored{codeparam}{2}{\#1}}}{2} |
| 202 |
{##2}{{\CodeColored{codeparam}{2}{\#2}}}{2} |
| 203 |
{##3}{{\CodeColored{codeparam}{2}{\#3}}}{2} |
| 204 |
{##4}{{\CodeColored{codeparam}{2}{\#4}}}{2} |
| 205 |
{##5}{{\CodeColored{codeparam}{2}{\#5}}}{2} |
| 206 |
{##6}{{\CodeColored{codeparam}{2}{\#6}}}{2} |
| 207 |
{##7}{{\CodeColored{codeparam}{2}{\#7}}}{2} |
| 208 |
{##8}{{\CodeColored{codeparam}{2}{\#8}}}{2} |
| 209 |
{##9}{{\CodeColored{codeparam}{2}{\#9}}}{2} |
| 210 |
{<key>}{{$\langle$}key{$\rangle$}}{5} |
| 211 |
{<set>}{{$\langle$}set{$\rangle$}}{5} |
| 212 |
{<set1>}{{$\langle$}set1{$\rangle$}}{6} |
| 213 |
{<set2>}{{$\langle$}set2{$\rangle$}}{6} |
| 214 |
%,literate=*{<key>}{\key}{4}{<set>}{\set}{4} |
| 215 |
} |
| 216 |
\newcommand*\CodeColored[3]{\textcolor{#1}{\makebox[\dimexpr\mylstwd*#2]{#3}}} |
| 217 |
\newcommand*\CodeUpBf[1]{\makebox[\mylstwd]{\textup{\textbf{#1}}}} |
| 218 |
\newcommand*\CodeUp[1]{\makebox[\mylstwd]{\textup{#1}}} |