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