s-system-syntax.mkxl /size: 11 Kb    last modification: 2024-01-16 10:22
1%D \module
2%D   [       file=s-system-syntax,
3%D        version=2023.8.18,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=\LUAMETATEX\ Syntax,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14% \futureexpandis
15% \futureexpandisap
16
17\registerctxluafile{s-system-syntax}{}
18
19\definehead
20  [Syntax]
21  [subsubsubsection]
22  [style=\tta\bf,
23   numberwidth=2fs,
24   after=\blank\startpacked,
25   aftersection=\stoppacked]
26
27\definenarrower[Arguments][left=4fs]
28
29\definedescription
30  [Primitive]
31  [headstyle=\ttbf,
32   width=fit,
33   alternative=top,
34   align={broad,flushleft,verytolerant},
35   inbetween=\startnarrower[2*left],
36   after=\stopnarrower]
37
38\definestartstop [SyntaxToken]       [style=\ttsl]
39\definestartstop [SyntaxTokens]      [style=\ttsl]
40\definestartstop [SyntaxInteger]     [style=\ttsl]
41\definestartstop [SyntaxDimension]   [style=\ttsl]
42\definestartstop [SyntaxGlue]        [style=\ttsl]
43\definestartstop [SyntaxMuglue]      [style=\ttsl]
44\definestartstop [SyntaxFloat]       [style=\ttsl]
45\definestartstop [SyntaxQuantity]    [style=\ttsl]
46\definestartstop [SyntaxPreamble]    [style=\ttsl]
47\definestartstop [SyntaxCharacter]   [style=\ttsl]
48\definestartstop [SyntaxChar]        [style=\ttsl]
49\definestartstop [SyntaxFont]        [style=\ttsl]
50\definestartstop [SyntaxMathstyle]   [style=\ttsl]
51\definestartstop [SyntaxTokenlist]   [style=\ttsl]
52\definestartstop [SyntaxCs]          [style=\tt,left=\texescape]
53\definestartstop [SyntaxBox]         [style=\ttsl]
54\definestartstop [SyntaxRule]        [style=\ttsl]
55\definestartstop [SyntaxToks]        [style=\ttsl]
56\definestartstop [SyntaxConditional] [style=\tt]
57
58\protected\def\SyntaxGlyph#1{{\ttbf\glyph raise -.25ex yscale 1440 #1}}
59
60\protected\def\SyntaxLeftBracket      {\SyntaxGlyph\leftbracketasciicode\thinspace}
61\protected\def\SyntaxLeftBrace        {\SyntaxGlyph\leftbraceasciicode\thinspace}
62\protected\def\SyntaxLeftParenthesis  {\SyntaxGlyph\leftparentasciicode\thinspace}
63\protected\def\SyntaxRightBracket     {\thinspace\SyntaxGlyph\rightbracketasciicode}
64\protected\def\SyntaxRightBrace       {\thinspace\SyntaxGlyph\rightbraceasciicode}
65\protected\def\SyntaxRightParenthesis {\thinspace\SyntaxGlyph\rightparentasciicode}
66\protected\def\SyntaxBar              {\thinspace\SyntaxGlyph\barasciicode\thinspace}
67
68\startbuffer[engine:syntax:preambleparameters]
69\starttabulate[|c|||]
70\NC \type{#n} \NC parameter                                   \NC index \type{1} upto \type{E} \NC \NR
71\TB
72\NC \type{#0} \NC throw away parameter                        \NC increment index              \NC \NR
73\NC \type{#-} \NC ignore parameter                            \NC keep index                   \NC \NR
74\TB
75\NC \type{#*} \NC gobble white space                          \NC                              \NC \NR
76\NC \type{#+} \NC keep (honor) the braces                     \NC                              \NC \NR
77\NC \type{#.} \NC ignore pars and spaces                      \NC                              \NC \NR
78\NC \type{#,} \NC push back space when no match               \NC                              \NC \NR
79\NC \type{#/} \NC remove leading and trailing spaces and pars \NC                              \NC \NR
80\NC \type{#=} \NC braces are mandate                          \NC                              \NC \NR
81\NC \type{#^} \NC keep leading spaces                         \NC                              \NC \NR
82\NC \type{#_} \NC braces are mandate and kept (obey)          \NC                              \NC \NR
83\TB
84\NC \type{#@} \NC par delimiter                               \NC only for internal usage      \NC \NR
85\TB
86\NC \type{#:} \NC pick up scanning here                       \NC                              \NC \NR
87\NC \type{#;} \NC quit scanning                               \NC                              \NC \NR
88\TB
89\NC \type{#L} \NC left delimiter token                        \NC followed by token            \NC \NR
90\NC \type{#R} \NC right delimiter token                       \NC followed by token            \NC \NR
91\TB
92\NC \type{#G} \NC gobble token                                \NC followed by token            \NC \NR
93\NC \type{#M} \NC gobble token and spaces                     \NC followed by token            \NC \NR
94\TB
95\NC \type{#S} \NC nest square brackets                        \NC only inner pairs             \NC \NR
96\NC \type{#X} \NC nest angle brackets                         \NC only inner pairs             \NC \NR
97\NC \type{#P} \NC nest parentheses                            \NC only inner pairs             \NC \NR
98\stoptabulate
99\stopbuffer
100
101\startbuffer[engine:syntax:bodyparameters]
102\starttabulate[|l|||]
103\NC \type{#n} \NC parameter            \NC index \type{1} upto \type{E} in macro body \NC \NR
104\TB
105\NC \type{#I} \NC current iterator     \NC \type {\currentloopiterator}    \NC \NR
106\NC \type{#P} \NC parent iterator      \NC \type {\previousloopiterator 1} \NC \NR
107\NC \type{#G} \NC grandparent iterator \NC \type {\previousloopiterator 2} \NC \NR
108\TB
109\NC \type{#H} \NC hash escape          \NC \type {#}  \NC \NR
110\NC \type{#S} \NC space escape         \NC \ruledhbox to  \interwordspace{\novrule height .8\strutht} \NC \NR
111\NC \type{#T} \NC tab escape           \NC \type {\t} \NC \NR
112\NC \type{#L} \NC newline escape       \NC \type {\n} \NC \NR
113\NC \type{#R} \NC return escape        \NC \type {\r} \NC \NR
114\NC \type{#X} \NC backslash escape     \NC \tex  {}   \NC \NR
115\TB
116\NC \type{#N} \NC nbsp    \NC \type {U+00A0} (under consideration) \NC \NR
117%NC \type{#Z} \NC zwj     \NC \type {U+200B} (under consideration) \NC \NR
118%NC \type{#-} \NC zwnj    \NC \type {U+200C} (under consideration) \NC \NR
119%NC \type{#+} \NC zwj     \NC \type {U+200D} (under consideration) \NC \NR
120%NC \type{#>} \NC l2r     \NC \type {U+200E} (under consideration) \NC \NR
121%NC \type{#<} \NC r2l     \NC \type {U+200F} (under consideration) \NC \NR
122%NC \type{#U} \NC unicode \NC \type {XXXXXX} (under consideration) \NC \NR
123\stoptabulate
124\stopbuffer
125
126\startbuffer[engine:syntax:glyphoptions]
127    \ctxlua{moduledata.engine.codes("glyphoptioncodes")}
128\stopbuffer
129
130\startbuffer[engine:syntax:mathoptions]
131    \ctxlua{moduledata.engine.codes("mathoptioncodes")}
132\stopbuffer
133
134\startbuffer[engine:syntax:mathcontrol]
135    \ctxlua{moduledata.engine.codes("mathcontrolcodes")}
136\stopbuffer
137
138\startbuffer[engine:syntax:partriggercodes]
139    \ctxlua{moduledata.engine.codes("partriggercodes")}
140\stopbuffer
141
142\startbuffer[engine:syntax:parcontextcodes]
143    \ctxlua{moduledata.engine.codes("parcontextcodes")}
144\stopbuffer
145
146\startbuffer[engine:syntax:frozenparcodes]
147    \ctxlua{moduledata.engine.codes("frozenparcodes")}
148\stopbuffer
149
150\startbuffer[engine:syntax:frozenparcodes]
151    \ctxlua{moduledata.engine.codes("frozenparcodes")}
152\stopbuffer
153
154\startbuffer[engine:syntax:normalizelinecodes]
155    \ctxlua{moduledata.engine.codes("normalizelinecodes")}
156\stopbuffer
157
158\startbuffer[engine:syntax:normalizeparcodes]
159    \ctxlua{moduledata.engine.codes("normalizeparcodes")}
160\stopbuffer
161
162\startbuffer[engine:syntax:listgeometrycodes]
163    \ctxlua{moduledata.engine.codes("listgeometrycodes")}
164\stopbuffer
165
166\startbuffer[engine:syntax:protrusionboundarycodes]
167    \ctxlua{moduledata.engine.codes("protrusionboundarycodes")}
168\stopbuffer
169
170\startbuffer[engine:syntax:shapingpenaltiescodes]
171    \ctxlua{moduledata.engine.codes("shapingpenaltiescodes")}
172\stopbuffer
173
174\startbuffer[engine:syntax:automigrationcodes]
175    \ctxlua{moduledata.engine.codes("automigrationcodes")}
176\stopbuffer
177
178\startbuffer[engine:syntax:autoparagraphcodes]
179    \ctxlua{moduledata.engine.codes("autoparagraphcodes")}
180\stopbuffer
181
182\startbuffer[engine:syntax:textcontrolcodes]
183    \ctxlua{moduledata.engine.codes(tex.gettextcontrolvalues())}
184\stopbuffer
185
186\startbuffer[engine:syntax:discoptioncodes]
187    \ctxlua{moduledata.engine.codes("discoptioncodes")}
188\stopbuffer
189
190\startbuffer[engine:syntax:mathgluecodes]
191    \ctxlua{moduledata.engine.codes(tex.getmathgluevalues())}
192\stopbuffer
193
194\continueifinputfile{s-system-syntax.mkxl}
195
196\usemodule[abbreviations-logos]
197\usemodule[system-tokens]
198
199\setupbodyfont
200  [dejavu,10pt]
201
202\setuplayout
203  [tight]
204
205\starttext
206
207\starttitle[title=Primitives]
208
209This is a preliminary overview of the \LUAMETATEX\ primitives. The presentation
210is mostly for myself and kind of informal. The primitives are describes in more
211detail in the (yet incomplete) \quote {primitives} manual.
212
213\vkern\lineheight % bah, I need to fix this : \pagediscards
214
215\startpagecolumns[page=no]
216    \startluacode
217        moduledata.engine.allspecifications()
218    \stopluacode
219\stoppagecolumns
220
221\stoptitle
222
223\starttitle[title=Registers]
224
225Currently we have these upper bounds for the register but they can be lowered
226because we don't need that many.
227
228\starttabulate[||||]
229\NC count      \NC integer   \NC \cldcontext{tex.magicconstants.max_integer_register_index}   \NC \NR
230\NC dimen      \NC dimension \NC \cldcontext{tex.magicconstants.max_dimension_register_index} \NC \NR
231\NC skip       \NC glue      \NC \cldcontext{tex.magicconstants.max_glue_register_index}      \NC \NR
232\NC muskip     \NC glue      \NC \cldcontext{tex.magicconstants.max_muglue_register_index}    \NC \NR
233\NC attribute  \NC integer   \NC \cldcontext{tex.magicconstants.max_attribute_register_index} \NC \NR
234\NC toks       \NC tokenlist \NC \cldcontext{tex.magicconstants.max_toks_register_index}      \NC \NR
235\NC box        \NC box       \NC \cldcontext{tex.magicconstants.max_box_register_index}       \NC \NR
236\NC float      \NC posit     \NC \cldcontext{tex.magicconstants.max_float_register_index}     \NC \NR
237\stoptabulate
238
239\stoptitle
240
241\starttitle[title=Preamble and escapes]
242
243These parameter specifiers can end up in preambles:
244
245\getbuffer[engine:syntax:preambleparameters]
246
247These parameter escapes can end up in bodies and text:
248
249\getbuffer[engine:syntax:bodyparameters]
250
251\stoptitle
252
253\starttitle[title=Comparing values]
254
255The following tokens can be used in a comparison:
256
257\startluacode
258    context.starttabulate { "|c||" }
259    for k, v in table.sortedhash(moduledata.engine.compares) do
260        context.NC() context.formatted.type("%C",k) context.NC() context(v) context.NC() context.NR()
261    end
262    context.stoptabulate()
263\stopluacode
264
265\stoptitle
266
267% test:
268
269% \def \foo{test#Itest} \writestatus{I}{\foo} \meaning \foo \par  \showluatokens\foo
270% \def \foo{test#Ptest} \writestatus{P}{\foo} \meaning \foo \par  \showluatokens\foo
271% \def \foo{test#Gtest} \writestatus{G}{\foo} \meaning \foo \par  \showluatokens\foo
272% \def \foo{test#Htest} \writestatus{H}{\foo} \meaning \foo \par  \showluatokens\foo
273% \def \foo{test#Stest} \writestatus{S}{\foo} \meaning \foo \par  \showluatokens\foo
274% \def \foo{test#Ttest} \writestatus{T}{\foo} \meaning \foo \par  \showluatokens\foo
275% \def \foo{test#Ltest} \writestatus{L}{\foo} \meaning \foo \par  \showluatokens\foo
276% \def \foo{test#Rtest} \writestatus{R}{\foo} \meaning \foo \par  \showluatokens\foo
277% \def \foo{test#Xtest} \writestatus{X}{\foo} \meaning \foo \par  \showluatokens\foo
278
279% \edef\foo{test#Itest} \writestatus{I}{\foo} \meaning \foo \par  \showluatokens\foo
280% \edef\foo{test#Ptest} \writestatus{P}{\foo} \meaning \foo \par  \showluatokens\foo
281% \edef\foo{test#Gtest} \writestatus{G}{\foo} \meaning \foo \par  \showluatokens\foo
282% \edef\foo{test#Htest} \writestatus{H}{\foo} \meaning \foo \par  \showluatokens\foo
283% \edef\foo{test#Stest} \writestatus{S}{\foo} \meaning \foo \par  \showluatokens\foo
284% \edef\foo{test#Ttest} \writestatus{T}{\foo} \meaning \foo \par  \showluatokens\foo
285% \edef\foo{test#Ltest} \writestatus{L}{\foo} \meaning \foo \par  \showluatokens\foo
286% \edef\foo{test#Rtest} \writestatus{R}{\foo} \meaning \foo \par  \showluatokens\foo
287% \edef\foo{test#Xtest} \writestatus{X}{\foo} \meaning \foo \par  \showluatokens\foo
288
289\stoptext
290