1 | %%
|
---|
2 | %% This is file `lstmisc.sty',
|
---|
3 | %% generated with the docstrip utility.
|
---|
4 | %%
|
---|
5 | %% The original source files were:
|
---|
6 | %%
|
---|
7 | %% listings.dtx (with options: `misc,0.21')
|
---|
8 | %%
|
---|
9 | %% Please read the software license in listings-1.3.dtx or listings-1.3.pdf.
|
---|
10 | %%
|
---|
11 | %% (w)(c) 1996--2004 Carsten Heinz and/or any other author listed
|
---|
12 | %% elsewhere in this file.
|
---|
13 | %% (c) 2006 Brooks Moses
|
---|
14 | %% (c) 2013- Jobst Hoffmann
|
---|
15 | %%
|
---|
16 | %% Send comments and ideas on the package, error reports and additional
|
---|
17 | %% programming languages to Jobst Hoffmann at <j.hoffmann@fh-aachen.de>.
|
---|
18 | %%
|
---|
19 | \def\filedate{2015/06/04}
|
---|
20 | \def\fileversion{1.6}
|
---|
21 | \ProvidesFile{lstmisc.sty}
|
---|
22 | [\filedate\space\fileversion\space(Carsten Heinz)]
|
---|
23 | \lst@CheckVersion\fileversion
|
---|
24 | {\typeout{^^J%
|
---|
25 | ***^^J%
|
---|
26 | *** This file requires `listings.sty' version \fileversion.^^J%
|
---|
27 | *** You have a serious problem, so I'm exiting ...^^J%
|
---|
28 | ***^^J}%
|
---|
29 | \batchmode \@@end}
|
---|
30 | \lst@BeginAspect{writefile}
|
---|
31 | \newtoks\lst@WFtoken % global
|
---|
32 | \lst@AddToHook{InitVarsBOL}{\global\lst@WFtoken{}}
|
---|
33 | \newwrite\lst@WF
|
---|
34 | \global\let\lst@WFifopen\iffalse % init
|
---|
35 | \gdef\lst@WFWriteToFile{%
|
---|
36 | \begingroup
|
---|
37 | \let\lst@UM\@empty
|
---|
38 | \expandafter\edef\expandafter\lst@temp\expandafter{\the\lst@WFtoken}%
|
---|
39 | \immediate\write\lst@WF{\lst@temp}%
|
---|
40 | \endgroup
|
---|
41 | \global\lst@WFtoken{}}
|
---|
42 | \gdef\lst@WFAppend#1{%
|
---|
43 | \global\lst@WFtoken=\expandafter{\the\lst@WFtoken#1}}
|
---|
44 | \gdef\lst@BeginWriteFile{\lst@WFBegin\@gobble}
|
---|
45 | \gdef\lst@BeginAlsoWriteFile{\lst@WFBegin\lst@OutputBox}
|
---|
46 | \begingroup \catcode`\^^I=11
|
---|
47 | \gdef\lst@WFBegin#1#2{%
|
---|
48 | \begingroup
|
---|
49 | \let\lst@OutputBox#1%
|
---|
50 | \def\lst@Append##1{%
|
---|
51 | \advance\lst@length\@ne
|
---|
52 | \expandafter\lst@token\expandafter{\the\lst@token##1}%
|
---|
53 | \ifx ##1\lst@outputspace \else
|
---|
54 | \lst@WFAppend##1%
|
---|
55 | \fi}%
|
---|
56 | \lst@lAddTo\lst@PreGotoTabStop{\lst@WFAppend{^^I}}%
|
---|
57 | \lst@lAddTo\lst@ProcessSpace{\lst@WFAppend{ }}%
|
---|
58 | \let\lst@DeInit\lst@WFDeInit
|
---|
59 | \let\lst@MProcessListing\lst@WFMProcessListing
|
---|
60 | \lst@WFifopen\else
|
---|
61 | \immediate\openout\lst@WF=#2\relax
|
---|
62 | \global\let\lst@WFifopen\iftrue
|
---|
63 | \@gobbletwo\fi\fi
|
---|
64 | \fi}
|
---|
65 | \endgroup
|
---|
66 | \gdef\lst@EndWriteFile{%
|
---|
67 | \immediate\closeout\lst@WF \endgroup
|
---|
68 | \global\let\lst@WFifopen\iffalse}
|
---|
69 | \global\let\lst@WFMProcessListing\lst@MProcessListing
|
---|
70 | \global\let\lst@WFDeInit\lst@DeInit
|
---|
71 | \lst@AddToAtTop\lst@WFMProcessListing{\lst@WFWriteToFile}
|
---|
72 | \lst@AddToAtTop\lst@WFDeInit{%
|
---|
73 | \ifnum\lst@length=\z@\else \lst@WFWriteToFile \fi}
|
---|
74 | \lst@EndAspect
|
---|
75 | \lst@BeginAspect{strings}
|
---|
76 | \gdef\lst@stringtypes{d,b,m,bd,db,s}
|
---|
77 | \gdef\lst@StringKey#1#2{%
|
---|
78 | \lst@Delim\lst@stringstyle #2\relax
|
---|
79 | {String}\lst@stringtypes #1%
|
---|
80 | {\lst@BeginString\lst@EndString}%
|
---|
81 | \@@end\@empty{}}
|
---|
82 | \lst@Key{string}\relax{\lst@StringKey\@empty{#1}}
|
---|
83 | \lst@Key{morestring}\relax{\lst@StringKey\relax{#1}}
|
---|
84 | \lst@Key{deletestring}\relax{\lst@StringKey\@nil{#1}}
|
---|
85 | \lst@Key{stringstyle}{}{\def\lst@stringstyle{#1}}
|
---|
86 | \lst@AddToHook{EmptyStyle}{\let\lst@stringstyle\@empty}
|
---|
87 | \lst@Key{showstringspaces}t[t]{\lstKV@SetIf{#1}\lst@ifshowstringspaces}
|
---|
88 | \gdef\lst@BeginString{%
|
---|
89 | \lst@DelimOpen
|
---|
90 | \lst@ifexstrings\else
|
---|
91 | {\lst@ifshowstringspaces
|
---|
92 | \lst@keepspacestrue
|
---|
93 | \let\lst@outputspace\lst@visiblespace
|
---|
94 | \fi}}
|
---|
95 | \lst@AddToHookExe{ExcludeDelims}{\let\lst@ifexstrings\iffalse}
|
---|
96 | \gdef\lst@EndString{\lst@DelimClose\lst@ifexstrings\else}
|
---|
97 | \gdef\lst@StringDM@d#1#2\@empty#3#4#5{%
|
---|
98 | \lst@CArg #2\relax\lst@DefDelimBE{}{}{}#3{#1}{#5}#4}
|
---|
99 | \gdef\lst@StringDM@b#1#2\@empty#3#4#5{%
|
---|
100 | \let\lst@ifbstring\iftrue
|
---|
101 | \lst@CArg #2\relax\lst@DefDelimBE
|
---|
102 | {\lst@ifletter \lst@Output \lst@letterfalse \fi}%
|
---|
103 | {\ifx\lst@lastother\lstum@backslash
|
---|
104 | \expandafter\@gobblethree
|
---|
105 | \fi}{}#3{#1}{#5}#4}
|
---|
106 | \global\let\lst@ifbstring\iffalse % init
|
---|
107 | \lst@AddToHook{SelectCharTable}{%
|
---|
108 | \lst@ifbstring
|
---|
109 | \lst@CArgX \\\\\relax \lst@CDefX{}%
|
---|
110 | {\lst@ProcessOther\lstum@backslash
|
---|
111 | \lst@ProcessOther\lstum@backslash
|
---|
112 | \let\lst@lastother\relax}%
|
---|
113 | {}%
|
---|
114 | \fi}
|
---|
115 | \global\let\lst@StringDM@bd\lst@StringDM@b
|
---|
116 | \global\let\lst@StringDM@db\lst@StringDM@bd
|
---|
117 | \gdef\lst@StringDM@m#1#2\@empty#3#4#5{%
|
---|
118 | \lst@CArg #2\relax\lst@DefDelimBE{}{}%
|
---|
119 | {\let\lst@next\@gobblethree
|
---|
120 | \lst@ifletter\else
|
---|
121 | \lst@IfLastOtherOneOf{)].0123456789\lstum@rbrace'}%
|
---|
122 | {}%
|
---|
123 | {\let\lst@next\@empty}%
|
---|
124 | \fi
|
---|
125 | \lst@next}#3{#1}{#5}#4}
|
---|
126 | \gdef\lst@StringDM@s#1#2#3\@empty#4#5#6{%
|
---|
127 | \lst@CArg #2\relax\lst@DefDelimB{}{}{}#4{#1}{#6}%
|
---|
128 | \lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}}
|
---|
129 | \lst@SaveOutputDef{"7D}\lstum@rbrace
|
---|
130 | \lst@EndAspect
|
---|
131 | \lst@BeginAspect{mf}
|
---|
132 | \lst@AddTo\lst@stringtypes{,mf}
|
---|
133 | \lst@NewMode\lst@mfinputmode
|
---|
134 | \gdef\lst@String@mf#1\@empty#2#3#4{%
|
---|
135 | \lst@CArg #1\relax\lst@DefDelimB
|
---|
136 | {}{}{\lst@ifletter \expandafter\@gobblethree \fi}%
|
---|
137 | \lst@BeginStringMFinput\lst@mfinputmode{#4\lst@Lmodetrue}%
|
---|
138 | \@ifundefined{lsts@semicolon}%
|
---|
139 | {\lst@DefSaveDef{`\;}\lsts@semicolon{% ; and space end the filename
|
---|
140 | \ifnum\lst@mode=\lst@mfinputmode
|
---|
141 | \lst@XPrintToken
|
---|
142 | \expandafter\lst@LeaveMode
|
---|
143 | \fi
|
---|
144 | \lsts@semicolon}%
|
---|
145 | \lst@DefSaveDef{`\ }\lsts@space{%
|
---|
146 | \ifnum\lst@mode=\lst@mfinputmode
|
---|
147 | \lst@XPrintToken
|
---|
148 | \expandafter\lst@LeaveMode
|
---|
149 | \fi
|
---|
150 | \lsts@space}%
|
---|
151 | }{}}
|
---|
152 | \gdef\lst@BeginStringMFinput#1#2#3\@empty{%
|
---|
153 | \lst@TrackNewLines \lst@XPrintToken
|
---|
154 | \begingroup
|
---|
155 | \lst@mode\lst@nomode
|
---|
156 | #3\lst@XPrintToken
|
---|
157 | \endgroup
|
---|
158 | \lst@ResetToken
|
---|
159 | \lst@EnterMode{#1}{\def\lst@currstyle#2}%
|
---|
160 | \lst@ifshowstringspaces
|
---|
161 | \lst@keepspacestrue
|
---|
162 | \let\lst@outputspace\lst@visiblespace
|
---|
163 | \fi}
|
---|
164 | \lst@EndAspect
|
---|
165 | \lst@BeginAspect{comments}
|
---|
166 | \lst@NewMode\lst@commentmode
|
---|
167 | \gdef\lst@commenttypes{l,f,s,n}
|
---|
168 | \gdef\lst@CommentKey#1#2{%
|
---|
169 | \lst@Delim\lst@commentstyle #2\relax
|
---|
170 | {Comment}\lst@commenttypes #1%
|
---|
171 | {\lst@BeginComment\lst@EndComment}%
|
---|
172 | i\@empty{\lst@BeginInvisible\lst@EndInvisible}}
|
---|
173 | \lst@Key{comment}\relax{\lst@CommentKey\@empty{#1}}
|
---|
174 | \lst@Key{morecomment}\relax{\lst@CommentKey\relax{#1}}
|
---|
175 | \lst@Key{deletecomment}\relax{\lst@CommentKey\@nil{#1}}
|
---|
176 | \lst@Key{commentstyle}{}{\def\lst@commentstyle{#1}}
|
---|
177 | \lst@AddToHook{EmptyStyle}{\let\lst@commentstyle\itshape}
|
---|
178 | \gdef\lst@BeginComment{%
|
---|
179 | \lst@DelimOpen
|
---|
180 | \lst@ifexcomments\else
|
---|
181 | \lsthk@AfterBeginComment}
|
---|
182 | \gdef\lst@EndComment{\lst@DelimClose\lst@ifexcomments\else}
|
---|
183 | \lst@AddToHook{AfterBeginComment}{}
|
---|
184 | \lst@AddToHookExe{ExcludeDelims}{\let\lst@ifexcomments\iffalse}
|
---|
185 | \gdef\lst@BeginInvisible#1#2#3\@empty{%
|
---|
186 | \lst@TrackNewLines \lst@XPrintToken
|
---|
187 | \lst@BeginDropOutput{#1}}
|
---|
188 | \gdef\lst@EndInvisible#1\@empty{\lst@EndDropOutput}
|
---|
189 | \gdef\lst@CommentDM@l#1#2\@empty#3#4#5{%
|
---|
190 | \lst@CArg #2\relax\lst@DefDelimB{}{}{}#3{#1}{#5\lst@Lmodetrue}}
|
---|
191 | \gdef\lst@CommentDM@f#1{%
|
---|
192 | \@ifnextchar[{\lst@Comment@@f{#1}}%
|
---|
193 | {\lst@Comment@@f{#1}[0]}}
|
---|
194 | \gdef\lst@Comment@@f#1[#2]#3\@empty#4#5#6{%
|
---|
195 | \lst@CArg #3\relax\lst@DefDelimB{}{}%
|
---|
196 | {\lst@CalcColumn
|
---|
197 | \ifnum #2=\@tempcnta\else
|
---|
198 | \expandafter\@gobblethree
|
---|
199 | \fi}%
|
---|
200 | #4{#1}{#6\lst@Lmodetrue}}
|
---|
201 | \gdef\lst@CommentDM@s#1#2#3\@empty#4#5#6{%
|
---|
202 | \lst@CArg #2\relax\lst@DefDelimB{}{}{}#4{#1}{#6}%
|
---|
203 | \lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}}
|
---|
204 | \gdef\lst@CommentDM@n#1#2#3\@empty#4#5#6{%
|
---|
205 | \ifx\@empty#3\@empty\else
|
---|
206 | \def\@tempa{#2}\def\@tempb{#3}%
|
---|
207 | \ifx\@tempa\@tempb
|
---|
208 | \PackageError{Listings}{Identical delimiters}%
|
---|
209 | {These delimiters make no sense with nested comments.}%
|
---|
210 | \else
|
---|
211 | \lst@CArg #2\relax\lst@DefDelimB
|
---|
212 | {}%
|
---|
213 | {\ifnum\lst@mode=#1\relax \expandafter\@gobble \fi}%
|
---|
214 | {}#4{#1}{#6}%
|
---|
215 | \lst@CArg #3\relax\lst@DefDelimE{}{}{}#5{#1}%
|
---|
216 | \fi
|
---|
217 | \fi}
|
---|
218 | \lst@EndAspect
|
---|
219 | \lst@BeginAspect{pod}
|
---|
220 | \lst@Key{printpod}{false}[t]{\lstKV@SetIf{#1}\lst@ifprintpod}
|
---|
221 | \lst@Key{podcomment}{false}[t]{\lstKV@SetIf{#1}\lst@ifpodcomment}
|
---|
222 | \lst@AddToHookExe{SetLanguage}{\let\lst@ifpodcomment\iffalse}
|
---|
223 | \lst@NewMode\lst@PODmode
|
---|
224 | \lst@AddToHook{SelectCharTable}
|
---|
225 | {\lst@ifpodcomment
|
---|
226 | \lst@CArgX =\relax\lst@DefDelimB{}{}%
|
---|
227 | {\ifnum\@tempcnta=\z@
|
---|
228 | \lst@ifprintpod\else
|
---|
229 | \def\lst@bnext{\lst@BeginDropOutput\lst@PODmode}%
|
---|
230 | \expandafter\expandafter\expandafter\@gobblethree
|
---|
231 | \fi
|
---|
232 | \else
|
---|
233 | \expandafter\@gobblethree
|
---|
234 | \fi}%
|
---|
235 | \lst@BeginComment\lst@PODmode{{\lst@commentstyle}}%
|
---|
236 | \lst@CArgX =cut\^^M\relax\lst@DefDelimE
|
---|
237 | {\lst@CalcColumn}%
|
---|
238 | {\ifnum\@tempcnta=\z@\else
|
---|
239 | \expandafter\@gobblethree
|
---|
240 | \fi}%
|
---|
241 | {}%
|
---|
242 | \lst@EndComment\lst@PODmode
|
---|
243 | \fi}
|
---|
244 | \lst@EndAspect
|
---|
245 | \lst@BeginAspect[keywords]{html}
|
---|
246 | \gdef\lst@tagtypes{s}
|
---|
247 | \gdef\lst@TagKey#1#2{%
|
---|
248 | \lst@Delim\lst@tagstyle #2\relax
|
---|
249 | {Tag}\lst@tagtypes #1%
|
---|
250 | {\lst@BeginTag\lst@EndTag}%
|
---|
251 | \@@end\@empty{}}
|
---|
252 | \lst@Key{tag}\relax{\lst@TagKey\@empty{#1}}
|
---|
253 | \lst@Key{tagstyle}{}{\def\lst@tagstyle{#1}}
|
---|
254 | \lst@AddToHook{EmptyStyle}{\let\lst@tagstyle\@empty}
|
---|
255 | \gdef\lst@BeginTag{%
|
---|
256 | \lst@DelimOpen
|
---|
257 | \lst@ifextags\else
|
---|
258 | {\let\lst@ifkeywords\iftrue
|
---|
259 | \lst@ifmarkfirstintag \lst@firstintagtrue \fi}}
|
---|
260 | \lst@AddToHookExe{ExcludeDelims}{\let\lst@ifextags\iffalse}
|
---|
261 | \gdef\lst@EndTag{\lst@DelimClose\lst@ifextags\else}
|
---|
262 | \lst@Key{usekeywordsintag}t[t]{\lstKV@SetIf{#1}\lst@ifusekeysintag}
|
---|
263 | \lst@Key{markfirstintag}f[t]{\lstKV@SetIf{#1}\lst@ifmarkfirstintag}
|
---|
264 | \gdef\lst@firstintagtrue{\global\let\lst@iffirstintag\iftrue}
|
---|
265 | \global\let\lst@iffirstintag\iffalse
|
---|
266 | \lst@AddToHook{PostOutput}{\lst@tagresetfirst}
|
---|
267 | \lst@AddToHook{Output}
|
---|
268 | {\gdef\lst@tagresetfirst{\global\let\lst@iffirstintag\iffalse}}
|
---|
269 | \lst@AddToHook{OutputOther}{\gdef\lst@tagresetfirst{}}
|
---|
270 | \lst@AddToHook{Output}
|
---|
271 | {\ifnum\lst@mode=\lst@tagmode
|
---|
272 | \lst@iffirstintag \let\lst@thestyle\lst@gkeywords@sty \fi
|
---|
273 | \lst@ifusekeysintag\else \let\lst@thestyle\lst@gkeywords@sty\fi
|
---|
274 | \fi}
|
---|
275 | \lst@NewMode\lst@tagmode
|
---|
276 | \lst@AddToHook{Init}{\global\let\lst@ifnotag\iftrue}
|
---|
277 | \lst@AddToHook{SelectCharTable}{\let\lst@ifkeywords\lst@ifnotag}
|
---|
278 | \gdef\lst@Tag@s#1#2\@empty#3#4#5{%
|
---|
279 | \global\let\lst@ifnotag\iffalse
|
---|
280 | \lst@CArg #1\relax\lst@DefDelimB {}{}%
|
---|
281 | {\ifnum\lst@mode=\lst@tagmode \expandafter\@gobblethree \fi}%
|
---|
282 | #3\lst@tagmode{#5}%
|
---|
283 | \lst@CArg #2\relax\lst@DefDelimE {}{}{}#4\lst@tagmode}%
|
---|
284 | \gdef\lst@BeginCDATA#1\@empty{%
|
---|
285 | \lst@TrackNewLines \lst@PrintToken
|
---|
286 | \lst@EnterMode\lst@GPmode{}\let\lst@ifmode\iffalse
|
---|
287 | \lst@mode\lst@tagmode #1\lst@mode\lst@GPmode\relax\lst@modetrue}
|
---|
288 | \lst@EndAspect
|
---|
289 | \lst@BeginAspect{escape}
|
---|
290 | \lst@Key{texcl}{false}[t]{\lstKV@SetIf{#1}\lst@iftexcl}
|
---|
291 | \lst@AddToHook{TextStyle}{\let\lst@iftexcl\iffalse}
|
---|
292 | \lst@AddToHook{EOL}
|
---|
293 | {\ifnum\lst@mode=\lst@TeXLmode
|
---|
294 | \expandafter\lst@escapeend
|
---|
295 | \expandafter\lst@LeaveAllModes
|
---|
296 | \expandafter\lst@ReenterModes
|
---|
297 | \fi}
|
---|
298 | \lst@AddToHook{AfterBeginComment}
|
---|
299 | {\lst@iftexcl \lst@ifLmode \lst@ifdropinput\else
|
---|
300 | \lst@PrintToken
|
---|
301 | \lst@LeaveMode \lst@InterruptModes
|
---|
302 | \lst@EnterMode{\lst@TeXLmode}{\lst@modetrue\lst@commentstyle}%
|
---|
303 | \expandafter\expandafter\expandafter\lst@escapebegin
|
---|
304 | \fi \fi \fi}
|
---|
305 | \lst@NewMode\lst@TeXLmode
|
---|
306 | \gdef\lst@ActiveCDefX#1{\lst@ActiveCDefX@#1}
|
---|
307 | \gdef\lst@ActiveCDefX@#1#2#3{
|
---|
308 | \catcode`#1\active\lccode`\~=`#1%
|
---|
309 | \lowercase{\lst@CDefIt~}{#2}{#3}{}}
|
---|
310 | \gdef\lst@Escape#1#2#3#4{%
|
---|
311 | \lst@CArgX #1\relax\lst@CDefX
|
---|
312 | {}%
|
---|
313 | {\lst@ifdropinput\else
|
---|
314 | \lst@TrackNewLines\lst@OutputLostSpace \lst@XPrintToken
|
---|
315 | \lst@InterruptModes
|
---|
316 | \lst@EnterMode{\lst@TeXmode}{\lst@modetrue}%
|
---|
317 | \ifx\^^M#2%
|
---|
318 | \lst@CArg #2\relax\lst@ActiveCDefX
|
---|
319 | {}%
|
---|
320 | {\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes}%
|
---|
321 | {\lst@MProcessListing}%
|
---|
322 | \else
|
---|
323 | \lst@CArg #2\relax\lst@ActiveCDefX
|
---|
324 | {}%
|
---|
325 | {\lst@escapeend #4\lst@LeaveAllModes\lst@ReenterModes
|
---|
326 | \lst@newlines\z@ \lst@whitespacefalse}%
|
---|
327 | {}%
|
---|
328 | \fi
|
---|
329 | #3\lst@escapebegin
|
---|
330 | \fi}%
|
---|
331 | {}}
|
---|
332 | \lst@NewMode\lst@TeXmode
|
---|
333 | \lst@Key{escapebegin}{}{\def\lst@escapebegin{#1}}
|
---|
334 | \lst@Key{escapeend}{}{\def\lst@escapeend{#1}}
|
---|
335 | \lst@Key{escapechar}{}
|
---|
336 | {\ifx\@empty#1\@empty
|
---|
337 | \let\lst@DefEsc\relax
|
---|
338 | \else
|
---|
339 | \def\lst@DefEsc{\lst@Escape{#1}{#1}{}{}}%
|
---|
340 | \fi}
|
---|
341 | \lst@AddToHook{TextStyle}{\let\lst@DefEsc\@empty}
|
---|
342 | \lst@AddToHook{SelectCharTable}{\lst@DefEsc}
|
---|
343 | \lst@Key{escapeinside}{}{\lstKV@TwoArg{#1}%
|
---|
344 | {\let\lst@DefEsc\@empty
|
---|
345 | \ifx\@empty##1@empty\else \ifx\@empty##2\@empty\else
|
---|
346 | \def\lst@DefEsc{\lst@Escape{##1}{##2}{}{}}%
|
---|
347 | \fi\fi}}
|
---|
348 | \lst@Key{mathescape}{false}[t]{\lstKV@SetIf{#1}\lst@ifmathescape}
|
---|
349 | \lst@AddToHook{SelectCharTable}
|
---|
350 | {\lst@ifmathescape \lst@Escape{\$}{\$}%
|
---|
351 | {\setbox\@tempboxa=\hbox\bgroup$}%
|
---|
352 | {$\egroup \lst@CalcLostSpaceAndOutput}\fi}
|
---|
353 | \lst@EndAspect
|
---|
354 | \lst@BeginAspect{keywords}
|
---|
355 | \global\let\lst@ifsensitive\iftrue % init
|
---|
356 | \global\let\lst@ifsensitivedefed\iffalse % init % \global
|
---|
357 | \lst@ifsavemem\else
|
---|
358 | \gdef\lst@KeywordTest#1#2#3{%
|
---|
359 | \begingroup \let\lst@UM\@empty
|
---|
360 | \global\expandafter\let\expandafter\@gtempa
|
---|
361 | \csname\@lst#1@\the\lst@token\endcsname
|
---|
362 | \endgroup
|
---|
363 | \ifx\@gtempa\relax\else
|
---|
364 | \let\lst@thestyle\@gtempa
|
---|
365 | \fi}
|
---|
366 | \gdef\lst@KEYWORDTEST{%
|
---|
367 | \uppercase\expandafter{\expandafter
|
---|
368 | \lst@KEYWORDTEST@\the\lst@token}\relax}
|
---|
369 | \gdef\lst@KEYWORDTEST@#1\relax#2#3#4{%
|
---|
370 | \begingroup \let\lst@UM\@empty
|
---|
371 | \global\expandafter\let\expandafter\@gtempa
|
---|
372 | \csname\@lst#2@#1\endcsname
|
---|
373 | \endgroup
|
---|
374 | \ifx\@gtempa\relax\else
|
---|
375 | \let\lst@thestyle\@gtempa
|
---|
376 | \fi}
|
---|
377 | \gdef\lst@WorkingTest#1#2#3{%
|
---|
378 | \begingroup \let\lst@UM\@empty
|
---|
379 | \global\expandafter\let\expandafter\@gtempa
|
---|
380 | \csname\@lst#1@\the\lst@token\endcsname
|
---|
381 | \endgroup
|
---|
382 | \@gtempa}
|
---|
383 | \gdef\lst@WORKINGTEST{%
|
---|
384 | \uppercase\expandafter{\expandafter
|
---|
385 | \lst@WORKINGTEST@\the\lst@token}\relax}
|
---|
386 | \gdef\lst@WORKINGTEST@#1\relax#2#3#4{%
|
---|
387 | \begingroup \let\lst@UM\@empty
|
---|
388 | \global\expandafter\let\expandafter\@gtempa
|
---|
389 | \csname\@lst#2@#1\endcsname
|
---|
390 | \endgroup
|
---|
391 | \@gtempa}
|
---|
392 | \gdef\lst@DefineKeywords#1#2#3{%
|
---|
393 | \lst@ifsensitive
|
---|
394 | \def\lst@next{\lst@for#2}%
|
---|
395 | \else
|
---|
396 | \def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}%
|
---|
397 | \fi
|
---|
398 | \lst@next\do
|
---|
399 | {\expandafter\ifx\csname\@lst#1@##1\endcsname\relax
|
---|
400 | \global\expandafter\let\csname\@lst#1@##1\endcsname#3%
|
---|
401 | \fi}}
|
---|
402 | \gdef\lst@UndefineKeywords#1#2#3{%
|
---|
403 | \lst@ifsensitivedefed
|
---|
404 | \def\lst@next{\lst@for#2}%
|
---|
405 | \else
|
---|
406 | \def\lst@next{\uppercase\expandafter{\expandafter\lst@for#2}}%
|
---|
407 | \fi
|
---|
408 | \lst@next\do
|
---|
409 | {\expandafter\ifx\csname\@lst#1@##1\endcsname#3%
|
---|
410 | \global\expandafter\let\csname\@lst#1@##1\endcsname\relax
|
---|
411 | \fi}}
|
---|
412 | \fi
|
---|
413 | \lst@ifsavemem
|
---|
414 | \gdef\lst@IfOneOutOf#1\relax#2{%
|
---|
415 | \def\lst@temp##1,#1,##2##3\relax{%
|
---|
416 | \ifx\@empty##2\else \expandafter\lst@IOOOfirst \fi}%
|
---|
417 | \def\lst@next{\lst@IfOneOutOf@#1\relax}%
|
---|
418 | \expandafter\lst@next#2\relax\relax}
|
---|
419 | \gdef\lst@IfOneOutOf@#1\relax#2#3{%
|
---|
420 | \ifx#2\relax
|
---|
421 | \expandafter\@secondoftwo
|
---|
422 | \else
|
---|
423 | \expandafter\lst@temp\expandafter,#2,#1,\@empty\relax
|
---|
424 | \expandafter\lst@next
|
---|
425 | \fi}
|
---|
426 | \ifx\iffalse\else\fi
|
---|
427 | \gdef\lst@IOOOfirst#1\relax#2#3{\fi#2}
|
---|
428 | \gdef\lst@IFONEOUTOF#1\relax#2{%
|
---|
429 | \uppercase{\def\lst@temp##1,#1},##2##3\relax{%
|
---|
430 | \ifx\@empty##2\else \expandafter\lst@IOOOfirst \fi}%
|
---|
431 | \def\lst@next{\lst@IFONEOUTOF@#1\relax}%
|
---|
432 | \expandafter\lst@next#2\relax}
|
---|
433 | \gdef\lst@IFONEOUTOF@#1\relax#2#3{%
|
---|
434 | \ifx#2\relax
|
---|
435 | \expandafter\@secondoftwo
|
---|
436 | \else
|
---|
437 | \uppercase
|
---|
438 | {\expandafter\lst@temp\expandafter,#2,#1,\@empty\relax}%
|
---|
439 | \expandafter\lst@next
|
---|
440 | \fi}
|
---|
441 | \gdef\lst@KWTest{%
|
---|
442 | \begingroup \let\lst@UM\@empty
|
---|
443 | \expandafter\xdef\expandafter\@gtempa\expandafter{\the\lst@token}%
|
---|
444 | \endgroup
|
---|
445 | \expandafter\lst@IfOneOutOf\@gtempa\relax}
|
---|
446 | \gdef\lst@KeywordTest#1#2#3{\lst@KWTest #2{\let\lst@thestyle#3}{}}
|
---|
447 | \global\let\lst@KEYWORDTEST\lst@KeywordTest
|
---|
448 | \gdef\lst@WorkingTest#1#2#3{\lst@KWTest #2#3{}}
|
---|
449 | \global\let\lst@WORKINGTEST\lst@WorkingTest
|
---|
450 | \fi
|
---|
451 | \lst@Key{sensitive}\relax[t]{\lstKV@SetIf{#1}\lst@ifsensitive}
|
---|
452 | \lst@AddToHook{SetLanguage}{\let\lst@ifsensitive\iftrue}
|
---|
453 | \lst@AddToHook{Init}
|
---|
454 | {\lst@ifsensitive\else
|
---|
455 | \let\lst@KeywordTest\lst@KEYWORDTEST
|
---|
456 | \let\lst@WorkingTest\lst@WORKINGTEST
|
---|
457 | \let\lst@IfOneOutOf\lst@IFONEOUTOF
|
---|
458 | \fi}
|
---|
459 | \gdef\lst@MakeMacroUppercase#1{%
|
---|
460 | \ifx\@undefined#1\else \uppercase\expandafter
|
---|
461 | {\expandafter\def\expandafter#1\expandafter{#1}}%
|
---|
462 | \fi}
|
---|
463 | \gdef\lst@InstallTest#1#2#3#4#5#6#7#8{%
|
---|
464 | \lst@AddToHook{TrackKeywords}{\lst@TrackKeywords{#1}#2#4#6#7#8}%
|
---|
465 | \lst@AddToHook{PostTrackKeywords}{\lst@PostTrackKeywords#2#3#4#5}}
|
---|
466 | \lst@AddToHook{Init}{\lsthk@TrackKeywords\lsthk@PostTrackKeywords}
|
---|
467 | \lst@AddToHook{TrackKeywords}
|
---|
468 | {\global\let\lst@DoDefineKeywords\@empty}% init
|
---|
469 | \lst@AddToHook{PostTrackKeywords}
|
---|
470 | {\lst@DoDefineKeywords
|
---|
471 | \global\let\lst@DoDefineKeywords\@empty}% init
|
---|
472 | \lst@AddToHook{Output}{\lst@ifkeywords \lsthk@DetectKeywords \fi}
|
---|
473 | \lst@AddToHook{DetectKeywords}{}% init
|
---|
474 | \lst@AddToHook{ModeTrue}{\let\lst@ifkeywords\iffalse}
|
---|
475 | \lst@AddToHookExe{Init}{\let\lst@ifkeywords\iftrue}
|
---|
476 | \gdef\lst@InstallTestNow#1#2#3#4#5{%
|
---|
477 | \@ifundefined{\string#2#1}%
|
---|
478 | {\global\@namedef{\string#2#1}{}%
|
---|
479 | \edef\@tempa{%
|
---|
480 | \noexpand\lst@AddToHook{\ifx#5dDetectKeywords\else Output\fi}%
|
---|
481 | {\ifx #4w\noexpand\lst@WorkingTest
|
---|
482 | \else\noexpand\lst@KeywordTest \fi
|
---|
483 | {#1}\noexpand#2\noexpand#3}}%
|
---|
484 | \lst@ifsavemem
|
---|
485 | \@tempa
|
---|
486 | \else
|
---|
487 | \@ifundefined{\@lst#1@if@ins}%
|
---|
488 | {\@tempa \global\@namedef{\@lst#1@if@ins}{}}%
|
---|
489 | {}%
|
---|
490 | \fi}
|
---|
491 | {}}
|
---|
492 | \gdef\lst@TrackKeywords#1#2#3#4#5#6{%
|
---|
493 | \lst@false
|
---|
494 | \def\lst@arg{{#1}#4}%
|
---|
495 | \expandafter\expandafter\expandafter\lst@TK@
|
---|
496 | \expandafter\lst@arg#2\relax\relax
|
---|
497 | \lst@ifsavemem\else
|
---|
498 | \def\lst@arg{{#1}#4#2}%
|
---|
499 | \expandafter\expandafter\expandafter\lst@TK@@
|
---|
500 | \expandafter\lst@arg#3\relax\relax
|
---|
501 | \fi
|
---|
502 | \lst@if \lst@InstallTestNow{#1}#2#4#5#6\fi}
|
---|
503 | \gdef\lst@TK@#1#2#3#4{%
|
---|
504 | \ifx\lst@ifsensitive\lst@ifsensitivedefed
|
---|
505 | \ifx#3#4\else
|
---|
506 | \lst@true
|
---|
507 | \lst@ifsavemem\else
|
---|
508 | \lst@UndefineKeywords{#1}#4#2%
|
---|
509 | \lst@AddTo\lst@DoDefineKeywords{\lst@DefineKeywords{#1}#3#2}%
|
---|
510 | \fi
|
---|
511 | \fi
|
---|
512 | \else
|
---|
513 | \ifx#3\relax\else
|
---|
514 | \lst@true
|
---|
515 | \lst@ifsavemem\else
|
---|
516 | \lst@UndefineKeywords{#1}#4#2%
|
---|
517 | \lst@AddTo\lst@DoDefineKeywords{\lst@DefineKeywords{#1}#3#2}%
|
---|
518 | \fi
|
---|
519 | \fi
|
---|
520 | \fi
|
---|
521 | \lst@ifsavemem \ifx#3\relax\else
|
---|
522 | \lst@ifsensitive\else \lst@MakeMacroUppercase#3\fi
|
---|
523 | \fi \fi
|
---|
524 | \ifx#3\relax
|
---|
525 | \expandafter\@gobblethree
|
---|
526 | \fi
|
---|
527 | \lst@TK@{#1}#2}
|
---|
528 | \gdef\lst@TK@@#1#2#3#4#5{%
|
---|
529 | \ifx#4\relax
|
---|
530 | \expandafter\@gobblefour
|
---|
531 | \else
|
---|
532 | \lst@IfSubstring{#4#5}#3{}{\lst@UndefineKeywords{#1}#5#2}%
|
---|
533 | \fi
|
---|
534 | \lst@TK@@{#1}#2#3}
|
---|
535 | \lst@AddToHook{InitVars}
|
---|
536 | {\global\let\lst@ifsensitivedefed\lst@ifsensitive}
|
---|
537 | \gdef\lst@PostTrackKeywords#1#2#3#4{%
|
---|
538 | \lst@ifsavemem\else
|
---|
539 | \global\let#3#1%
|
---|
540 | \global\let#4#2%
|
---|
541 | \fi}
|
---|
542 | \lst@Key{classoffset}\z@{\def\lst@classoffset{#1}}
|
---|
543 | \gdef\lst@InstallFamily#1#2#3#4#5{%
|
---|
544 | \lst@Key{#2}\relax{\lst@UseFamily{#2}##1\relax\lst@MakeKeywords}%
|
---|
545 | \lst@Key{more#2}\relax
|
---|
546 | {\lst@UseFamily{#2}##1\relax\lst@MakeMoreKeywords}%
|
---|
547 | \lst@Key{delete#2}\relax
|
---|
548 | {\lst@UseFamily{#2}##1\relax\lst@DeleteKeywords}%
|
---|
549 | \ifx\@empty#3\@empty\else
|
---|
550 | \lst@Key{#3}{#4}{\lstKV@OptArg[\@ne]{##1}%
|
---|
551 | {\@tempcnta\lst@classoffset \advance\@tempcnta####1\relax
|
---|
552 | \@namedef{lst@#3\ifnum\@tempcnta=\@ne\else \the\@tempcnta
|
---|
553 | \fi}{####2}}}%
|
---|
554 | \fi
|
---|
555 | \expandafter\lst@InstallFamily@
|
---|
556 | \csname\@lst @#2@data\expandafter\endcsname
|
---|
557 | \csname\@lst @#5\endcsname {#1}{#2}{#3}}
|
---|
558 | \gdef\lst@InstallFamily@#1#2#3#4#5#6#7#8{%
|
---|
559 | \gdef#1{{#3}{#4}{#5}#2#7}%
|
---|
560 | \long\def\lst@temp##1{#6}%
|
---|
561 | \ifx\lst@temp\@gobble
|
---|
562 | \lst@AddTo#1{s#8}%
|
---|
563 | \else
|
---|
564 | \lst@AddTo#1{w#8}%
|
---|
565 | \global\@namedef{lst@g#4@wp}##1{#6}%
|
---|
566 | \fi}
|
---|
567 | \gdef\lst@UseFamily#1{%
|
---|
568 | \def\lst@family{#1}%
|
---|
569 | \@ifnextchar[\lst@UseFamily@{\lst@UseFamily@[\@ne]}}
|
---|
570 | \gdef\lst@UseFamily@[#1]{%
|
---|
571 | \@tempcnta\lst@classoffset \advance\@tempcnta#1\relax
|
---|
572 | \lst@ProvideFamily\lst@family
|
---|
573 | \lst@UseFamily@a
|
---|
574 | {\lst@family\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}
|
---|
575 | \gdef\lst@UseFamily@a#1{%
|
---|
576 | \expandafter\lst@UseFamily@b
|
---|
577 | \csname\@lst @#1@list\expandafter\endcsname
|
---|
578 | \csname\@lst @#1\expandafter\endcsname
|
---|
579 | \csname\@lst @#1@also\expandafter\endcsname
|
---|
580 | \csname\@lst @g#1\endcsname}
|
---|
581 | \gdef\lst@UseFamily@b#1#2#3#4#5\relax#6{\lstKV@XOptArg[]{#5}#6#1#2#3#4}
|
---|
582 | \gdef\lst@ProvideFamily#1{%
|
---|
583 | \@ifundefined{lstfam@#1\ifnum\@tempcnta=\@ne\else\the\@tempcnta\fi}%
|
---|
584 | {\global\@namedef{lstfam@#1\ifnum\@tempcnta=\@ne\else
|
---|
585 | \the\@tempcnta\fi}{}%
|
---|
586 | \expandafter\expandafter\expandafter\lst@ProvideFamily@
|
---|
587 | \csname\@lst @#1@data\endcsname
|
---|
588 | {\ifnum\@tempcnta=\@ne\else \the\@tempcnta \fi}}%
|
---|
589 | {}}%
|
---|
590 | \gdef\lst@ProvideFamily@#1#2#3#4#5#6#7#8{%
|
---|
591 | \expandafter\xdef\csname\@lst @g#2#8@sty\endcsname
|
---|
592 | {\if #6w%
|
---|
593 | \expandafter\noexpand\csname\@lst @g#2@wp\endcsname{#8}%
|
---|
594 | \else
|
---|
595 | \expandafter\noexpand\csname\@lst @#3#8\endcsname
|
---|
596 | \fi}%
|
---|
597 | \ifx\@empty#3\@empty\else
|
---|
598 | \edef\lst@temp{\noexpand\lst@AddToHook{Init}{%
|
---|
599 | \noexpand\lst@ProvideStyle\expandafter\noexpand
|
---|
600 | \csname\@lst @#3#8\endcsname\noexpand#4}}%
|
---|
601 | \lst@temp
|
---|
602 | \fi
|
---|
603 | \expandafter\lst@ProvideFamily@@
|
---|
604 | \csname\@lst @#2#8@list\expandafter\endcsname
|
---|
605 | \csname\@lst @#2#8\expandafter\endcsname
|
---|
606 | \csname\@lst @#2#8@also\expandafter\endcsname
|
---|
607 | \csname\@lst @g#2#8@list\expandafter\endcsname
|
---|
608 | \csname\@lst @g#2#8\expandafter\endcsname
|
---|
609 | \csname\@lst @g#2#8@sty\expandafter\endcsname
|
---|
610 | {#1}#5#6#7}
|
---|
611 | \gdef\lst@ProvideFamily@@#1#2#3#4#5#6#7#8{%
|
---|
612 | \gdef#1{#2#5}\global\let#2\@empty \global\let#3\@empty % init
|
---|
613 | \gdef#4{#2#5}\global\let#5\@empty % init
|
---|
614 | \if #8l\relax
|
---|
615 | \lst@AddToHook{SetLanguage}{\def#1{#2#5}\let#2\@empty}%
|
---|
616 | \fi
|
---|
617 | \lst@InstallTest{#7}#1#2#4#5#6}
|
---|
618 | \gdef\lst@InstallKeywords#1#2#3#4#5{%
|
---|
619 | \lst@Key{#2}\relax
|
---|
620 | {\lst@UseFamily{#2}[\@ne]##1\relax\lst@MakeKeywords}%
|
---|
621 | \lst@Key{more#2}\relax
|
---|
622 | {\lst@UseFamily{#2}[\@ne]##1\relax\lst@MakeMoreKeywords}%
|
---|
623 | \lst@Key{delete#2}\relax
|
---|
624 | {\lst@UseFamily{#2}[\@ne]##1\relax\lst@DeleteKeywords}%
|
---|
625 | \ifx\@empty#3\@empty\else
|
---|
626 | \lst@Key{#3}{#4}{\@namedef{lst@#3}{##1}}%
|
---|
627 | \fi
|
---|
628 | \expandafter\lst@InstallFamily@
|
---|
629 | \csname\@lst @#2@data\expandafter\endcsname
|
---|
630 | \csname\@lst @#5\endcsname {#1}{#2}{#3}}
|
---|
631 | \gdef\lst@ProvideStyle#1#2{%
|
---|
632 | \ifx#1\@undefined \let#1#2%
|
---|
633 | \else\ifx#1\relax \let#1#2\fi\fi}
|
---|
634 | \gdef\lst@BuildClassList#1#2,{%
|
---|
635 | \ifx\relax#2\@empty\else
|
---|
636 | \ifx\@empty#2\@empty\else
|
---|
637 | \lst@lExtend#1{\csname\@lst @#2\expandafter\endcsname
|
---|
638 | \csname\@lst @g#2\endcsname}%
|
---|
639 | \fi
|
---|
640 | \expandafter\lst@BuildClassList\expandafter#1
|
---|
641 | \fi}
|
---|
642 | \gdef\lst@DeleteClassesIn#1#2{%
|
---|
643 | \expandafter\lst@DCI@\expandafter#1#2\relax\relax}
|
---|
644 | \gdef\lst@DCI@#1#2#3{%
|
---|
645 | \ifx#2\relax
|
---|
646 | \expandafter\@gobbletwo
|
---|
647 | \else
|
---|
648 | \def\lst@temp##1#2#3##2{%
|
---|
649 | \lst@lAddTo#1{##1}%
|
---|
650 | \ifx ##2\relax\else
|
---|
651 | \expandafter\lst@temp
|
---|
652 | \fi ##2}%
|
---|
653 | \let\@tempa#1\let#1\@empty
|
---|
654 | \expandafter\lst@temp\@tempa#2#3\relax
|
---|
655 | \fi
|
---|
656 | \lst@DCI@#1}
|
---|
657 | \gdef\lst@MakeKeywords[#1]#2#3#4#5#6{%
|
---|
658 | \def#3{#4#6}\let#4\@empty \let#5\@empty
|
---|
659 | \lst@MakeMoreKeywords[#1]{#2}#3#4#5#6}
|
---|
660 | \gdef\lst@MakeMoreKeywords[#1]#2#3#4#5#6{%
|
---|
661 | \lst@BuildClassList#3#1,\relax,%
|
---|
662 | \lst@DefOther\lst@temp{,#2}\lst@lExtend#4\lst@temp}
|
---|
663 | \gdef\lst@DeleteKeywords[#1]#2#3#4#5#6{%
|
---|
664 | \lst@MakeKeywords[#1]{#2}\@tempa\@tempb#5#6%
|
---|
665 | \lst@DeleteClassesIn#3\@tempa
|
---|
666 | \lst@DeleteKeysIn#4\@tempb}
|
---|
667 | \lst@InstallFamily k{keywords}{keywordstyle}\bfseries{keywordstyle}{}ld
|
---|
668 | \gdef\lst@DefKeywordstyle#1#2\@nil@{%
|
---|
669 | \@namedef{lst@keywordstyle\ifnum\@tempcnta=\@ne\else\the\@tempcnta
|
---|
670 | \fi}{#1#2}}%
|
---|
671 | \lst@Key{keywordstyle}{\bfseries}{\lstKV@OptArg[\@ne]{#1}%
|
---|
672 | {\@tempcnta\lst@classoffset \advance\@tempcnta##1\relax
|
---|
673 | \@ifstar{\lst@DefKeywordstyle{\uppercase\expandafter{%
|
---|
674 | \expandafter\lst@token
|
---|
675 | \expandafter{\the\lst@token}}}}%
|
---|
676 | {\lst@DefKeywordstyle{}}##2\@nil@}}
|
---|
677 | \lst@Key{ndkeywords}\relax
|
---|
678 | {\lst@UseFamily{keywords}[\tw@]#1\relax\lst@MakeKeywords}%
|
---|
679 | \lst@Key{morendkeywords}\relax
|
---|
680 | {\lst@UseFamily{keywords}[\tw@]#1\relax\lst@MakeMoreKeywords}%
|
---|
681 | \lst@Key{deletendkeywords}\relax
|
---|
682 | {\lst@UseFamily{keywords}[\tw@]#1\relax\lst@DeleteKeywords}%
|
---|
683 | \lst@Key{ndkeywordstyle}\relax{\@namedef{lst@keywordstyle2}{#1}}%
|
---|
684 | \lst@Key{keywordsprefix}\relax{\lst@DefActive\lst@keywordsprefix{#1}}
|
---|
685 | \global\let\lst@keywordsprefix\@empty
|
---|
686 | \lst@AddToHook{SelectCharTable}
|
---|
687 | {\ifx\lst@keywordsprefix\@empty\else
|
---|
688 | \expandafter\lst@CArg\lst@keywordsprefix\relax
|
---|
689 | \lst@CDef{}%
|
---|
690 | {\lst@ifletter\else
|
---|
691 | \global\let\lst@prefixkeyword\@empty
|
---|
692 | \fi}%
|
---|
693 | {}%
|
---|
694 | \fi}
|
---|
695 | \lst@AddToHook{Init}{\global\let\lst@prefixkeyword\relax}
|
---|
696 | \lst@AddToHook{Output}
|
---|
697 | {\ifx\lst@prefixkeyword\@empty
|
---|
698 | \let\lst@thestyle\lst@gkeywords@sty
|
---|
699 | \global\let\lst@prefixkeyword\relax
|
---|
700 | \fi}%
|
---|
701 | \lst@Key{otherkeywords}{}{%
|
---|
702 | \let\lst@otherkeywords\@empty
|
---|
703 | \lst@for{#1}\do{%
|
---|
704 | \lst@MakeActive{##1}%
|
---|
705 | \lst@lExtend\lst@otherkeywords{%
|
---|
706 | \expandafter\lst@CArg\lst@temp\relax\lst@CDef
|
---|
707 | {}\lst@PrintOtherKeyword\@empty}}}
|
---|
708 | \lst@AddToHook{SelectCharTable}{\lst@otherkeywords}
|
---|
709 | \gdef\lst@PrintOtherKeyword#1\@empty{%
|
---|
710 | \lst@XPrintToken
|
---|
711 | \begingroup
|
---|
712 | \lst@modetrue \lsthk@TextStyle
|
---|
713 | \let\lst@ProcessDigit\lst@ProcessLetter
|
---|
714 | \let\lst@ProcessOther\lst@ProcessLetter
|
---|
715 | \lst@lettertrue
|
---|
716 | #1%
|
---|
717 | \lst@SaveToken
|
---|
718 | \endgroup
|
---|
719 | \lst@RestoreToken
|
---|
720 | \global\let\lst@savedcurrstyle\lst@currstyle
|
---|
721 | \let\lst@currstyle\lst@gkeywords@sty
|
---|
722 | \lst@Output
|
---|
723 | \let\lst@currstyle\lst@savedcurrstyle}
|
---|
724 | \lst@EndAspect
|
---|
725 | \lst@BeginAspect[keywords]{emph}
|
---|
726 | \lst@InstallFamily e{emph}{emphstyle}{}{emphstyle}{}od
|
---|
727 | \lst@EndAspect
|
---|
728 | \lst@BeginAspect[keywords]{tex}
|
---|
729 | \lst@InstallFamily {cs}{texcs}{texcsstyle}\relax{keywordstyle}
|
---|
730 | {\ifx\lst@lastother\lstum@backslash
|
---|
731 | \expandafter\let\expandafter\lst@thestyle
|
---|
732 | \csname lst@texcsstyle#1\endcsname
|
---|
733 | \fi}
|
---|
734 | ld
|
---|
735 | \lst@Key{texcsstyle}\relax
|
---|
736 | {\@ifstar{\lst@true\lst@DefTexcsstyle}%
|
---|
737 | {\lst@false\lst@DefTexcsstyle}#1\@nil@}
|
---|
738 | \gdef\lst@DefTexcsstyle#1\@nil@{%
|
---|
739 | \let\lst@iftexcsincludebs\lst@if
|
---|
740 | \lstKV@OptArg[\@ne]{#1}%
|
---|
741 | {\@tempcnta\lst@classoffset \advance\@tempcnta##1\relax
|
---|
742 | \@namedef{lst@texcsstyle\ifnum\@tempcnta=\@ne\else
|
---|
743 | \the\@tempcnta \fi}{##2}}}%
|
---|
744 | \global\let\lst@iftexcsincludebs\iffalse
|
---|
745 | \let\lst@iftexcsincludebs\iffalse
|
---|
746 | \lst@AddToHook{SelectCharTable}
|
---|
747 | {\lst@iftexcsincludebs \ifx\@empty\lst@texcs\else
|
---|
748 | \lst@DefSaveDef{`\\}\lsts@texcsbs
|
---|
749 | {\lst@ifletter
|
---|
750 | \lst@Output
|
---|
751 | \else
|
---|
752 | \lst@OutputOther
|
---|
753 | \fi
|
---|
754 | \lst@Merge\lsts@texcsbs}%
|
---|
755 | \fi \fi}
|
---|
756 | \lst@EndAspect
|
---|
757 | \lst@BeginAspect[keywords]{directives}
|
---|
758 | \lst@NewMode\lst@CDmode
|
---|
759 | \lst@AddToHook{EOL}{\ifnum\lst@mode=\lst@CDmode \lst@LeaveMode \fi}
|
---|
760 | \lst@InstallKeywords{d}{directives}{directivestyle}\relax{keywordstyle}
|
---|
761 | {\ifnum\lst@mode=\lst@CDmode
|
---|
762 | \let\lst@thestyle\lst@directivestyle
|
---|
763 | \fi}
|
---|
764 | ld
|
---|
765 | \global\let\lst@directives\@empty % init
|
---|
766 | \lst@AddTo\lst@delimtypes{,directive}
|
---|
767 | \gdef\lst@Delim@directive#1\@empty#2#3#4{%
|
---|
768 | \lst@CArg #1\relax\lst@DefDelimB
|
---|
769 | {\lst@CalcColumn}%
|
---|
770 | {}%
|
---|
771 | {\ifnum\@tempcnta=\z@
|
---|
772 | \def\lst@bnext{#2\lst@CDmode{#4\lst@Lmodetrue}%
|
---|
773 | \let\lst@currstyle\lst@directivestyle}%
|
---|
774 | \fi
|
---|
775 | \@gobblethree}%
|
---|
776 | #2\lst@CDmode{#4\lst@Lmodetrue}}
|
---|
777 | \lst@AddTo\lst@stringtypes{,directive}
|
---|
778 | \gdef\lst@StringDM@directive#1#2#3\@empty{%
|
---|
779 | \lst@CArg #2\relax\lst@CDef
|
---|
780 | {}%
|
---|
781 | {\let\lst@bnext\lst@CArgEmpty
|
---|
782 | \ifnum\lst@mode=\lst@CDmode
|
---|
783 | \def\lst@bnext{\lst@BeginString{#1}}%
|
---|
784 | \fi
|
---|
785 | \lst@bnext}%
|
---|
786 | \@empty
|
---|
787 | \lst@CArg #3\relax\lst@CDef
|
---|
788 | {}%
|
---|
789 | {\let\lst@enext\lst@CArgEmpty
|
---|
790 | \ifnum #1=\lst@mode
|
---|
791 | \let\lst@bnext\lst@EndString
|
---|
792 | \fi
|
---|
793 | \lst@bnext}%
|
---|
794 | \@empty}
|
---|
795 | \lst@EndAspect
|
---|
796 | \lst@BeginAspect[keywords,comments]{keywordcomments}
|
---|
797 | \lst@NewMode\lst@KCmode \lst@NewMode\lst@KCSmode
|
---|
798 | \gdef\lst@BeginKC{\aftergroup\aftergroup\aftergroup\lst@BeginKC@}%
|
---|
799 | \gdef\lst@BeginKC@{%
|
---|
800 | \lst@ResetToken
|
---|
801 | \lst@BeginComment\lst@KCmode{{\lst@commentstyle}\lst@modetrue}%
|
---|
802 | \@empty}%
|
---|
803 | \gdef\lst@BeginKCS{\aftergroup\aftergroup\aftergroup\lst@BeginKCS@}%
|
---|
804 | \gdef\lst@BeginKCS@{%
|
---|
805 | \lst@ResetToken
|
---|
806 | \lst@BeginComment\lst@KCSmode{{\lst@commentstyle}\lst@modetrue}%
|
---|
807 | \@empty}%
|
---|
808 | \lst@AddToHook{PostOutput}{\lst@KCpost \global\let\lst@KCpost\@empty}
|
---|
809 | \global\let\lst@KCpost\@empty % init
|
---|
810 | \gdef\lst@EndKC{\lst@SaveToken \lst@LeaveMode \lst@RestoreToken
|
---|
811 | \let\lst@thestyle\lst@identifierstyle \lsthk@Output}
|
---|
812 | \lst@InstallKeywords{kc}{keywordcomment}{}\relax{}
|
---|
813 | {\ifnum\lst@mode=\lst@KCmode
|
---|
814 | \edef\lst@temp{\the\lst@token}%
|
---|
815 | \ifx\lst@temp\lst@KCmatch
|
---|
816 | \lst@EndKC
|
---|
817 | \fi
|
---|
818 | \else
|
---|
819 | \lst@ifmode\else
|
---|
820 | \xdef\lst@KCmatch{\the\lst@token}%
|
---|
821 | \global\let\lst@KCpost\lst@BeginKC
|
---|
822 | \fi
|
---|
823 | \fi}
|
---|
824 | lo
|
---|
825 | \lst@Key{keywordcommentsemicolon}{}{\lstKV@ThreeArg{#1}%
|
---|
826 | {\def\lst@KCAkeywordsB{##1}%
|
---|
827 | \def\lst@KCAkeywordsE{##2}%
|
---|
828 | \def\lst@KCBkeywordsB{##3}%
|
---|
829 | \def\lst@KCkeywords{##1##2##3}}}
|
---|
830 | \lst@AddToHook{SetLanguage}{%
|
---|
831 | \let\lst@KCAkeywordsB\@empty \let\lst@KCAkeywordsE\@empty
|
---|
832 | \let\lst@KCBkeywordsB\@empty \let\lst@KCkeywords\@empty}
|
---|
833 | \lst@AddToHook{SelectCharTable}
|
---|
834 | {\ifx\lst@KCkeywords\@empty\else
|
---|
835 | \lst@DefSaveDef{`\;}\lsts@EKC
|
---|
836 | {\lst@XPrintToken
|
---|
837 | \ifnum\lst@mode=\lst@KCmode \lst@EndComment\@empty \else
|
---|
838 | \ifnum\lst@mode=\lst@KCSmode \lst@EndComment\@empty
|
---|
839 | \fi \fi
|
---|
840 | \lsts@EKC}%
|
---|
841 | \fi}
|
---|
842 | \gdef\lst@KCAWorkB{%
|
---|
843 | \lst@ifmode\else \global\let\lst@KCpost\lst@BeginKC \fi}
|
---|
844 | \gdef\lst@KCBWorkB{%
|
---|
845 | \lst@ifmode\else \global\let\lst@KCpost\lst@BeginKCS \fi}
|
---|
846 | \gdef\lst@KCAWorkE{\ifnum\lst@mode=\lst@KCmode \lst@EndKC \fi}
|
---|
847 | \lst@ProvideFamily@@
|
---|
848 | \lst@KCAkeywordsB@list\lst@KCAkeywordsB \lst@KC@also
|
---|
849 | \lst@gKCAkeywordsB@list\lst@gKCAkeywordsB \lst@KCAWorkB
|
---|
850 | {kcb}owo % prefix, other key, working procedure, Output hook
|
---|
851 | \lst@ProvideFamily@@
|
---|
852 | \lst@KCAkeywordsE@list\lst@KCAkeywordsE \lst@KC@also
|
---|
853 | \lst@gKCAkeywordsE@list\lst@gKCAkeywordsE \lst@KCAWorkE
|
---|
854 | {kce}owo
|
---|
855 | \lst@ProvideFamily@@
|
---|
856 | \lst@KCBkeywordsB@list\lst@KCBkeywordsB \lst@KC@also
|
---|
857 | \lst@gKCBkeywordsB@list\lst@gKCBkeywordsB \lst@KCBWorkB
|
---|
858 | {kcs}owo
|
---|
859 | \lst@EndAspect
|
---|
860 | \lst@BeginAspect[keywords]{index}
|
---|
861 | \lst@InstallFamily w{index}{indexstyle}\lstindexmacro{indexstyle}
|
---|
862 | {\csname\@lst @indexstyle#1\expandafter\endcsname
|
---|
863 | \expandafter{\the\lst@token}}
|
---|
864 | od
|
---|
865 | \lst@UserCommand\lstindexmacro#1{\index{{\ttfamily#1}}}
|
---|
866 | \lst@EndAspect
|
---|
867 | \lst@BeginAspect[keywords]{procnames}
|
---|
868 | \gdef\lst@procnametrue{\global\let\lst@ifprocname\iftrue}
|
---|
869 | \gdef\lst@procnamefalse{\global\let\lst@ifprocname\iffalse}
|
---|
870 | \lst@AddToHook{Init}{\lst@procnamefalse}
|
---|
871 | \lst@AddToHook{DetectKeywords}
|
---|
872 | {\lst@ifprocname
|
---|
873 | \let\lst@thestyle\lst@procnamestyle
|
---|
874 | \lst@ifindexproc \csname\@lst @gindex@sty\endcsname \fi
|
---|
875 | \lst@procnamefalse
|
---|
876 | \fi}
|
---|
877 | \lst@Key{procnamestyle}{}{\def\lst@procnamestyle{#1}}
|
---|
878 | \lst@Key{indexprocnames}{false}[t]{\lstKV@SetIf{#1}\lst@ifindexproc}
|
---|
879 | \lst@AddToHook{Init}{\lst@ifindexproc \lst@indexproc \fi}
|
---|
880 | \gdef\lst@indexproc{%
|
---|
881 | \@ifundefined{lst@indexstyle1}%
|
---|
882 | {\@namedef{lst@indexstyle1}##1{}}%
|
---|
883 | {}}
|
---|
884 | \lst@InstallKeywords w{procnamekeys}{}\relax{}
|
---|
885 | {\global\let\lst@PNpost\lst@procnametrue}
|
---|
886 | od
|
---|
887 | \lst@AddToHook{PostOutput}{\lst@PNpost\global\let\lst@PNpost\@empty}
|
---|
888 | \global\let\lst@PNpost\@empty % init
|
---|
889 | \lst@EndAspect
|
---|
890 | \lst@BeginAspect{style}
|
---|
891 | \@ifundefined{lststylefiles}
|
---|
892 | {\lst@UserCommand\lststylefiles{lststy0.sty}}{}
|
---|
893 | \lst@UserCommand\lstdefinestyle{\lst@DefStyle\iftrue}
|
---|
894 | \lst@UserCommand\lst@definestyle{\lst@DefStyle\iffalse}
|
---|
895 | \gdef\lst@DefStyle{\lst@DefDriver{style}{sty}\lstset}
|
---|
896 | \global\@namedef{lststy@$}{\lsthk@EmptyStyle}
|
---|
897 | \lst@AddToHook{EmptyStyle}{}% init
|
---|
898 | \lst@Key{style}\relax{%
|
---|
899 | \lst@LAS{style}{sty}{[]{#1}}\lst@NoAlias\lststylefiles
|
---|
900 | \lsthk@SetStyle
|
---|
901 | {}}
|
---|
902 | \lst@AddToHook{SetStyle}{}% init
|
---|
903 | \lst@EndAspect
|
---|
904 | \lst@BeginAspect{language}
|
---|
905 | \@ifundefined{lstdriverfiles}
|
---|
906 | {\lst@UserCommand\lstlanguagefiles{lstlang0.sty}}{}
|
---|
907 | \lst@UserCommand\lstdefinelanguage{\lst@DefLang\iftrue}
|
---|
908 | \lst@UserCommand\lst@definelanguage{\lst@DefLang\iffalse}
|
---|
909 | \gdef\lst@DefLang{\lst@DefDriver{language}{lang}\lstset}
|
---|
910 | \lstdefinelanguage{}{}
|
---|
911 | \lst@Key{language}\relax{\lstKV@OptArg[]{#1}%
|
---|
912 | {\lst@LAS{language}{lang}{[##1]{##2}}\lst@FindAlias\lstlanguagefiles
|
---|
913 | \lsthk@SetLanguage
|
---|
914 | {\lst@FindAlias[##1]{##2}%
|
---|
915 | \let\lst@language\lst@malias
|
---|
916 | \let\lst@dialect\lst@oalias}}}
|
---|
917 | \lst@Key{alsolanguage}\relax{\lstKV@OptArg[]{#1}%
|
---|
918 | {\lst@LAS{language}{lang}{[##1]{##2}}\lst@FindAlias\lstlanguagefiles
|
---|
919 | {}%
|
---|
920 | {\lst@FindAlias[##1]{##2}%
|
---|
921 | \let\lst@language\lst@malias
|
---|
922 | \let\lst@dialect\lst@oalias}}}
|
---|
923 | \lst@AddToHook{SetLanguage}{}% init
|
---|
924 | \lst@UserCommand\lstalias{\@ifnextchar[\lstalias@\lstalias@@}
|
---|
925 | \gdef\lstalias@[#1]#2{\lstalias@b #2$#1}
|
---|
926 | \gdef\lstalias@b#1[#2]#3{\lst@NormedNameDef{lsta@#1}{#3$#2}}
|
---|
927 | \gdef\lstalias@@#1#2{\lst@NormedNameDef{lsta@#1}{#2}}
|
---|
928 | \lst@Key{defaultdialect}\relax
|
---|
929 | {\lstKV@OptArg[]{#1}{\lst@NormedNameDef{lstdd@##2}{##1}}}
|
---|
930 | \gdef\lst@FindAlias[#1]#2{%
|
---|
931 | \lst@NormedDef\lst@oalias{#1}%
|
---|
932 | \lst@NormedDef\lst@malias{#2}%
|
---|
933 | \@ifundefined{lsta@\lst@malias}{}%
|
---|
934 | {\edef\lst@malias{\csname\@lst a@\lst@malias\endcsname}}%
|
---|
935 | \ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}%
|
---|
936 | {\edef\lst@oalias{\csname\@lst dd@\lst@malias\endcsname}}%
|
---|
937 | \fi
|
---|
938 | \edef\lst@temp{\lst@malias $\lst@oalias}%
|
---|
939 | \@ifundefined{lsta@\lst@temp}{}%
|
---|
940 | {\edef\lst@temp{\csname\@lst a@\lst@temp\endcsname}}%
|
---|
941 | \expandafter\lst@FindAlias@\lst@temp $}
|
---|
942 | \gdef\lst@FindAlias@#1$#2${%
|
---|
943 | \def\lst@malias{#1}\def\lst@oalias{#2}%
|
---|
944 | \ifx\@empty\lst@oalias \@ifundefined{lstdd@\lst@malias}{}%
|
---|
945 | {\edef\lst@oalias{\csname\@lst dd@\lst@malias\endcsname}}%
|
---|
946 | \fi}
|
---|
947 | \gdef\lst@RequireLanguages#1{%
|
---|
948 | \lst@Require{language}{lang}{#1}\lst@FindAlias\lstlanguagefiles
|
---|
949 | \ifx\lst@loadaspects\@empty\else
|
---|
950 | \lst@RequireAspects\lst@loadaspects
|
---|
951 | \fi}
|
---|
952 | \global\let\lstloadlanguages\lst@RequireLanguages
|
---|
953 | \lst@EndAspect
|
---|
954 | \lst@BeginAspect{formats}
|
---|
955 | \@ifundefined{lstformatfiles}
|
---|
956 | {\lst@UserCommand\lstformatfiles{lstfmt0.sty}}{}
|
---|
957 | \lst@UserCommand\lstdefineformat{\lst@DefFormat\iftrue}
|
---|
958 | \lst@UserCommand\lst@defineformat{\lst@DefFormat\iffalse}
|
---|
959 | \gdef\lst@DefFormat{\lst@DefDriver{format}{fmt}\lst@UseFormat}
|
---|
960 | \lstdefineformat{}{}
|
---|
961 | \lst@Key{format}\relax{%
|
---|
962 | \lst@LAS{format}{fmt}{[]{#1}}\lst@NoAlias\lstformatfiles
|
---|
963 | \lsthk@SetFormat
|
---|
964 | {}}
|
---|
965 | \lst@AddToHook{SetFormat}{\let\lst@fmtformat\@empty}% init
|
---|
966 | \gdef\lst@fmtSplit#1#2{%
|
---|
967 | \def\lst@temp##1#2##2\relax##3{%
|
---|
968 | \ifnum##3=\z@
|
---|
969 | \ifx\@empty##2\@empty
|
---|
970 | \lst@false
|
---|
971 | \let\lst@fmta#1%
|
---|
972 | \let\lst@fmtb\@empty
|
---|
973 | \else
|
---|
974 | \expandafter\lst@temp#1\relax\@ne
|
---|
975 | \fi
|
---|
976 | \else
|
---|
977 | \def\lst@fmta{##1}\def\lst@fmtb{##2}%
|
---|
978 | \fi}%
|
---|
979 | \lst@true
|
---|
980 | \expandafter\lst@temp#1#2\relax\z@}
|
---|
981 | \gdef\lst@IfNextCharWhitespace#1#2#3{%
|
---|
982 | \lst@IfSubstring#3\lst@whitespaces{#1}{#2}#3}
|
---|
983 | \begingroup
|
---|
984 | \catcode`\^^I=12\catcode`\^^J=12\catcode`\^^M=12\catcode`\^^L=12\relax%
|
---|
985 | \lst@DefActive\lst@whitespaces{\ ^^I^^J^^M}% add ^^L
|
---|
986 | \global\let\lst@whitespaces\lst@whitespaces%
|
---|
987 | \endgroup
|
---|
988 | \gdef\lst@fmtIfIdentifier#1{%
|
---|
989 | \ifx\relax#1\@empty
|
---|
990 | \expandafter\@secondoftwo
|
---|
991 | \else
|
---|
992 | \expandafter\lst@fmtIfIdentifier@\expandafter#1%
|
---|
993 | \fi}
|
---|
994 | \gdef\lst@fmtIfIdentifier@#1#2\relax{%
|
---|
995 | \let\lst@next\@secondoftwo
|
---|
996 | \ifnum`#1=`_\else
|
---|
997 | \ifnum`#1<64\else
|
---|
998 | \ifnum`#1<91\let\lst@next\@firstoftwo\else
|
---|
999 | \ifnum`#1<97\else
|
---|
1000 | \ifnum`#1<123\let\lst@next\@firstoftwo\else
|
---|
1001 | \fi \fi \fi \fi \fi
|
---|
1002 | \lst@next}
|
---|
1003 | \gdef\lst@fmtIfNextCharIn#1{%
|
---|
1004 | \ifx\@empty#1\@empty \expandafter\@secondoftwo \else
|
---|
1005 | \def\lst@next{\lst@fmtIfNextCharIn@{#1}}%
|
---|
1006 | \expandafter\lst@next\fi}
|
---|
1007 | \gdef\lst@fmtIfNextCharIn@#1#2#3#4{%
|
---|
1008 | \def\lst@temp##1#4##2##3\relax{%
|
---|
1009 | \ifx \@empty##2\expandafter\@secondoftwo
|
---|
1010 | \else \expandafter\@firstoftwo \fi}%
|
---|
1011 | \lst@temp#1#4\@empty\relax{#2}{#3}#4}
|
---|
1012 | \gdef\lst@fmtCDef#1{\lst@fmtCDef@#1}
|
---|
1013 | \gdef\lst@fmtCDef@#1#2#3#4#5#6#7{%
|
---|
1014 | \lst@CDefIt#1{#2}{#3}%
|
---|
1015 | {\lst@fmtIfNextCharIn{#5}{#4#2#3}{#6#4#2#3#7}}%
|
---|
1016 | #4%
|
---|
1017 | {}{}{}}
|
---|
1018 | \gdef\lst@fmtCDefX#1{\lst@fmtCDefX@#1}
|
---|
1019 | \gdef\lst@fmtCDefX@#1#2#3#4#5#6#7{%
|
---|
1020 | \let#4#1%
|
---|
1021 | \ifx\@empty#2\@empty
|
---|
1022 | \def#1{\lst@fmtIfNextCharIn{#5}{#4}{#6#7}}%
|
---|
1023 | \else \ifx\@empty#3\@empty
|
---|
1024 | \def#1##1{%
|
---|
1025 | \ifx##1#2%
|
---|
1026 | \def\lst@next{\lst@fmtIfNextCharIn{#5}{#4##1}%
|
---|
1027 | {#6#7}}%
|
---|
1028 | \else
|
---|
1029 | \def\lst@next{#4##1}%
|
---|
1030 | \fi
|
---|
1031 | \lst@next}%
|
---|
1032 | \else
|
---|
1033 | \def#1{%
|
---|
1034 | \lst@IfNextCharsArg{#2#3}%
|
---|
1035 | {\lst@fmtIfNextCharIn{#5}{\expandafter#4\lst@eaten}%
|
---|
1036 | {#6#7}}%
|
---|
1037 | {\expandafter#4\lst@eaten}}%
|
---|
1038 | \fi \fi}
|
---|
1039 | \gdef\lst@UseFormat#1{%
|
---|
1040 | \def\lst@fmtwhole{#1}%
|
---|
1041 | \lst@UseFormat@}
|
---|
1042 | \gdef\lst@UseFormat@{%
|
---|
1043 | \lst@fmtSplit\lst@fmtwhole,%
|
---|
1044 | \let\lst@fmtwhole\lst@fmtb
|
---|
1045 | \ifx\lst@fmta\@empty\else
|
---|
1046 | \lst@fmtSplit\lst@fmta=%
|
---|
1047 | \ifx\@empty\lst@fmta\else
|
---|
1048 | \expandafter\lstKV@XOptArg\expandafter[\expandafter]%
|
---|
1049 | \expandafter{\lst@fmtb}\lst@UseFormat@b
|
---|
1050 | \fi
|
---|
1051 | \fi
|
---|
1052 | \ifx\lst@fmtwhole\@empty\else
|
---|
1053 | \expandafter\lst@UseFormat@
|
---|
1054 | \fi}
|
---|
1055 | \gdef\lst@UseFormat@b[#1]#2{%
|
---|
1056 | \def\lst@fmtc{{#1}}\lst@lExtend\lst@fmtc{\expandafter{\lst@fmta}}%
|
---|
1057 | \def\lst@fmtb{#2}%
|
---|
1058 | \lst@fmtSplit\lst@fmtb\string
|
---|
1059 | \ifx\@empty\lst@fmta
|
---|
1060 | \lst@lAddTo\lst@fmtc{{}}%
|
---|
1061 | \else
|
---|
1062 | \lst@lExtend\lst@fmtc{\expandafter
|
---|
1063 | {\expandafter\lst@fmtPre\expandafter{\lst@fmta}}}%
|
---|
1064 | \fi
|
---|
1065 | \ifx\@empty\lst@fmtb
|
---|
1066 | \lst@lAddTo\lst@fmtc{{}}%
|
---|
1067 | \else
|
---|
1068 | \lst@lExtend\lst@fmtc{\expandafter
|
---|
1069 | {\expandafter\lst@fmtPost\expandafter{\lst@fmtb}}}%
|
---|
1070 | \fi
|
---|
1071 | \expandafter\lst@UseFormat@c\lst@fmtc}
|
---|
1072 | \gdef\lst@UseFormat@c#1#2#3#4{%
|
---|
1073 | \lst@fmtIfIdentifier#2\relax
|
---|
1074 | {\lst@fmtIdentifier{#2}%
|
---|
1075 | \lst@if\else \PackageWarning{Listings}%
|
---|
1076 | {Cannot drop identifier in format definition}%
|
---|
1077 | \fi}%
|
---|
1078 | {\lst@if
|
---|
1079 | \lst@lAddTo\lst@fmtformat{\lst@CArgX#2\relax\lst@fmtCDef}%
|
---|
1080 | \else
|
---|
1081 | \lst@lAddTo\lst@fmtformat{\lst@CArgX#2\relax\lst@fmtCDefX}%
|
---|
1082 | \fi
|
---|
1083 | \lst@DefActive\lst@fmtc{#1}%
|
---|
1084 | \lst@lExtend\lst@fmtformat{\expandafter{\lst@fmtc}{#3}{#4}}}}
|
---|
1085 | \lst@AddToHook{SelectCharTable}{\lst@fmtformat}
|
---|
1086 | \global\let\lst@fmtformat\@empty
|
---|
1087 | \gdef\lst@fmtPre#1{%
|
---|
1088 | \lst@PrintToken
|
---|
1089 | \begingroup
|
---|
1090 | \let\newline\lst@fmtEnsureNewLine
|
---|
1091 | \let\space\lst@fmtEnsureSpace
|
---|
1092 | \let\indent\lst@fmtIndent
|
---|
1093 | \let\noindent\lst@fmtNoindent
|
---|
1094 | #1%
|
---|
1095 | \endgroup}
|
---|
1096 | \gdef\lst@fmtPost#1{%
|
---|
1097 | \global\let\lst@fmtPostOutput\@empty
|
---|
1098 | \begingroup
|
---|
1099 | \def\newline{\lst@AddTo\lst@fmtPostOutput\lst@fmtEnsureNewLine}%
|
---|
1100 | \def\space{\aftergroup\lst@fmtEnsurePostSpace}%
|
---|
1101 | \def\indent{\lst@AddTo\lst@fmtPostOutput\lst@fmtIndent}%
|
---|
1102 | \def\noindent{\lst@AddTo\lst@fmtPostOutput\lst@fmtNoindent}%
|
---|
1103 | \aftergroup\lst@PrintToken
|
---|
1104 | #1%
|
---|
1105 | \endgroup}
|
---|
1106 | \lst@AddToHook{Init}{\global\let\lst@fmtPostOutput\@empty}
|
---|
1107 | \lst@AddToHook{PostOutput}
|
---|
1108 | {\lst@fmtPostOutput \global\let\lst@fmtPostOutput\@empty}
|
---|
1109 | \gdef\lst@fmtEnsureSpace{%
|
---|
1110 | \lst@ifwhitespace\else \expandafter\lst@ProcessSpace \fi}
|
---|
1111 | \gdef\lst@fmtEnsurePostSpace{%
|
---|
1112 | \lst@IfNextCharWhitespace{}{\lst@ProcessSpace}}
|
---|
1113 | \lst@Key{fmtindent}{20pt}{\def\lst@fmtindent{#1}}
|
---|
1114 | \newdimen\lst@fmtcurrindent
|
---|
1115 | \lst@AddToHook{InitVars}{\global\lst@fmtcurrindent\z@}
|
---|
1116 | \gdef\lst@fmtIndent{\global\advance\lst@fmtcurrindent\lst@fmtindent}
|
---|
1117 | \gdef\lst@fmtNoindent{\global\advance\lst@fmtcurrindent-\lst@fmtindent}
|
---|
1118 | \gdef\lst@fmtEnsureNewLine{%
|
---|
1119 | \global\advance\lst@newlines\@ne
|
---|
1120 | \global\advance\lst@newlinesensured\@ne
|
---|
1121 | \lst@fmtignoretrue}
|
---|
1122 | \lst@AddToAtTop\lst@DoNewLines{%
|
---|
1123 | \ifnum\lst@newlines>\lst@newlinesensured
|
---|
1124 | \global\advance\lst@newlines-\lst@newlinesensured
|
---|
1125 | \fi
|
---|
1126 | \global\lst@newlinesensured\z@}
|
---|
1127 | \newcount\lst@newlinesensured % global
|
---|
1128 | \lst@AddToHook{Init}{\global\lst@newlinesensured\z@}
|
---|
1129 | \gdef\lst@fmtignoretrue{\let\lst@fmtifignore\iftrue}
|
---|
1130 | \gdef\lst@fmtignorefalse{\let\lst@fmtifignore\iffalse}
|
---|
1131 | \lst@AddToHook{InitVars}{\lst@fmtignorefalse}
|
---|
1132 | \lst@AddToHook{Output}{\lst@fmtignorefalse}
|
---|
1133 | \gdef\lst@fmtUseLostSpace{%
|
---|
1134 | \lst@ifnewline \kern\lst@fmtcurrindent \global\lst@lostspace\z@
|
---|
1135 | \else
|
---|
1136 | \lst@OldOLS
|
---|
1137 | \fi}
|
---|
1138 | \lst@AddToHook{Init}
|
---|
1139 | {\lst@true
|
---|
1140 | \ifx\lst@fmtformat\@empty \ifx\lst@fmt\@empty \lst@false \fi\fi
|
---|
1141 | \lst@if
|
---|
1142 | \let\lst@OldOLS\lst@OutputLostSpace
|
---|
1143 | \let\lst@OutputLostSpace\lst@fmtUseLostSpace
|
---|
1144 | \let\lst@ProcessSpace\lst@fmtProcessSpace
|
---|
1145 | \fi}
|
---|
1146 | \gdef\lst@fmtProcessSpace{%
|
---|
1147 | \lst@ifletter
|
---|
1148 | \lst@Output
|
---|
1149 | \lst@fmtifignore\else
|
---|
1150 | \lst@AppendOther\lst@outputspace
|
---|
1151 | \fi
|
---|
1152 | \else \lst@ifkeepspaces
|
---|
1153 | \lst@AppendOther\lst@outputspace
|
---|
1154 | \else \ifnum\lst@newlines=\z@
|
---|
1155 | \lst@AppendSpecialSpace
|
---|
1156 | \else \ifnum\lst@length=\z@
|
---|
1157 | \global\advance\lst@lostspace\lst@width
|
---|
1158 | \global\advance\lst@pos\m@ne
|
---|
1159 | \else
|
---|
1160 | \lst@AppendSpecialSpace
|
---|
1161 | \fi
|
---|
1162 | \fi \fi \fi
|
---|
1163 | \lst@whitespacetrue}
|
---|
1164 | \lst@InstallTest{f}
|
---|
1165 | \lst@fmt@list\lst@fmt \lst@gfmt@list\lst@gfmt
|
---|
1166 | \lst@gfmt@wp
|
---|
1167 | wd
|
---|
1168 | \gdef\lst@fmt@list{\lst@fmt\lst@gfmt}\global\let\lst@fmt\@empty
|
---|
1169 | \gdef\lst@gfmt@list{\lst@fmt\lst@gfmt}\global\let\lst@gfmt\@empty
|
---|
1170 | \gdef\lst@gfmt@wp{%
|
---|
1171 | \begingroup \let\lst@UM\@empty
|
---|
1172 | \let\lst@PrintToken\@empty
|
---|
1173 | \csname\@lst @fmt$\the\lst@token\endcsname
|
---|
1174 | \endgroup}
|
---|
1175 | \gdef\lst@fmtIdentifier#1#2#3#4{%
|
---|
1176 | \lst@DefOther\lst@fmta{#2}\edef\lst@fmt{\lst@fmt,\lst@fmta}%
|
---|
1177 | \@namedef{\@lst @fmt$\lst@fmta}{#3#4}}
|
---|
1178 | \lst@EndAspect
|
---|
1179 | \lst@BeginAspect{labels}
|
---|
1180 | \lst@Key{numbers}{none}{%
|
---|
1181 | \let\lst@PlaceNumber\@empty
|
---|
1182 | \lstKV@SwitchCases{#1}%
|
---|
1183 | {none&\\%
|
---|
1184 | left&\def\lst@PlaceNumber{\llap{\normalfont
|
---|
1185 | \lst@numberstyle{\thelstnumber}\kern\lst@numbersep}}\\%
|
---|
1186 | right&\def\lst@PlaceNumber{\rlap{\normalfont
|
---|
1187 | \kern\linewidth \kern\lst@numbersep
|
---|
1188 | \lst@numberstyle{\thelstnumber}}}%
|
---|
1189 | }{\PackageError{Listings}{Numbers #1 unknown}\@ehc}}
|
---|
1190 | \lst@Key{numberstyle}{}{\def\lst@numberstyle{#1}}
|
---|
1191 | \lst@Key{numbersep}{10pt}{\def\lst@numbersep{#1}}
|
---|
1192 | \lst@Key{stepnumber}{1}{\def\lst@stepnumber{#1\relax}}
|
---|
1193 | \lst@AddToHook{EmptyStyle}{\let\lst@stepnumber\@ne}
|
---|
1194 | \lst@Key{numberblanklines}{true}[t]
|
---|
1195 | {\lstKV@SetIf{#1}\lst@ifnumberblanklines}
|
---|
1196 | \lst@Key{numberfirstline}{f}[t]{\lstKV@SetIf{#1}\lst@ifnumberfirstline}
|
---|
1197 | \gdef\lst@numberfirstlinefalse{\let\lst@ifnumberfirstline\iffalse}
|
---|
1198 | \lst@Key{firstnumber}{auto}{%
|
---|
1199 | \lstKV@SwitchCases{#1}%
|
---|
1200 | {auto&\let\lst@firstnumber\@undefined\\%
|
---|
1201 | last&\let\lst@firstnumber\c@lstnumber
|
---|
1202 | }{\def\lst@firstnumber{#1\relax}}}
|
---|
1203 | \lst@AddToHook{PreSet}{\let\lst@advancenumber\z@}
|
---|
1204 | \lst@AddToHook{PreInit}
|
---|
1205 | {\ifx\lst@firstnumber\@undefined
|
---|
1206 | \def\lst@firstnumber{\lst@lineno}%
|
---|
1207 | \fi}
|
---|
1208 | \gdef\lst@SetFirstNumber{%
|
---|
1209 | \ifx\lst@firstnumber\@undefined
|
---|
1210 | \@tempcnta 0\csname\@lst no@\lst@intname\endcsname\relax
|
---|
1211 | \ifnum\@tempcnta=\z@ \@tempcnta\lst@firstline
|
---|
1212 | \else \lst@nololtrue \fi
|
---|
1213 | \advance\@tempcnta\lst@advancenumber
|
---|
1214 | \edef\lst@firstnumber{\the\@tempcnta\relax}%
|
---|
1215 | \fi}
|
---|
1216 | \gdef\lst@SaveFirstNumber{%
|
---|
1217 | \expandafter\xdef
|
---|
1218 | \csname\@lst no\ifx\lst@intname\@empty @ \else @\lst@intname\fi
|
---|
1219 | \endcsname{\the\c@lstnumber}}
|
---|
1220 | \newcounter{lstnumber}% \global
|
---|
1221 | \global\c@lstnumber\@ne % init
|
---|
1222 | \renewcommand*\thelstnumber{\@arabic\c@lstnumber}
|
---|
1223 | \lst@AddToHook{EveryPar}
|
---|
1224 | {\global\advance\c@lstnumber\lst@advancelstnum
|
---|
1225 | \global\advance\c@lstnumber\m@ne \refstepcounter{lstnumber}%
|
---|
1226 | \lst@SkipOrPrintLabel}%
|
---|
1227 | \global\let\lst@advancelstnum\@ne
|
---|
1228 | \lst@AddToHook{Init}{\def\@currentlabel{\thelstnumber}}
|
---|
1229 | \lst@AddToHook{InitVars}
|
---|
1230 | {\global\c@lstnumber\lst@firstnumber
|
---|
1231 | \global\advance\c@lstnumber\lst@advancenumber
|
---|
1232 | \global\advance\c@lstnumber-\lst@advancelstnum}
|
---|
1233 | \lst@AddToHook{ExitVars}
|
---|
1234 | {\global\advance\c@lstnumber\lst@advancelstnum}
|
---|
1235 | \AtBeginDocument{%
|
---|
1236 | \def\theHlstnumber{\ifx\lst@@caption\@empty \lst@neglisting
|
---|
1237 | \else \thelstlisting \fi
|
---|
1238 | .\thelstnumber}}
|
---|
1239 | \newcount\lst@skipnumbers % \global
|
---|
1240 | \lst@AddToHook{Init}
|
---|
1241 | {\ifnum \z@>\lst@stepnumber
|
---|
1242 | \let\lst@advancelstnum\m@ne
|
---|
1243 | \edef\lst@stepnumber{-\lst@stepnumber}%
|
---|
1244 | \fi
|
---|
1245 | \ifnum \z@<\lst@stepnumber
|
---|
1246 | \global\lst@skipnumbers\lst@firstnumber
|
---|
1247 | \global\divide\lst@skipnumbers\lst@stepnumber
|
---|
1248 | \global\multiply\lst@skipnumbers-\lst@stepnumber
|
---|
1249 | \global\advance\lst@skipnumbers\lst@firstnumber
|
---|
1250 | \ifnum\lst@skipnumbers>\z@
|
---|
1251 | \global\advance\lst@skipnumbers -\lst@stepnumber
|
---|
1252 | \fi
|
---|
1253 | \else
|
---|
1254 | \let\lst@SkipOrPrintLabel\relax
|
---|
1255 | \fi}
|
---|
1256 | \gdef\lst@SkipOrPrintLabel{%
|
---|
1257 | \ifnum\lst@skipnumbers=\z@
|
---|
1258 | \global\advance\lst@skipnumbers-\lst@stepnumber\relax
|
---|
1259 | \lst@PlaceNumber
|
---|
1260 | \lst@numberfirstlinefalse
|
---|
1261 | \else
|
---|
1262 | \lst@ifnumberfirstline
|
---|
1263 | \lst@PlaceNumber
|
---|
1264 | \lst@numberfirstlinefalse
|
---|
1265 | \fi
|
---|
1266 | \fi
|
---|
1267 | \global\advance\lst@skipnumbers\@ne}%
|
---|
1268 | \lst@AddToHook{OnEmptyLine}{%
|
---|
1269 | \lst@ifnumberblanklines\else \ifnum\lst@skipnumbers=\z@
|
---|
1270 | \global\advance\lst@skipnumbers-\lst@stepnumber\relax
|
---|
1271 | \fi\fi}
|
---|
1272 | \lst@EndAspect
|
---|
1273 | \lst@BeginAspect{lineshape}
|
---|
1274 | \lst@Key{xleftmargin}{\z@}{\def\lst@xleftmargin{#1}}
|
---|
1275 | \lst@Key{xrightmargin}{\z@}{\def\lst@xrightmargin{#1}}
|
---|
1276 | \lst@Key{resetmargins}{false}[t]{\lstKV@SetIf{#1}\lst@ifresetmargins}
|
---|
1277 | \lst@AddToHook{BoxUnsafe}{\let\lst@xleftmargin\z@
|
---|
1278 | \let\lst@xrightmargin\z@}
|
---|
1279 | \lst@AddToHook{TextStyle}{%
|
---|
1280 | \let\lst@xleftmargin\z@ \let\lst@xrightmargin\z@
|
---|
1281 | \let\lst@ifresetmargins\iftrue}
|
---|
1282 | \lst@Key{linewidth}\linewidth{\def\lst@linewidth{#1}}
|
---|
1283 | \lst@AddToHook{PreInit}{\linewidth\lst@linewidth\relax}
|
---|
1284 | \gdef\lst@parshape{%
|
---|
1285 | \parshape\@ne \@totalleftmargin \linewidth}
|
---|
1286 | \lst@AddToHook{Init}
|
---|
1287 | {\lst@ifresetmargins
|
---|
1288 | \advance\linewidth\@totalleftmargin
|
---|
1289 | \advance\linewidth\rightmargin
|
---|
1290 | \@totalleftmargin\z@
|
---|
1291 | \fi
|
---|
1292 | \advance\linewidth-\lst@xleftmargin
|
---|
1293 | \advance\linewidth-\lst@xrightmargin
|
---|
1294 | \advance\@totalleftmargin\lst@xleftmargin\relax}
|
---|
1295 | \lst@Key{lineskip}{\z@}{\def\lst@lineskip{#1\relax}}
|
---|
1296 | \lst@AddToHook{Init}
|
---|
1297 | {\parskip\z@
|
---|
1298 | \ifdim\z@=\lst@lineskip\else
|
---|
1299 | \@tempdima\baselineskip
|
---|
1300 | \advance\@tempdima\lst@lineskip
|
---|
1301 | \multiply\@tempdima\@cclvi
|
---|
1302 | \divide\@tempdima\baselineskip\relax
|
---|
1303 | \multiply\@tempdima\@cclvi
|
---|
1304 | \edef\baselinestretch{\strip@pt\@tempdima}%
|
---|
1305 | \selectfont
|
---|
1306 | \fi}
|
---|
1307 | \lst@Key{breaklines}{false}[t]{\lstKV@SetIf{#1}\lst@ifbreaklines}
|
---|
1308 | \lst@Key{breakindent}{20pt}{\def\lst@breakindent{#1}}
|
---|
1309 | \lst@Key{breakautoindent}{t}[t]{\lstKV@SetIf{#1}\lst@ifbreakautoindent}
|
---|
1310 | \lst@Key{breakatwhitespace}{false}[t]%
|
---|
1311 | {\lstKV@SetIf{#1}\lst@ifbreakatwhitespace}
|
---|
1312 | \lst@Key{prebreak}{}{\def\lst@prebreak{#1}}
|
---|
1313 | \lst@Key{postbreak}{}{\def\lst@postbreak{#1}}
|
---|
1314 | \lst@AddToHook{Init}
|
---|
1315 | {\lst@ifbreaklines
|
---|
1316 | \hbadness\@M \pretolerance\@M
|
---|
1317 | \@rightskip\@flushglue \rightskip\@rightskip % \raggedright
|
---|
1318 | \leftskip\z@skip \parindent\z@
|
---|
1319 | \def\lst@parshape{\parshape\tw@ \@totalleftmargin\linewidth
|
---|
1320 | \lst@breakshape}%
|
---|
1321 | \else
|
---|
1322 | \let\lst@discretionary\@empty
|
---|
1323 | \fi}
|
---|
1324 | \lst@AddToHook{OnNewLine}
|
---|
1325 | {\lst@ifbreaklines \lst@breakNewLine \fi}
|
---|
1326 | \gdef\lst@discretionary{%
|
---|
1327 | \lst@ifbreakatwhitespace
|
---|
1328 | \lst@ifwhitespace \lst@@discretionary \fi
|
---|
1329 | \else
|
---|
1330 | \lst@@discretionary
|
---|
1331 | \fi}%
|
---|
1332 | \gdef\lst@@discretionary{%
|
---|
1333 | \discretionary{\let\space\lst@spacekern\lst@prebreak}%
|
---|
1334 | {\llap{\lsthk@EveryLine
|
---|
1335 | \kern\lst@breakcurrindent \kern-\@totalleftmargin}%
|
---|
1336 | \let\space\lst@spacekern\lst@postbreak}{}}
|
---|
1337 | \lst@AddToHook{PostOutput}{\lst@discretionary}
|
---|
1338 | \gdef\lst@spacekern{\kern\lst@width}
|
---|
1339 | \gdef\lst@breakNewLine{%
|
---|
1340 | \@tempdima\lst@breakindent\relax
|
---|
1341 | \lst@ifbreakautoindent \advance\@tempdima\lst@lostspace \fi
|
---|
1342 | \@tempdimc-\@tempdima \advance\@tempdimc\linewidth
|
---|
1343 | \advance\@tempdima\@totalleftmargin
|
---|
1344 | \xdef\lst@breakshape{\noexpand\lst@breakcurrindent \the\@tempdimc}%
|
---|
1345 | \xdef\lst@breakcurrindent{\the\@tempdima}}
|
---|
1346 | \global\let\lst@breakcurrindent\z@ % init
|
---|
1347 | \gdef\lst@breakshape{\@totalleftmargin \linewidth}
|
---|
1348 | \gdef\lst@breakProcessOther#1{\lst@ProcessOther#1\lst@OutputOther}
|
---|
1349 | \lst@AddToHook{SelectCharTable}
|
---|
1350 | {\lst@ifbreaklines \lst@Def{`)}{\lst@breakProcessOther)}\fi}
|
---|
1351 | \lst@EndAspect
|
---|
1352 | \lst@BeginAspect[lineshape]{frames}
|
---|
1353 | \lst@Key{framexleftmargin}{\z@}{\def\lst@framexleftmargin{#1}}
|
---|
1354 | \lst@Key{framexrightmargin}{\z@}{\def\lst@framexrightmargin{#1}}
|
---|
1355 | \lst@Key{framextopmargin}{\z@}{\def\lst@framextopmargin{#1}}
|
---|
1356 | \lst@Key{framexbottommargin}{\z@}{\def\lst@framexbottommargin{#1}}
|
---|
1357 | \lst@Key{backgroundcolor}{}{\def\lst@bkgcolor{#1}}
|
---|
1358 | \lst@Key{fillcolor}{}{\def\lst@fillcolor{#1}}
|
---|
1359 | \lst@Key{rulecolor}{}{\def\lst@rulecolor{#1}}
|
---|
1360 | \lst@Key{rulesepcolor}{}{\def\lst@rulesepcolor{#1}}
|
---|
1361 | \lst@AddToHook{Init}{%
|
---|
1362 | \ifx\lst@fillcolor\@empty
|
---|
1363 | \let\lst@fillcolor\lst@bkgcolor
|
---|
1364 | \fi
|
---|
1365 | \ifx\lst@rulesepcolor\@empty
|
---|
1366 | \let\lst@rulesepcolor\lst@fillcolor
|
---|
1367 | \fi}
|
---|
1368 | \lst@Key{rulesep}{2pt}{\def\lst@rulesep{#1}}
|
---|
1369 | \lst@Key{framerule}{.4pt}{\def\lst@framerulewidth{#1}}
|
---|
1370 | \lst@Key{framesep}{3pt}{\def\lst@frametextsep{#1}}
|
---|
1371 | \lst@Key{frameshape}{}{%
|
---|
1372 | \let\lst@xrulecolor\@empty
|
---|
1373 | \lstKV@FourArg{#1}%
|
---|
1374 | {\uppercase{\def\lst@frametshape{##1}}%
|
---|
1375 | \uppercase{\def\lst@framelshape{##2}}%
|
---|
1376 | \uppercase{\def\lst@framershape{##3}}%
|
---|
1377 | \uppercase{\def\lst@framebshape{##4}}%
|
---|
1378 | \let\lst@ifframeround\iffalse
|
---|
1379 | \lst@IfSubstring R\lst@frametshape{\let\lst@ifframeround\iftrue}{}%
|
---|
1380 | \lst@IfSubstring R\lst@framebshape{\let\lst@ifframeround\iftrue}{}%
|
---|
1381 | \def\lst@frame{##1##2##3##4}}}
|
---|
1382 | \lst@Key{frameround}\relax
|
---|
1383 | {\uppercase{\def\lst@frameround{#1}}%
|
---|
1384 | \expandafter\lstframe@\lst@frameround ffff\relax}
|
---|
1385 | \global\let\lst@frameround\@empty
|
---|
1386 | \lst@Key{frame}\relax{%
|
---|
1387 | \let\lst@xrulecolor\@empty
|
---|
1388 | \lstKV@SwitchCases{#1}%
|
---|
1389 | {none&\let\lst@frame\@empty\\%
|
---|
1390 | leftline&\def\lst@frame{l}\\%
|
---|
1391 | topline&\def\lst@frame{t}\\%
|
---|
1392 | bottomline&\def\lst@frame{b}\\%
|
---|
1393 | lines&\def\lst@frame{tb}\\%
|
---|
1394 | single&\def\lst@frame{trbl}\\%
|
---|
1395 | shadowbox&\def\lst@frame{tRBl}%
|
---|
1396 | \def\lst@xrulecolor{\lst@rulesepcolor}%
|
---|
1397 | \def\lst@rulesep{\lst@frametextsep}%
|
---|
1398 | }{\def\lst@frame{#1}}%
|
---|
1399 | \expandafter\lstframe@\lst@frameround ffff\relax}
|
---|
1400 | \gdef\lstframe@#1#2#3#4#5\relax{%
|
---|
1401 | \lst@IfSubstring T\lst@frame{\edef\lst@frame{t\lst@frame}}{}%
|
---|
1402 | \lst@IfSubstring R\lst@frame{\edef\lst@frame{r\lst@frame}}{}%
|
---|
1403 | \lst@IfSubstring B\lst@frame{\edef\lst@frame{b\lst@frame}}{}%
|
---|
1404 | \lst@IfSubstring L\lst@frame{\edef\lst@frame{l\lst@frame}}{}%
|
---|
1405 | \let\lst@frametshape\@empty \let\lst@framebshape\@empty
|
---|
1406 | \lst@frameCheck
|
---|
1407 | ltr\lst@framelshape\lst@frametshape\lst@framershape #4#1%
|
---|
1408 | \lst@frameCheck
|
---|
1409 | LTR\lst@framelshape\lst@frametshape\lst@framershape #4#1%
|
---|
1410 | \lst@frameCheck
|
---|
1411 | lbr\lst@framelshape\lst@framebshape\lst@framershape #3#2%
|
---|
1412 | \lst@frameCheck
|
---|
1413 | LBR\lst@framelshape\lst@framebshape\lst@framershape #3#2%
|
---|
1414 | \let\lst@ifframeround\iffalse
|
---|
1415 | \lst@IfSubstring R\lst@frametshape{\let\lst@ifframeround\iftrue}{}%
|
---|
1416 | \lst@IfSubstring R\lst@framebshape{\let\lst@ifframeround\iftrue}{}%
|
---|
1417 | \let\lst@framelshape\@empty \let\lst@framershape\@empty
|
---|
1418 | \lst@IfSubstring L\lst@frame
|
---|
1419 | {\def\lst@framelshape{YY}}%
|
---|
1420 | {\lst@IfSubstring l\lst@frame{\def\lst@framelshape{Y}}{}}%
|
---|
1421 | \lst@IfSubstring R\lst@frame
|
---|
1422 | {\def\lst@framershape{YY}}%
|
---|
1423 | {\lst@IfSubstring r\lst@frame{\def\lst@framershape{Y}}{}}}
|
---|
1424 | \gdef\lst@frameCheck#1#2#3#4#5#6#7#8{%
|
---|
1425 | \lst@IfSubstring #1\lst@frame
|
---|
1426 | {\if #7T\def#4{R}\else \def#4{Y}\fi}%
|
---|
1427 | {\def#4{N}}%
|
---|
1428 | \lst@IfSubstring #3\lst@frame
|
---|
1429 | {\if #8T\def#6{R}\else \def#6{Y}\fi}%
|
---|
1430 | {\def#6{N}}%
|
---|
1431 | \lst@IfSubstring #2\lst@frame{\edef#5{#5#4Y#6}}{}}
|
---|
1432 | \lst@AddToHook{TextStyle}
|
---|
1433 | {\let\lst@frame\@empty
|
---|
1434 | \let\lst@frametshape\@empty
|
---|
1435 | \let\lst@framershape\@empty
|
---|
1436 | \let\lst@framebshape\@empty
|
---|
1437 | \let\lst@framelshape\@empty
|
---|
1438 | \let\lst@bkgcolor\@empty}
|
---|
1439 | \gdef\lst@frameMakeBoxV#1#2#3{%
|
---|
1440 | \setbox#1\hbox{%
|
---|
1441 | \color@begingroup \lst@rulecolor
|
---|
1442 | \ifx\lst@framelshape\@empty
|
---|
1443 | \else
|
---|
1444 | \llap{%
|
---|
1445 | \lst@frameBlock\lst@fillcolor\lst@frametextsep{#2}{#3}%
|
---|
1446 | \kern\lst@framexleftmargin}%
|
---|
1447 | \fi
|
---|
1448 | \llap{\setbox\z@\hbox{\vrule\@width\z@\@height#2\@depth#3%
|
---|
1449 | \lst@frameL}%
|
---|
1450 | \rlap{\lst@frameBlock\lst@rulesepcolor{\wd\z@}%
|
---|
1451 | {\ht\z@}{\dp\z@}}%
|
---|
1452 | \box\z@
|
---|
1453 | \kern\lst@frametextsep\relax
|
---|
1454 | \kern\lst@framexleftmargin}%
|
---|
1455 | \rlap{\kern-\lst@framexleftmargin
|
---|
1456 | \@tempdima\linewidth
|
---|
1457 | \advance\@tempdima\lst@framexleftmargin
|
---|
1458 | \advance\@tempdima\lst@framexrightmargin
|
---|
1459 | \lst@frameBlock\lst@bkgcolor\@tempdima{#2}{#3}%
|
---|
1460 | \ifx\lst@framershape\@empty
|
---|
1461 | \kern\lst@frametextsep\relax
|
---|
1462 | \else
|
---|
1463 | \lst@frameBlock\lst@fillcolor\lst@frametextsep{#2}{#3}%
|
---|
1464 | \fi
|
---|
1465 | \setbox\z@\hbox{\vrule\@width\z@\@height#2\@depth#3%
|
---|
1466 | \lst@frameR}%
|
---|
1467 | \rlap{\lst@frameBlock\lst@rulesepcolor{\wd\z@}%
|
---|
1468 | {\ht\z@}{\dp\z@}}%
|
---|
1469 | \box\z@}%
|
---|
1470 | \color@endgroup}}
|
---|
1471 | \gdef\lst@frameBlock#1#2#3#4{%
|
---|
1472 | \color@begingroup
|
---|
1473 | #1%
|
---|
1474 | \setbox\z@\hbox{\vrule\@height#3\@depth#4%
|
---|
1475 | \ifx#1\@empty \@width\z@ \kern#2\relax
|
---|
1476 | \else \@width#2\relax \fi}%
|
---|
1477 | \box\z@
|
---|
1478 | \color@endgroup}
|
---|
1479 | \gdef\lst@frameR{%
|
---|
1480 | \expandafter\lst@frameR@\lst@framershape\relax
|
---|
1481 | \kern-\lst@rulesep}
|
---|
1482 | \gdef\lst@frameR@#1{%
|
---|
1483 | \ifx\relax#1\@empty\else
|
---|
1484 | \if #1Y\lst@framevrule \else \kern\lst@framerulewidth \fi
|
---|
1485 | \kern\lst@rulesep
|
---|
1486 | \expandafter\lst@frameR@b
|
---|
1487 | \fi}
|
---|
1488 | \gdef\lst@frameR@b#1{%
|
---|
1489 | \ifx\relax#1\@empty
|
---|
1490 | \else
|
---|
1491 | \if #1Y\color@begingroup
|
---|
1492 | \lst@xrulecolor
|
---|
1493 | \lst@framevrule
|
---|
1494 | \color@endgroup
|
---|
1495 | \else
|
---|
1496 | \kern\lst@framerulewidth
|
---|
1497 | \fi
|
---|
1498 | \kern\lst@rulesep
|
---|
1499 | \expandafter\lst@frameR@
|
---|
1500 | \fi}
|
---|
1501 | \gdef\lst@frameL{%
|
---|
1502 | \kern-\lst@rulesep
|
---|
1503 | \expandafter\lst@frameL@\lst@framelshape\relax}
|
---|
1504 | \gdef\lst@frameL@#1{%
|
---|
1505 | \ifx\relax#1\@empty\else
|
---|
1506 | \kern\lst@rulesep
|
---|
1507 | \if#1Y\lst@framevrule \else \kern\lst@framerulewidth \fi
|
---|
1508 | \expandafter\lst@frameL@
|
---|
1509 | \fi}
|
---|
1510 | \gdef\lst@frameH#1#2{%
|
---|
1511 | \global\let\lst@framediml\z@ \global\let\lst@framedimr\z@
|
---|
1512 | \setbox\z@\hbox{}\@tempcntb\z@
|
---|
1513 | \expandafter\lst@frameH@\expandafter#1#2\relax\relax\relax
|
---|
1514 | \@tempdimb\lst@frametextsep\relax
|
---|
1515 | \advance\@tempdimb\lst@framerulewidth\relax
|
---|
1516 | \@tempdimc-\@tempdimb
|
---|
1517 | \advance\@tempdimc\ht\z@
|
---|
1518 | \advance\@tempdimc\dp\z@
|
---|
1519 | \setbox\z@=\hbox{%
|
---|
1520 | \lst@frameHBkg\lst@fillcolor\@tempdimb\@firstoftwo
|
---|
1521 | \if#1T\rlap{\raise\dp\@tempboxa\box\@tempboxa}%
|
---|
1522 | \else\rlap{\lower\ht\@tempboxa\box\@tempboxa}\fi
|
---|
1523 | \lst@frameHBkg\lst@rulesepcolor\@tempdimc\@secondoftwo
|
---|
1524 | \advance\@tempdimb\ht\@tempboxa
|
---|
1525 | \if#1T\rlap{\raise\lst@frametextsep\box\@tempboxa}%
|
---|
1526 | \else\rlap{\lower\@tempdimb\box\@tempboxa}\fi
|
---|
1527 | \rlap{\box\z@}%
|
---|
1528 | }}
|
---|
1529 | \gdef\lst@frameH@#1#2#3#4{%
|
---|
1530 | \ifx\relax#4\@empty\else
|
---|
1531 | \lst@frameh \@tempcntb#1#2#3#4%
|
---|
1532 | \advance\@tempcntb\@ne
|
---|
1533 | \expandafter\lst@frameH@\expandafter#1%
|
---|
1534 | \fi}
|
---|
1535 | \gdef\lst@frameHBkg#1#2#3{%
|
---|
1536 | \setbox\@tempboxa\hbox{%
|
---|
1537 | \kern-\lst@framexleftmargin
|
---|
1538 | #3{\kern-\lst@framediml\relax}{\@tempdima\z@}%
|
---|
1539 | \ifdim\lst@framediml>\@tempdimb
|
---|
1540 | #3{\@tempdima\lst@framediml \advance\@tempdima-\@tempdimb
|
---|
1541 | \lst@frameBlock\lst@rulesepcolor\@tempdima\@tempdimb\z@}%
|
---|
1542 | {\kern-\lst@framediml
|
---|
1543 | \advance\@tempdima\lst@framediml\relax}%
|
---|
1544 | \fi
|
---|
1545 | #3{\@tempdima\z@
|
---|
1546 | \ifx\lst@framelshape\@empty\else
|
---|
1547 | \advance\@tempdima\@tempdimb
|
---|
1548 | \fi
|
---|
1549 | \ifx\lst@framershape\@empty\else
|
---|
1550 | \advance\@tempdima\@tempdimb
|
---|
1551 | \fi}%
|
---|
1552 | {\ifdim\lst@framedimr>\@tempdimb
|
---|
1553 | \advance\@tempdima\lst@framedimr\relax
|
---|
1554 | \fi}%
|
---|
1555 | \advance\@tempdima\linewidth
|
---|
1556 | \advance\@tempdima\lst@framexleftmargin
|
---|
1557 | \advance\@tempdima\lst@framexrightmargin
|
---|
1558 | \lst@frameBlock#1\@tempdima#2\z@
|
---|
1559 | #3{\ifdim\lst@framedimr>\@tempdimb
|
---|
1560 | \@tempdima-\@tempdimb
|
---|
1561 | \advance\@tempdima\lst@framedimr\relax
|
---|
1562 | \lst@frameBlock\lst@rulesepcolor\@tempdima\@tempdimb\z@
|
---|
1563 | \fi}{}%
|
---|
1564 | }}
|
---|
1565 | \gdef\lst@frameh#1#2#3#4#5{%
|
---|
1566 | \lst@frameCalcDimA#1%
|
---|
1567 | \lst@ifframeround \@getcirc\@tempdima \fi
|
---|
1568 | \setbox\z@\hbox{%
|
---|
1569 | \begingroup
|
---|
1570 | \setbox\z@\hbox{%
|
---|
1571 | \kern-\lst@framexleftmargin
|
---|
1572 | \color@begingroup
|
---|
1573 | \ifnum#1=\z@ \lst@rulecolor \else \lst@xrulecolor \fi
|
---|
1574 | \lst@frameCornerX\llap{#2L}#3#1%
|
---|
1575 | \ifdim\lst@framediml<\@tempdimb
|
---|
1576 | \xdef\lst@framediml{\the\@tempdimb}%
|
---|
1577 | \fi
|
---|
1578 | \begingroup
|
---|
1579 | \if#4Y\else \let\lst@framerulewidth\z@ \fi
|
---|
1580 | \@tempdima\lst@framexleftmargin
|
---|
1581 | \advance\@tempdima\lst@framexrightmargin
|
---|
1582 | \advance\@tempdima\linewidth
|
---|
1583 | \vrule\@width\@tempdima\@height\lst@framerulewidth \@depth\z@
|
---|
1584 | \endgroup
|
---|
1585 | \lst@frameCornerX\rlap{#2R}#5#1%
|
---|
1586 | \ifdim\lst@framedimr<\@tempdimb
|
---|
1587 | \xdef\lst@framedimr{\the\@tempdimb}%
|
---|
1588 | \fi
|
---|
1589 | \color@endgroup}%
|
---|
1590 | \if#2T\rlap{\raise\dp\z@\box\z@}%
|
---|
1591 | \else\rlap{\lower\ht\z@\box\z@}\fi
|
---|
1592 | \endgroup
|
---|
1593 | \box\z@}}
|
---|
1594 | \gdef\lst@frameCornerX#1#2#3#4{%
|
---|
1595 | \setbox\@tempboxa\hbox{\csname\@lst @frame\if#3RR\fi #2\endcsname}%
|
---|
1596 | \@tempdimb\wd\@tempboxa
|
---|
1597 | \if #3R%
|
---|
1598 | #1{\box\@tempboxa}%
|
---|
1599 | \else
|
---|
1600 | \if #3Y\expandafter#1\else
|
---|
1601 | \@tempdimb\z@ \expandafter\vphantom \fi
|
---|
1602 | {\box\@tempboxa}%
|
---|
1603 | \fi}
|
---|
1604 | \gdef\lst@frameCalcDimA#1{%
|
---|
1605 | \@tempdima\lst@rulesep
|
---|
1606 | \advance\@tempdima\lst@framerulewidth
|
---|
1607 | \multiply\@tempdima#1\relax
|
---|
1608 | \advance\@tempdima\lst@frametextsep
|
---|
1609 | \advance\@tempdima\lst@framerulewidth
|
---|
1610 | \multiply\@tempdima\tw@}
|
---|
1611 | \lst@AddToHook{Init}{\lst@frameInit}
|
---|
1612 | \newbox\lst@framebox
|
---|
1613 | \gdef\lst@frameInit{%
|
---|
1614 | \ifx\lst@framelshape\@empty \let\lst@frameL\@empty \fi
|
---|
1615 | \ifx\lst@framershape\@empty \let\lst@frameR\@empty \fi
|
---|
1616 | \def\lst@framevrule{\vrule\@width\lst@framerulewidth\relax}%
|
---|
1617 | \lst@ifframeround
|
---|
1618 | \lst@frameCalcDimA\z@ \@getcirc\@tempdima
|
---|
1619 | \@tempdimb\@tempdima \divide\@tempdimb\tw@
|
---|
1620 | \advance\@tempdimb -\@wholewidth
|
---|
1621 | \edef\lst@frametextsep{\the\@tempdimb}%
|
---|
1622 | \edef\lst@framerulewidth{\the\@wholewidth}%
|
---|
1623 | \lst@frameCalcDimA\@ne \@getcirc\@tempdima
|
---|
1624 | \@tempdimb\@tempdima \divide\@tempdimb\tw@
|
---|
1625 | \advance\@tempdimb -\tw@\@wholewidth
|
---|
1626 | \advance\@tempdimb -\lst@frametextsep
|
---|
1627 | \edef\lst@rulesep{\the\@tempdimb}%
|
---|
1628 | \fi
|
---|
1629 | \lst@frameMakeBoxV\lst@framebox{\ht\strutbox}{\dp\strutbox}%
|
---|
1630 | \def\lst@framelr{\copy\lst@framebox}%
|
---|
1631 | \ifx\lst@frametshape\@empty\else
|
---|
1632 | \lst@frameH T\lst@frametshape
|
---|
1633 | \ifvoid\z@\else
|
---|
1634 | \par\lst@parshape
|
---|
1635 | \@tempdima-\baselineskip \advance\@tempdima\ht\z@
|
---|
1636 | \ifdim\prevdepth<\@cclvi\p@\else
|
---|
1637 | \advance\@tempdima\prevdepth
|
---|
1638 | \fi
|
---|
1639 | \ifdim\@tempdima<\z@
|
---|
1640 | \vskip\@tempdima\vskip\lineskip
|
---|
1641 | \fi
|
---|
1642 | \noindent\box\z@\par
|
---|
1643 | \lineskiplimit\maxdimen \lineskip\z@
|
---|
1644 | \fi
|
---|
1645 | \lst@frameSpreadV\lst@framextopmargin
|
---|
1646 | \fi}
|
---|
1647 | \lst@AddToHook{EveryLine}{\lst@framelr}
|
---|
1648 | \global\let\lst@framelr\@empty
|
---|
1649 | \lst@AddToHook{DeInit}
|
---|
1650 | {\ifx\lst@framebshape\@empty\else \lst@frameExit \fi}
|
---|
1651 | \gdef\lst@frameExit{%
|
---|
1652 | \lst@frameSpreadV\lst@framexbottommargin
|
---|
1653 | \lst@frameH B\lst@framebshape
|
---|
1654 | \ifvoid\z@\else
|
---|
1655 | \everypar{}\par\lst@parshape\nointerlineskip\noindent\box\z@
|
---|
1656 | \fi}
|
---|
1657 | \gdef\lst@frameSpreadV#1{%
|
---|
1658 | \ifdim\z@=#1\else
|
---|
1659 | \everypar{}\par\lst@parshape\nointerlineskip\noindent
|
---|
1660 | \lst@frameMakeBoxV\z@{#1}{\z@}%
|
---|
1661 | \box\z@
|
---|
1662 | \fi}
|
---|
1663 | \gdef\lst@frameTR{%
|
---|
1664 | \vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@
|
---|
1665 | \kern-\lst@framerulewidth
|
---|
1666 | \raise\lst@framerulewidth\hbox{%
|
---|
1667 | \vrule\@width\lst@framerulewidth\@height\z@\@depth.5\@tempdima}}
|
---|
1668 | \gdef\lst@frameBR{%
|
---|
1669 | \vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@
|
---|
1670 | \kern-\lst@framerulewidth
|
---|
1671 | \vrule\@width\lst@framerulewidth\@height.5\@tempdima\@depth\z@}
|
---|
1672 | \gdef\lst@frameBL{%
|
---|
1673 | \vrule\@width\lst@framerulewidth\@height.5\@tempdima\@depth\z@
|
---|
1674 | \kern-\lst@framerulewidth
|
---|
1675 | \vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@}
|
---|
1676 | \gdef\lst@frameTL{%
|
---|
1677 | \raise\lst@framerulewidth\hbox{%
|
---|
1678 | \vrule\@width\lst@framerulewidth\@height\z@\@depth.5\@tempdima}%
|
---|
1679 | \kern-\lst@framerulewidth
|
---|
1680 | \vrule\@width.5\@tempdima\@height\lst@framerulewidth\@depth\z@}
|
---|
1681 | \gdef\lst@frameRoundT{%
|
---|
1682 | \setbox\@tempboxa\hbox{\@circlefnt\char\@tempcnta}%
|
---|
1683 | \ht\@tempboxa\lst@framerulewidth
|
---|
1684 | \box\@tempboxa}
|
---|
1685 | \gdef\lst@frameRoundB{%
|
---|
1686 | \setbox\@tempboxa\hbox{\@circlefnt\char\@tempcnta}%
|
---|
1687 | \dp\@tempboxa\z@
|
---|
1688 | \box\@tempboxa}
|
---|
1689 | \gdef\lst@frameRTR{%
|
---|
1690 | \hb@xt@.5\@tempdima{\kern-\lst@framerulewidth
|
---|
1691 | \kern.5\@tempdima \lst@frameRoundT \hss}}
|
---|
1692 | \gdef\lst@frameRBR{%
|
---|
1693 | \hb@xt@.5\@tempdima{\kern-\lst@framerulewidth
|
---|
1694 | \advance\@tempcnta\@ne \kern.5\@tempdima \lst@frameRoundB \hss}}
|
---|
1695 | \gdef\lst@frameRBL{%
|
---|
1696 | \advance\@tempcnta\tw@ \lst@frameRoundB
|
---|
1697 | \kern-.5\@tempdima}
|
---|
1698 | \gdef\lst@frameRTL{%
|
---|
1699 | \advance\@tempcnta\thr@@\lst@frameRoundT
|
---|
1700 | \kern-.5\@tempdima}
|
---|
1701 | \lst@EndAspect
|
---|
1702 | \lst@BeginAspect[keywords]{make}
|
---|
1703 | \lst@NewMode\lst@makemode
|
---|
1704 | \lst@AddToHook{Output}{%
|
---|
1705 | \ifnum\lst@mode=\lst@makemode
|
---|
1706 | \ifx\lst@thestyle\lst@gkeywords@sty
|
---|
1707 | \lst@makekeytrue
|
---|
1708 | \fi
|
---|
1709 | \fi}
|
---|
1710 | \gdef\lst@makekeytrue{\let\lst@ifmakekey\iftrue}
|
---|
1711 | \gdef\lst@makekeyfalse{\let\lst@ifmakekey\iffalse}
|
---|
1712 | \global\lst@makekeyfalse % init
|
---|
1713 | \lst@Key{makemacrouse}f[t]{\lstKV@SetIf{#1}\lst@ifmakemacrouse}
|
---|
1714 | \gdef\lst@MakeSCT{%
|
---|
1715 | \lst@ifmakemacrouse
|
---|
1716 | \lst@ReplaceInput{$(}{%
|
---|
1717 | \lst@PrintToken
|
---|
1718 | \lst@EnterMode\lst@makemode{\lst@makekeyfalse}%
|
---|
1719 | \lst@Merge{\lst@ProcessOther\$\lst@ProcessOther(}}%
|
---|
1720 | \lst@ReplaceInput{)}{%
|
---|
1721 | \ifnum\lst@mode=\lst@makemode
|
---|
1722 | \lst@PrintToken
|
---|
1723 | \begingroup
|
---|
1724 | \lst@ProcessOther)%
|
---|
1725 | \lst@ifmakekey
|
---|
1726 | \let\lst@currstyle\lst@gkeywords@sty
|
---|
1727 | \fi
|
---|
1728 | \lst@OutputOther
|
---|
1729 | \endgroup
|
---|
1730 | \lst@LeaveMode
|
---|
1731 | \else
|
---|
1732 | \expandafter\lst@ProcessOther\expandafter)%
|
---|
1733 | \fi}%
|
---|
1734 | \else
|
---|
1735 | \lst@ReplaceInput{$(}{\lst@ProcessOther\$\lst@ProcessOther(}%
|
---|
1736 | \fi}
|
---|
1737 | \lst@EndAspect
|
---|
1738 | \lst@BeginAspect{0.21}
|
---|
1739 | \lst@Key{labelstyle}{}{\def\lst@numberstyle{#1}}
|
---|
1740 | \lst@Key{labelsep}{10pt}{\def\lst@numbersep{#1}}
|
---|
1741 | \lst@Key{labelstep}{0}{%
|
---|
1742 | \ifnum #1=\z@ \KV@lst@numbers{none}%
|
---|
1743 | \else \KV@lst@numbers{left}\fi
|
---|
1744 | \def\lst@stepnumber{#1\relax}}
|
---|
1745 | \lst@Key{firstlabel}\relax{\def\lst@firstnumber{#1\relax}}
|
---|
1746 | \lst@Key{advancelabel}\relax{\def\lst@advancenumber{#1\relax}}
|
---|
1747 | \let\c@lstlabel\c@lstnumber
|
---|
1748 | \lst@AddToHook{Init}{\def\thelstnumber{\thelstlabel}}
|
---|
1749 | \newcommand*\thelstlabel{\@arabic\c@lstlabel}
|
---|
1750 | \lst@Key{first}\relax{\def\lst@firstline{#1\relax}}
|
---|
1751 | \lst@Key{last}\relax{\def\lst@lastline{#1\relax}}
|
---|
1752 | \lst@Key{framerulewidth}{.4pt}{\def\lst@framerulewidth{#1}}
|
---|
1753 | \lst@Key{framerulesep}{2pt}{\def\lst@rulesep{#1}}
|
---|
1754 | \lst@Key{frametextsep}{3pt}{\def\lst@frametextsep{#1}}
|
---|
1755 | \lst@Key{framerulecolor}{}{\lstKV@OptArg[]{#1}%
|
---|
1756 | {\ifx\@empty##2\@empty
|
---|
1757 | \let\lst@rulecolor\@empty
|
---|
1758 | \else
|
---|
1759 | \ifx\@empty##1\@empty
|
---|
1760 | \def\lst@rulecolor{\color{##2}}%
|
---|
1761 | \else
|
---|
1762 | \def\lst@rulecolor{\color[##1]{##2}}%
|
---|
1763 | \fi
|
---|
1764 | \fi}}
|
---|
1765 | \lst@Key{backgroundcolor}{}{\lstKV@OptArg[]{#1}%
|
---|
1766 | {\ifx\@empty##2\@empty
|
---|
1767 | \let\lst@bkgcolor\@empty
|
---|
1768 | \else
|
---|
1769 | \ifx\@empty##1\@empty
|
---|
1770 | \def\lst@bkgcolor{\color{##2}}%
|
---|
1771 | \else
|
---|
1772 | \def\lst@bkgcolor{\color[##1]{##2}}%
|
---|
1773 | \fi
|
---|
1774 | \fi}}
|
---|
1775 | \lst@Key{framespread}{\z@}{\def\lst@framespread{#1}}
|
---|
1776 | \lst@AddToHook{PreInit}
|
---|
1777 | {\@tempdima\lst@framespread\relax \divide\@tempdima\tw@
|
---|
1778 | \edef\lst@framextopmargin{\the\@tempdima}%
|
---|
1779 | \let\lst@framexrightmargin\lst@framextopmargin
|
---|
1780 | \let\lst@framexbottommargin\lst@framextopmargin
|
---|
1781 | \advance\@tempdima\lst@xleftmargin\relax
|
---|
1782 | \edef\lst@framexleftmargin{\the\@tempdima}}
|
---|
1783 | \newdimen\lst@innerspread \newdimen\lst@outerspread
|
---|
1784 | \lst@Key{spread}{\z@,\z@}{\lstKV@CSTwoArg{#1}%
|
---|
1785 | {\lst@innerspread##1\relax
|
---|
1786 | \ifx\@empty##2\@empty
|
---|
1787 | \divide\lst@innerspread\tw@\relax
|
---|
1788 | \lst@outerspread\lst@innerspread
|
---|
1789 | \else
|
---|
1790 | \lst@outerspread##2\relax
|
---|
1791 | \fi}}
|
---|
1792 | \lst@AddToHook{BoxUnsafe}{\lst@outerspread\z@ \lst@innerspread\z@}
|
---|
1793 | \lst@Key{wholeline}{false}[t]{\lstKV@SetIf{#1}\lst@ifresetmargins}
|
---|
1794 | \lst@Key{indent}{\z@}{\def\lst@xleftmargin{#1}}
|
---|
1795 | \lst@AddToHook{PreInit}
|
---|
1796 | {\lst@innerspread=-\lst@innerspread
|
---|
1797 | \lst@outerspread=-\lst@outerspread
|
---|
1798 | \ifodd\c@page \advance\lst@innerspread\lst@xleftmargin
|
---|
1799 | \else \advance\lst@outerspread\lst@xleftmargin \fi
|
---|
1800 | \ifodd\c@page
|
---|
1801 | \edef\lst@xleftmargin{\the\lst@innerspread}%
|
---|
1802 | \edef\lst@xrightmargin{\the\lst@outerspread}%
|
---|
1803 | \else
|
---|
1804 | \edef\lst@xleftmargin{\the\lst@outerspread}%
|
---|
1805 | \edef\lst@xrightmargin{\the\lst@innerspread}%
|
---|
1806 | \fi}
|
---|
1807 | \lst@Key{defaultclass}\relax{\def\lst@classoffset{#1}}
|
---|
1808 | \lst@Key{stringtest}\relax{}% dummy
|
---|
1809 | \lst@Key{outputpos}\relax{\lst@outputpos#1\relax\relax}
|
---|
1810 | \lst@Key{stringspaces}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowstringspaces}
|
---|
1811 | \lst@Key{visiblespaces}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowspaces}
|
---|
1812 | \lst@Key{visibletabs}\relax[t]{\lstKV@SetIf{#1}\lst@ifshowtabs}
|
---|
1813 | \lst@EndAspect
|
---|
1814 | \lst@BeginAspect{fancyvrb}
|
---|
1815 | \@ifundefined{FancyVerbFormatLine}
|
---|
1816 | {\typeout{^^J%
|
---|
1817 | ***^^J%
|
---|
1818 | *** `listings.sty' needs `fancyvrb.sty' right now.^^J%
|
---|
1819 | *** Please ensure its availability and try again.^^J%
|
---|
1820 | ***^^J}%
|
---|
1821 | \batchmode \@@end}{}
|
---|
1822 | \gdef\lstFV@fancyvrb{%
|
---|
1823 | \lst@iffancyvrb
|
---|
1824 | \ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine\else
|
---|
1825 | \let\lstFV@FVFL\FancyVerbFormatLine
|
---|
1826 | \let\FancyVerbFormatLine\lstFV@FancyVerbFormatLine
|
---|
1827 | \fi
|
---|
1828 | \else
|
---|
1829 | \ifx\lstFV@FVFL\@undefined\else
|
---|
1830 | \let\FancyVerbFormatLine\lstFV@FVFL
|
---|
1831 | \let\lstFV@FVFL\@undefined
|
---|
1832 | \fi
|
---|
1833 | \fi}
|
---|
1834 | \gdef\lstFV@VerbatimBegin{%
|
---|
1835 | \ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine
|
---|
1836 | \lsthk@TextStyle \lsthk@BoxUnsafe
|
---|
1837 | \lsthk@PreSet
|
---|
1838 | \lst@activecharsfalse
|
---|
1839 | \let\normalbaselines\relax
|
---|
1840 | \xdef\lstFV@RestoreData{\noexpand\linewidth\the\linewidth\relax}%
|
---|
1841 | \lst@Init\relax
|
---|
1842 | \lst@ifresetmargins \advance\linewidth-\@totalleftmargin \fi
|
---|
1843 | \lstFV@RestoreData
|
---|
1844 | \everypar{}\global\lst@newlines\z@
|
---|
1845 | \lst@mode\lst@nomode \let\lst@entermodes\@empty
|
---|
1846 | \lst@InterruptModes
|
---|
1847 | %% D.G. modification begin - Nov. 25, 1998
|
---|
1848 | \let\@noligs\relax
|
---|
1849 | %% D.G. modification end
|
---|
1850 | \fi}
|
---|
1851 | \gdef\lstFV@VerbatimEnd{%
|
---|
1852 | \ifx\FancyVerbFormatLine\lstFV@FancyVerbFormatLine
|
---|
1853 | \global\setbox\lstFV@gtempboxa\box\@tempboxa
|
---|
1854 | \global\let\@gtempa\FV@ProcessLine
|
---|
1855 | \lst@mode\lst@Pmode
|
---|
1856 | \lst@DeInit
|
---|
1857 | \let\FV@ProcessLine\@gtempa
|
---|
1858 | \setbox\@tempboxa\box\lstFV@gtempboxa
|
---|
1859 | \par
|
---|
1860 | \fi}
|
---|
1861 | \newbox\lstFV@gtempboxa
|
---|
1862 | \lst@AddTo\FV@VerbatimBegin\lstFV@VerbatimBegin
|
---|
1863 | \lst@AddToAtTop\FV@VerbatimEnd\lstFV@VerbatimEnd
|
---|
1864 | \lst@AddTo\FV@LVerbatimBegin\lstFV@VerbatimBegin
|
---|
1865 | \lst@AddToAtTop\FV@LVerbatimEnd\lstFV@VerbatimEnd
|
---|
1866 | \lst@AddTo\FV@BVerbatimBegin\lstFV@VerbatimBegin
|
---|
1867 | \lst@AddToAtTop\FV@BVerbatimEnd\lstFV@VerbatimEnd
|
---|
1868 | \gdef\lstFV@FancyVerbFormatLine#1{%
|
---|
1869 | \let\lst@arg\@empty \lst@FVConvert#1\@nil
|
---|
1870 | \global\lst@newlines\z@
|
---|
1871 | \vtop{\noindent\lst@parshape
|
---|
1872 | \lst@ReenterModes
|
---|
1873 | \lst@arg \lst@PrintToken\lst@EOLUpdate\lsthk@InitVarsBOL
|
---|
1874 | \lst@InterruptModes}}
|
---|
1875 | \lst@Key{fvcmdparams}%
|
---|
1876 | {\overlay\@ne}%
|
---|
1877 | {\def\lst@FVcmdparams{,#1}}
|
---|
1878 | \lst@Key{morefvcmdparams}\relax{\lst@lAddTo\lst@FVcmdparams{,#1}}
|
---|
1879 | \gdef\lst@FVConvert{\@tempcnta\z@ \lst@FVConvertO@}%
|
---|
1880 | \gdef\lst@FVConvertO@{%
|
---|
1881 | \ifcase\@tempcnta
|
---|
1882 | \expandafter\futurelet\expandafter\@let@token
|
---|
1883 | \expandafter\lst@FVConvert@@
|
---|
1884 | \else
|
---|
1885 | \expandafter\lst@FVConvertO@a
|
---|
1886 | \fi}
|
---|
1887 | \gdef\lst@FVConvertO@a#1{%
|
---|
1888 | \lst@lAddTo\lst@arg{{#1}}\advance\@tempcnta\m@ne
|
---|
1889 | \lst@FVConvertO@}%
|
---|
1890 | \gdef\lst@FVConvert@@{%
|
---|
1891 | \ifcat\noexpand\@let@token\bgroup \expandafter\lst@FVConvertArg
|
---|
1892 | \else \expandafter\lst@FVConvert@ \fi}
|
---|
1893 | \gdef\lst@FVConvertArg#1{%
|
---|
1894 | {\let\lst@arg\@empty
|
---|
1895 | \lst@FVConvert#1\@nil
|
---|
1896 | \global\let\@gtempa\lst@arg}%
|
---|
1897 | \lst@lExtend\lst@arg{\expandafter{\@gtempa\lst@PrintToken}}%
|
---|
1898 | \lst@FVConvert}
|
---|
1899 | \gdef\lst@FVConvert@#1{%
|
---|
1900 | \ifx \@nil#1\else
|
---|
1901 | \if\relax\noexpand#1%
|
---|
1902 | \lst@lAddTo\lst@arg{\lst@OutputLostSpace\lst@PrintToken#1}%
|
---|
1903 | \else
|
---|
1904 | \lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}%
|
---|
1905 | \fi
|
---|
1906 | \expandafter\lst@FVConvert
|
---|
1907 | \fi}
|
---|
1908 | \gdef\lst@FVConvert@#1{%
|
---|
1909 | \ifx \@nil#1\else
|
---|
1910 | \if\relax\noexpand#1%
|
---|
1911 | \lst@lAddTo\lst@arg{\lst@OutputLostSpace\lst@PrintToken#1}%
|
---|
1912 | \def\lst@temp##1,#1##2,##3##4\relax{%
|
---|
1913 | \ifx##3\@empty \else \@tempcnta##2\relax \fi}%
|
---|
1914 | \expandafter\lst@temp\lst@FVcmdparams,#1\z@,\@empty\relax
|
---|
1915 | \else
|
---|
1916 | \lccode`\~=`#1\lowercase{\lst@lAddTo\lst@arg~}%
|
---|
1917 | \fi
|
---|
1918 | \expandafter\lst@FVConvertO@
|
---|
1919 | \fi}
|
---|
1920 | \lst@EndAspect
|
---|
1921 | \lst@BeginAspect[keywords,comments,strings,language]{lgrind}
|
---|
1922 | \gdef\lst@LGGetNames#1:#2\relax{%
|
---|
1923 | \lst@NormedDef\lstlang@{#1}\lst@ReplaceInArg\lstlang@{|,}%
|
---|
1924 | \def\lst@arg{:#2}}
|
---|
1925 | \gdef\lst@LGGetValue#1{%
|
---|
1926 | \lst@false
|
---|
1927 | \def\lst@temp##1:#1##2##3\relax{%
|
---|
1928 | \ifx\@empty##2\else \lst@LGGetValue@{#1}\fi}
|
---|
1929 | \expandafter\lst@temp\lst@arg:#1\@empty\relax}
|
---|
1930 | \gdef\lst@LGGetValue@#1{%
|
---|
1931 | \lst@true
|
---|
1932 | \def\lst@temp##1:#1##2:##3\relax{%
|
---|
1933 | \@ifnextchar=\lst@LGGetValue@@{\lst@LGGetValue@@=}##2\relax
|
---|
1934 | \def\lst@arg{##1:##3}}%
|
---|
1935 | \expandafter\lst@temp\lst@arg\relax}
|
---|
1936 | \gdef\lst@LGGetValue@@=#1\relax{\def\lst@LGvalue{#1}}
|
---|
1937 | \gdef\lst@LGGetComment#1#2{%
|
---|
1938 | \let#2\@empty
|
---|
1939 | \lst@LGGetValue{#1b}%
|
---|
1940 | \lst@if
|
---|
1941 | \let#2\lst@LGvalue
|
---|
1942 | \lst@LGGetValue{#1e}%
|
---|
1943 | \ifx\lst@LGvalue\lst@LGEOL
|
---|
1944 | \edef\lstlang@{\lstlang@,commentline={#2}}%
|
---|
1945 | \let#2\@empty
|
---|
1946 | \else
|
---|
1947 | \edef#2{{#2}{\lst@LGvalue}}%
|
---|
1948 | \fi
|
---|
1949 | \fi}
|
---|
1950 | \gdef\lst@LGGetString#1#2{%
|
---|
1951 | \lst@LGGetValue{#1b}%
|
---|
1952 | \lst@if
|
---|
1953 | \let#2\lst@LGvalue
|
---|
1954 | \lst@LGGetValue{#1e}%
|
---|
1955 | \ifx\lst@LGvalue\lst@LGEOL
|
---|
1956 | \edef\lstlang@{\lstlang@,morestringizer=[l]{#2}}%
|
---|
1957 | \else
|
---|
1958 | \ifx #2\lst@LGvalue
|
---|
1959 | \edef\lstlang@{\lstlang@,morestringizer=[d]{#2}}%
|
---|
1960 | \else
|
---|
1961 | \edef\lst@temp{\lst@LGe#2}%
|
---|
1962 | \ifx \lst@temp\lst@LGvalue
|
---|
1963 | \edef\lstlang@{\lstlang@,morestringizer=[b]{#2}}%
|
---|
1964 | \else
|
---|
1965 | \PackageWarning{Listings}%
|
---|
1966 | {String #2...\lst@LGvalue\space not supported}%
|
---|
1967 | \fi
|
---|
1968 | \fi
|
---|
1969 | \fi
|
---|
1970 | \fi}
|
---|
1971 | \gdef\lst@LGDefLang{%
|
---|
1972 | \lst@LGReplace
|
---|
1973 | \let\lstlang@\empty
|
---|
1974 | \lst@LGGetValue{kw}%
|
---|
1975 | \lst@if
|
---|
1976 | \lst@ReplaceInArg\lst@LGvalue{{ },}%
|
---|
1977 | \edef\lstlang@{\lstlang@,keywords={\lst@LGvalue}}%
|
---|
1978 | \fi
|
---|
1979 | \lst@LGGetValue{oc}%
|
---|
1980 | \lst@if
|
---|
1981 | \edef\lstlang@{\lstlang@,sensitive=f}%
|
---|
1982 | \fi
|
---|
1983 | \lst@LGGetValue{id}%
|
---|
1984 | \lst@if
|
---|
1985 | \edef\lstlang@{\lstlang@,alsoletter=\lst@LGvalue}%
|
---|
1986 | \fi
|
---|
1987 | \lst@LGGetComment a\lst@LGa
|
---|
1988 | \lst@LGGetComment c\lst@LGc
|
---|
1989 | \ifx\lst@LGa\@empty
|
---|
1990 | \ifx\lst@LGc\@empty\else
|
---|
1991 | \edef\lstlang@{\lstlang@,singlecomment=\lst@LGc}%
|
---|
1992 | \fi
|
---|
1993 | \else
|
---|
1994 | \ifx\lst@LGc\@empty
|
---|
1995 | \edef\lstlang@{\lstlang@,singlecomment=\lst@LGa}%
|
---|
1996 | \else
|
---|
1997 | \edef\lstlang@{\lstlang@,doublecomment=\lst@LGc\lst@LGa}%
|
---|
1998 | \fi
|
---|
1999 | \fi
|
---|
2000 | \lst@LGGetString s\lst@LGa
|
---|
2001 | \lst@LGGetString l\lst@LGa
|
---|
2002 | \lst@LGGetValue{tc}%
|
---|
2003 | \lst@if
|
---|
2004 | \edef\lstlang@{\lstlang@,lgrindef=\lst@LGvalue}%
|
---|
2005 | \fi
|
---|
2006 | \expandafter\xdef\csname\@lst LGlang@\lst@language@\endcsname
|
---|
2007 | {\noexpand\lstset{\lstlang@}}%
|
---|
2008 | \lst@ReplaceInArg\lst@arg{{: :}:}\let\lst@LGvalue\@empty
|
---|
2009 | \expandafter\lst@LGDroppedCaps\lst@arg\relax\relax
|
---|
2010 | \ifx\lst@LGvalue\@empty\else
|
---|
2011 | \PackageWarningNoLine{Listings}{Ignored capabilities for
|
---|
2012 | \space `\lst@language@' are\MessageBreak\lst@LGvalue}%
|
---|
2013 | \fi}
|
---|
2014 | \gdef\lst@LGDroppedCaps#1:#2#3{%
|
---|
2015 | \ifx#2\relax
|
---|
2016 | \lst@RemoveCommas\lst@LGvalue
|
---|
2017 | \else
|
---|
2018 | \edef\lst@LGvalue{\lst@LGvalue,#2#3}%
|
---|
2019 | \expandafter\lst@LGDroppedCaps
|
---|
2020 | \fi}
|
---|
2021 | \begingroup
|
---|
2022 | \catcode`\/=0
|
---|
2023 | \lccode`\z=`\:\lccode`\y=`\^\lccode`\x=`\$\lccode`\v=`\|
|
---|
2024 | \catcode`\\=12\relax
|
---|
2025 | /lowercase{%
|
---|
2026 | /gdef/lst@LGReplace{/lst@ReplaceInArg/lst@arg
|
---|
2027 | {{\:}{z }{\^}{y}{\$}{x}{\|}{v}{ \ }{ }{:\ :}{:}{\ }{ }{\(}({\)})}}
|
---|
2028 | /gdef/lst@LGe{\e}
|
---|
2029 | }
|
---|
2030 | /endgroup
|
---|
2031 | \gdef\lst@LGRead#1\par{%
|
---|
2032 | \lst@LGGetNames#1:\relax
|
---|
2033 | \def\lst@temp{endoflanguagedefinitions}%
|
---|
2034 | \ifx\lstlang@\lst@temp
|
---|
2035 | \let\lst@next\endinput
|
---|
2036 | \else
|
---|
2037 | \expandafter\lst@IfOneOf\lst@language@\relax\lstlang@
|
---|
2038 | {\lst@LGDefLang \let\lst@next\endinput}%
|
---|
2039 | {\let\lst@next\lst@LGRead}%
|
---|
2040 | \fi
|
---|
2041 | \lst@next}
|
---|
2042 | \lst@Key{lgrindef}\relax{%
|
---|
2043 | \lst@NormedDef\lst@language@{#1}%
|
---|
2044 | \begingroup
|
---|
2045 | \@ifundefined{lstLGlang@\lst@language@}%
|
---|
2046 | {\everypar{\lst@LGRead}%
|
---|
2047 | \catcode`\\=12\catcode`\{=12\catcode`\}=12\catcode`\%=12%
|
---|
2048 | \catcode`\#=14\catcode`\$=12\catcode`\^=12\catcode`\_=12\relax
|
---|
2049 | \input{\lstlgrindeffile}%
|
---|
2050 | }{}%
|
---|
2051 | \endgroup
|
---|
2052 | \@ifundefined{lstLGlang@\lst@language@}%
|
---|
2053 | {\PackageError{Listings}%
|
---|
2054 | {LGrind language \lst@language@\space undefined}%
|
---|
2055 | {The language is not loadable. \@ehc}}%
|
---|
2056 | {\lsthk@SetLanguage
|
---|
2057 | \csname\@lst LGlang@\lst@language@\endcsname}}
|
---|
2058 | \@ifundefined{lstlgrindeffile}
|
---|
2059 | {\lst@UserCommand\lstlgrindeffile{lgrindef.}}{}
|
---|
2060 | \lst@EndAspect
|
---|
2061 | \lst@BeginAspect[keywords]{hyper}
|
---|
2062 | \lst@Key{hyperanchor}\hyper@@anchor{\let\lst@hyperanchor#1}
|
---|
2063 | \lst@Key{hyperlink}\hyperlink{\let\lst@hyperlink#1}
|
---|
2064 | \lst@InstallKeywords{h}{hyperref}{}\relax{}
|
---|
2065 | {\begingroup
|
---|
2066 | \let\lst@UM\@empty \xdef\@gtempa{\the\lst@token}%
|
---|
2067 | \endgroup
|
---|
2068 | \lst@GetFreeMacro{lstHR@\@gtempa}%
|
---|
2069 | \global\expandafter\let\lst@freemacro\@empty
|
---|
2070 | \@tempcntb\@tempcnta \advance\@tempcntb\m@ne
|
---|
2071 | \edef\lst@alloverstyle##1{%
|
---|
2072 | \let\noexpand\lst@alloverstyle\noexpand\@empty
|
---|
2073 | \noexpand\smash{\raise\baselineskip\hbox
|
---|
2074 | {\noexpand\lst@hyperanchor{lst.\@gtempa\the\@tempcnta}%
|
---|
2075 | {\relax}}}%
|
---|
2076 | \ifnum\@tempcnta=\z@ ##1\else
|
---|
2077 | \noexpand\lst@hyperlink{lst.\@gtempa\the\@tempcntb}{##1}%
|
---|
2078 | \fi}%
|
---|
2079 | }
|
---|
2080 | od
|
---|
2081 | \lst@EndAspect
|
---|
2082 | \endinput
|
---|
2083 | %%
|
---|
2084 | %% End of file `lstmisc.sty'.
|
---|