Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 16
CRAP
0.00% covered (danger)
0.00%
0 / 1
BaseMappings
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 16
462
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 removeInstance
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getInstance
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 getEntryFromList
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 getOperatorByKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getIdentifierByKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getMacroByKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getMTenvByKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getSpecialByKey
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
20
 getCancelByKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getCharacterByKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getCustomByKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getMhChemByKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getColorByKey
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getDelimiterByKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getNullaryMacro
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2namespace MediaWiki\Extension\Math\WikiTexVC\MMLmappings;
3
4use MediaWiki\Extension\Math\WikiTexVC\MMLmappings\Lengths\MathSpace;
5use MediaWiki\Extension\Math\WikiTexVC\MMLmappings\TexConstants\Notation;
6use MediaWiki\Extension\Math\WikiTexVC\MMLmappings\TexConstants\Tag;
7use MediaWiki\Extension\Math\WikiTexVC\MMLmappings\TexConstants\TexClass;
8use MediaWiki\Extension\Math\WikiTexVC\MMLmappings\TexConstants\Variants;
9use MediaWiki\Extension\Math\WikiTexVC\MMLmappings\Util\MMLutil;
10
11/**
12 * Based on BaseMappings.js in MML3
13 * Singleton
14 */
15class BaseMappings {
16
17    private static $instance = null;
18
19    // Macro Map 'special'
20    private const SPECIAL = [
21        '{' => 'open',
22        '}' => 'close',
23        '~' => [ 'tilde', true ],
24        '^' => 'superscript',
25        '_' => 'subscript',
26        ' ' => 'space',
27        '\t' => 'space',
28        '\r' => 'space',
29        '\n' => 'space',
30        '\\' => 'prime',
31        '%' => 'comment',
32        '&' => 'entry',
33        '#' => 'hash',
34        '\u00A0' => 'space',
35        '\u2019' => 'prime'
36    ];
37
38    private const MATHCHAR0MI = [
39        "alpha" => '\u03B1',
40        "beta" => '\u03B2',
41        "gamma" => '\u03B3',
42        "delta" => '\u03B4',
43        "epsilon" => '\u03F5',
44        "zeta" => '\u03B6',
45        "eta" => '\u03B7',
46        "theta" => '\u03B8',
47        "iota" => '\u03B9',
48        "kappa" => '\u03BA',
49        "lambda" => '\u03BB',
50        "mu" => '\u03BC',
51        "nu" => '\u03BD',
52        "xi" => '\u03BE',
53        "omicron" => '\u03BF',
54        "pi" => '\u03C0',
55        "rho" => '\u03C1',
56        "sigma" => '\u03C3',
57        "tau" => '\u03C4',
58        "upsilon" => '\u03C5',
59        "phi" => '\u03D5',
60        "chi" => '\u03C7',
61        "psi" => '\u03C8',
62        "omega" => '\u03C9',
63        "varepsilon" => '\u03B5',
64        "vartheta" => '\u03D1',
65        "varpi" => '\u03D6',
66        "varrho" => '\u03F1',
67        "varsigma" => '\u03C2',
68        "varstigma" => "\u03DB",
69        "varphi" => '\u03C6',
70        // special case with \\ to distinguish from literal:
71         "\\S" => [ '\u00A7', [ "mathvariant" => Variants::NORMAL ] ],
72        "aleph" => [ '\u2135', [ "mathvariant" => Variants::NORMAL ] ],
73        "hbar" => [ '\u210F', [ Tag::ALTERNATE => "1" ] ], // actually: "variantForm" => "True"
74        "imath" => '\u0131',
75        "jmath" => '\u0237',
76        "ell" => '\u2113',
77        "wp" => [ '\u2118', [ "mathvariant" => Variants::NORMAL ] ],
78        "Re" => [ '\u211C', [ "mathvariant" => Variants::NORMAL ] ],
79        "Im" => [ '\u2111', [ "mathvariant" => Variants::NORMAL ] ],
80        "partial" => [ '\u2202', [] ], // "mathvariant" => Variants::ITALIC ] this leads to 'wrong' output
81        "infty" => [ '\u221E', [ "mathvariant" => Variants::NORMAL ] ],
82        "prime" => [ '\u2032', [ Tag::ALTERNATE => "1" ] ], // actually: "variantForm" => "True"
83        "emptyset" => [ '\u2205', [ "mathvariant" => Variants::NORMAL ] ],
84        "nabla" => [ '\u2207', [ "mathvariant" => Variants::NORMAL ] ],
85        "top" => [ '\u22A4', [ "mathvariant" => Variants::NORMAL ] ],
86        "bot" => [ '\u22A5', [ "mathvariant" => Variants::NORMAL ] ],
87        "angle" => [ '\u2220', [ "mathvariant" => Variants::NORMAL ] ],
88        "triangle" => [ '\u25B3', [ "mathvariant" => Variants::NORMAL ] ],
89        "backslash" => [ '\u2216', [ "mathvariant" => Variants::NORMAL ] ],
90        "forall" => [ '\u2200', [ "mathvariant" => Variants::NORMAL ] ],
91        "exists" => [ '\u2203', [ "mathvariant" => Variants::NORMAL ] ],
92        "neg" => [ '\u00AC', [ "mathvariant" => Variants::NORMAL ] ],
93        "lnot" => [ '\u00AC', [ "mathvariant" => Variants::NORMAL ] ],
94        "flat" => [ '\u266D', [ "mathvariant" => Variants::NORMAL ] ],
95        "natural" => [ '\u266E', [ "mathvariant" => Variants::NORMAL ] ],
96        "sharp" => [ '\u266F', [ "mathvariant" => Variants::NORMAL ] ],
97        "clubsuit" => [ '\u2663', [ "mathvariant" => Variants::NORMAL ] ],
98        "diamondsuit" => [ '\u2662', [ "mathvariant" => Variants::NORMAL ] ],
99        "heartsuit" => [ '\u2661', [ "mathvariant" => Variants::NORMAL ] ],
100        "spadesuit" => [ '\u2660', [ "mathvariant" => Variants::NORMAL ] ]
101    ];
102
103    private const MATHCHAR0MO = [
104        "-" => '\u2212', // added this additionally for running all tc
105        "surd" => '\u221A',
106        "coprod" => [ '\u2210', [ "texClass" => TexClass::OP,
107            "movesupsub" => true ] ],
108        "bigvee" => [ '\u22C1', [ "texClass" => TexClass::OP,
109            "movesupsub" => true ] ],
110        "bigwedge" => [ '\u22C0', [ "texClass" => TexClass::OP,
111            "movesupsub" => true ] ],
112        "biguplus" => [ '\u2A04', [ "texClass" => TexClass::OP,
113            "movesupsub" => true ] ],
114        "bigcap" => [ '\u22C2', [ "texClass" => TexClass::OP,
115           "movesupsub" => true ] ],
116        "bigcup" => [ '\u22C3', [ "texClass" => TexClass::OP,
117            "movesupsub" => true ] ],
118        "int" => [ '\u222B', [ "texClass" => TexClass::OP ] ],
119        "intbar" => [ '\u2A0D', [ "texClass" => TexClass::OP ] ],
120        "intBar" => [ '\u2A0E', [ "texClass" => TexClass::OP ] ],
121        "intop" => [ '\u222B', [ "texClass" => TexClass::OP,
122            "movesupsub" => true, "movablelimits" => true ] ],
123        "iint" => [ '\u222C', [ "texClass" => TexClass::OP ] ],
124        "iiint" => [ '\u222D', [ "texClass" => TexClass::OP ] ],
125        "prod" => [ '\u220F', [ "texClass" => TexClass::OP,
126            "movesupsub" => true ] ],
127        "sum" => [ '\u2211', [ "texClass" => TexClass::OP,
128            "movesupsub" => true ] ],
129        "bigotimes" => [ '\u2A02', [ "texClass" => TexClass::OP,
130            "movesupsub" => true ] ],
131        "bigoplus" => [ '\u2A01', [ "texClass" => TexClass::OP,
132            "movesupsub" => true ] ],
133        "bigodot" => [ '\u2A00', [ "texClass" => TexClass::OP,
134            "movesupsub" => true ] ],
135        "bigsqcup" => [ '\u2A06', [ "texClass" => TexClass::OP,
136            "movesupsub" => true ] ],
137        "smallint" => [ '\u222B', [ "largeop" => false ] ],
138        "triangleleft" => '\u25C3',
139        "triangleright" => '\u25B9',
140        "bigtriangleup" => '\u25B3',
141        "bigtriangledown" => '\u25BD',
142        "wedge" => '\u2227',
143        "land" => '\u2227',
144        "vee" => '\u2228',
145        "lor" => '\u2228',
146        "cap" => '\u2229',
147        "cup" => '\u222A',
148        "ddagger" => '\u2021',
149        "dagger" => '\u2020',
150        "sqcap" => '\u2293',
151        "sqcup" => '\u2294',
152        "uplus" => '\u228E',
153        "amalg" => '\u2A3F',
154        "diamond" => '\u22C4',
155        "bullet" => '\u2219',
156        "wr" => '\u2240',
157        "div" => '\u00F7',
158        "divsymbol" => '\u00F7',
159        "odot" => [ '\u2299', [ "largeop" => false ] ],
160        "oslash" => [ '\u2298', [ "largeop" => false ] ],
161        "otimes" => [ '\u2297', [ "largeop" => false ] ],
162        "ominus" => [ '\u2296', [ "largeop" => false ] ],
163        "oplus" => [ '\u2295', [ "largeop" => false ] ],
164        "mp" => '\u2213',
165        "pm" => '\u00B1',
166        "circ" => '\u2218',
167        "bigcirc" => '\u25EF',
168        "setminus" => '\u2216',
169        "cdot" => '\u22C5',
170        "ast" => '\u2217',
171        "times" => '\u00D7',
172        "star" => '\u22C6',
173        "propto" => '\u221D',
174        "sqsubseteq" => '\u2291',
175        "sqsupseteq" => '\u2292',
176        "parallel" => '\u2225',
177        "mid" => '\u2223',
178        "dashv" => '\u22A3',
179        "vdash" => '\u22A2',
180        "leq" => '\u2264',
181        "le" => '\u2264',
182        "geq" => '\u2265',
183        "ge" => '\u2265',
184        "lt" => '\u003C',
185        "gt" => '\u003E',
186        "succ" => '\u227B',
187        "prec" => '\u227A',
188        "approx" => '\u2248',
189        "succeq" => '\u2AB0',
190        "preceq" => '\u2AAF',
191        "supset" => '\u2283',
192        "subset" => '\u2282',
193        "supseteq" => '\u2287',
194        "subseteq" => '\u2286',
195        "in" => '\u2208',
196        "ni" => '\u220B',
197        "notin" => '\u2209',
198        "owns" => '\u220B',
199        "gg" => '\u226B',
200        "ll" => '\u226A',
201        "sim" => '\u223C',
202        "simeq" => '\u2243',
203        "perp" => '\u22A5',
204        "equiv" => '\u2261',
205        "asymp" => '\u224D',
206        "smile" => '\u2323',
207        "frown" => '\u2322',
208        "ne" => '\u2260',
209        "neq" => '\u2260',
210        "cong" => '\u2245',
211        "doteq" => '\u2250',
212        "bowtie" => '\u22C8',
213        "models" => '\u22A8',
214        "notChar" => '\u29F8',
215        "Leftrightarrow" => '\u21D4',
216        "Leftarrow" => '\u21D0',
217        "Rightarrow" => '\u21D2',
218        "leftrightarrow" => '\u2194',
219        "leftarrow" => '\u2190',
220        "gets" => '\u2190',
221        "rightarrow" => '\u2192',
222        "to" => [ '\u2192', [ "accent" => "false" ] ],
223        "mapsto" => [ '\u21A6', [ "stretchy" => "false" ] ], // added stretchy for tests
224        "leftharpoonup" => '\u21BC',
225        "leftharpoondown" => '\u21BD',
226        "rightharpoonup" => '\u21C0',
227        "rightharpoondown" => '\u21C1',
228        "nearrow" => '\u2197',
229        "searrow" => '\u2198',
230        "nwarrow" => '\u2196',
231        "swarrow" => '\u2199',
232        "rightleftharpoons" => '\u21CC',
233        "hookrightarrow" => '\u21AA',
234        "hookleftarrow" => '\u21A9',
235        "longleftarrow" => '\u27F5',
236        "Longleftarrow" => '\u27F8',
237        "longrightarrow" => '\u27F6',
238        "Longrightarrow" => '\u27F9',
239        "Longleftrightarrow" => '\u27FA',
240        "longleftrightarrow" => '\u27F7',
241        "longmapsto" => [ '\u27FC', [ "stretchy" => "false" ] ], // added stretchy for test
242        "ldots" => '\u2026',
243        "cdots" => '\u22EF',
244        // "cdots" => '\u2026', // fallback
245        "vdots" => '\u22EE',
246        "ddots" => '\u22F1',
247        "dotsc" => '\u2026',
248        "dotsb" => '\u22EF',
249        // "dotsb" => '\u2026', // fallback
250        "dotsm" => '\u22EF',
251        // "dotsm" => '\u2026', // fallback
252        "dotsi" => '\u22EF',
253        // "dotsi" => '\u2026', // fallback
254
255        "dotso" => '\u2026',
256        "ldotp" => [ '\u002E', [ "texClass" => TexClass::PUNCT ] ],
257        "cdotp" => [ '\u22C5', [ "texClass" => TexClass::PUNCT ] ],
258        "colon" => [ '\u003A', [ "texClass" => TexClass::PUNCT ] ]
259    ];
260
261    private const MATCHAR7 = [
262        "Gamma" => '\u0393',
263        "Delta" => '\u0394',
264        "Theta" => '\u0398',
265        "Lambda" => '\u039B',
266        "Xi" => '\u039E',
267        "Pi" => '\u03A0',
268        "Sigma" => '\u03A3',
269        "Upsilon" => '\u03A5',
270        "Phi" => '\u03A6',
271        "Psi" => '\u03A8',
272        "Omega" => '\u03A9',
273        '_' => '\u005F',
274        '#' => '\u0023',
275        '$' => '\u0024',
276        '%' => '\u0025',
277        '&' => '\u0026',
278        'And' => '\u0026'
279    ];
280
281    private const DELIMITER = [
282        '(' => [ '(', [ "stretchy" => "false" ] ], // added this additionally for running all tc
283        ')' => [ ')', [ "stretchy" => "false" ] ], // added this additionally for running all tc
284        '[' => [ '[', [ "stretchy" => "false" ] ], // added this additionally for running all tc
285        ']' => [ ']', [ "stretchy" => "false" ] ], // added this additionally for running all tc
286        '<' => '\u27E8',
287        '>' => '\u27E9',
288        '\\lt' => '\u27E8',
289        '\\gt' => '\u27E9',
290        '/' => '/',
291        '|' => [ '|', [ "texClass" => TexClass::ORD ] ],
292        '.' => '',
293        '\\\\' => '\\',
294        '\\lmoustache' => '\u23B0',
295        '\\rmoustache' => '\u23B1',
296        '\\lgroup' => '\u27EE',
297        '\\rgroup' => '\u27EF',
298        '\\arrowvert' => '\u23D0',
299        '\\Arrowvert' => '\u2016',
300        '\\bracevert' => '\u23AA',
301        '\\Vert' => [ '\u2016', [ "texClass" => TexClass::ORD ] ],
302        '\\|' => [ '\u2016', [ "texClass" => TexClass::ORD ] ],
303        '\\vert' => [ '|', [ "texClass" => TexClass::ORD ] ],
304        '\\uparrow' => '\u2191',
305        '\\downarrow' => '\u2193',
306        '\\updownarrow' => '\u2195',
307        '\\Uparrow' => '\u21D1',
308        '\\Downarrow' => '\u21D3',
309        '\\Updownarrow' => '\u21D5',
310        '\\backslash' => '\\',
311        "\\rangle" => '\u27E9',
312        '\\langle' => '\u27E8',
313        '\\rbrace' => '}',
314        '\\lbrace' => '{',
315        // added this attrs additionally for running all tc:
316        '\\}' => [ '}', [ "fence" => "false", "stretchy" => "false" ] ],
317        // added this attrs additionally for running all tc:
318        '\\{' => [ '{', [ "fence" => "false", "stretchy" => "false" ] ],
319        '\\rceil' => '\u2309',
320        '\\lceil' => '\u2308',
321        '\\rfloor' => '\u230B',
322        '\\lfloor' => '\u230A',
323        '\\lbrack' => '[',
324        '\\rbrack' => ']'
325    ];
326
327    private const MACROS = [
328        "displaystyle" => [ 'setStyle', 'D', true, 0 ],
329        "textstyle" => [ 'setStyle', 'T', false, 0 ],
330        "scriptstyle" => [ 'setStyle', 'S', false, 1 ],
331        "scriptscriptstyle" => [ 'setStyle', 'SS', false, 2 ],
332        "rm" => [ 'setFont', Variants::NORMAL ],
333        "mit" => [ 'setFont', Variants::ITALIC ],
334        "oldstyle" => [ 'setFont', Variants::OLDSTYLE ],
335        "cal" => [ 'setFont', Variants::CALLIGRAPHIC ],
336        "it" => [ 'setFont', Variants::MATHITALIC ],
337        "bf" => [ 'setFont', Variants::BOLD ],
338        "bbFont" => [ 'setFont', Variants::DOUBLESTRUCK ],
339        "scr" => [ 'setFont', Variants::SCRIPT ],
340        "frak" => [ 'setFont', Variants::FRAKTUR ],
341        "sf" => [ 'setFont', Variants::SANSSERIF ],
342        "tt" => [ 'setFont', Variants::MONOSPACE ],
343        "mathrm" => [ 'mathFont', Variants::NORMAL ],
344        "mathup" => [ 'mathFont', Variants::NORMAL ],
345        "mathnormal" => [ 'mathFont', '' ],
346        "mathbf" => [ 'mathFont', Variants::BOLD ],
347        "mathbfup" => [ 'mathFont', Variants::BOLD ],
348        "mathit" => [ 'mathFont', Variants::MATHITALIC ],
349        "mathbfit" => [ 'mathFont', Variants::BOLDITALIC ],
350        "mathbb" => [ 'mathFont', Variants::DOUBLESTRUCK ],
351        "Bbb" => [ 'mathFont', Variants::DOUBLESTRUCK ],
352        "mathfrak" => [ 'mathFont', Variants::FRAKTUR ],
353        "mathbffrak" => [ 'mathFont', Variants::BOLDFRAKTUR ],
354        "mathscr" => [ 'mathFont', Variants::SCRIPT ],
355        "mathbfscr" => [ 'mathFont', Variants::BOLDSCRIPT ],
356        "mathsf" => [ 'mathFont', Variants::SANSSERIF ],
357        "mathsfup" => [ 'mathFont', Variants::SANSSERIF ],
358        "mathbfsf" => [ 'mathFont', Variants::BOLDSANSSERIF ],
359        "mathbfsfup" => [ 'mathFont', Variants::BOLDSANSSERIF ],
360        "mathsfit" => [ 'mathFont', Variants::SANSSERIFITALIC ],
361        "mathbfsfit" => [ 'mathFont', Variants::SANSSERIFBOLDITALIC ],
362        "mathtt" => [ 'mathFont', Variants::MONOSPACE ],
363        "mathcal" => [ 'mathFont', Variants::CALLIGRAPHIC ],
364        "mathbfcal" => [ 'mathFont', Variants::BOLDCALLIGRAPHIC ],
365        "emph" => [ 'mathFont', Variants::ITALIC ], // added this specific case, toggles roman/italic fonts
366        "symrm" => [ 'mathFont', Variants::NORMAL ],
367        "symup" => [ 'mathFont', Variants::NORMAL ],
368        "symnormal" => [ 'mathFont', '' ],
369        "symbf" => [ 'mathFont', Variants::BOLD ],
370        "symbfup" => [ 'mathFont', Variants::BOLD ],
371        "symit" => [ 'mathFont', Variants::ITALIC ],
372        "symbfit" => [ 'mathFont', Variants::BOLDITALIC ],
373        "symbb" => [ 'mathFont', Variants::DOUBLESTRUCK ],
374        "symfrak" => [ 'mathFont', Variants::FRAKTUR ],
375        "symbffrak" => [ 'mathFont', Variants::BOLDFRAKTUR ],
376        "symscr" => [ 'mathFont', Variants::SCRIPT ],
377        "symbfscr" => [ 'mathFont', Variants::BOLDSCRIPT ],
378        "symsf" => [ 'mathFont', Variants::SANSSERIF ],
379        "symsfup" => [ 'mathFont', Variants::SANSSERIF ],
380        "symbfsf" => [ 'mathFont', Variants::BOLDSANSSERIF ],
381        "symbfsfup" => [ 'mathFont', Variants::BOLDSANSSERIF ],
382        "symsfit" => [ 'mathFont', Variants::SANSSERIFITALIC ],
383        "symbfsfit" => [ 'mathFont', Variants::SANSSERIFBOLDITALIC ],
384        "symtt" => [ 'mathFont', Variants::MONOSPACE ],
385        "symcal" => [ 'mathFont', Variants::CALLIGRAPHIC ],
386        "symbfcal" => [ 'mathFont', Variants::BOLDCALLIGRAPHIC ],
387        "textrm" => [ 'hBox', null, Variants::NORMAL ],
388        "textup" => [ 'hBox', null, Variants::NORMAL ],
389        "textnormal" => [ 'hBox' ],
390        "textit" => [ 'hBox', null, Variants::ITALIC ],
391        "textbf" => [ 'hBox', null, Variants::BOLD ],
392        "textsf" => [ 'hBox', null, Variants::SANSSERIF ],
393        "texttt" => [ 'hBox', null, Variants::MONOSPACE ],
394        "tiny" => [ 'SetSize', 0.5 ],
395        "Tiny" => [ 'SetSize', 0.6 ],
396        "scriptsize" => [ 'SetSize', 0.7 ],
397        "small" => [ 'SetSize', 0.85 ],
398        "normalsize" => [ 'SetSize', 1.0 ],
399        "large" => [ 'SetSize', 1.2 ],
400        "Large" => [ 'SetSize', 1.44 ],
401        "LARGE" => [ 'SetSize', 1.73 ],
402        "huge" => [ 'SetSize', 2.07 ],
403        "Huge" => [ 'SetSize', 2.49 ],
404        "arcsin" => 'namedFn',
405        "arccos" => 'namedFn',
406        "arctan" => 'namedFn',
407        "arg" => 'namedFn',
408        "cos" => 'namedFn',
409        "cosh" => 'namedFn',
410        "cot" => 'namedFn',
411        "coth" => 'namedFn',
412        "csc" => 'namedFn',
413        "deg" => 'namedFn',
414        "det" => 'namedOp',
415        "dim" => 'namedFn',
416        "exp" => 'namedFn',
417        "gcd" => 'namedOp',
418        "hom" => 'namedFn',
419        "inf" => 'namedOp',
420        "ker" => 'namedFn',
421        "lg" => 'namedFn',
422        "lim" => 'namedOp',
423        "liminf" => [ 'namedOp', 'lim inf' ],
424        "limsup" => [ 'namedOp', 'lim sup' ],
425        "ln" => 'namedFn',
426        "log" => 'namedFn',
427        "max" => 'namedOp',
428        "min" => 'namedOp',
429        "Pr" => 'namedOp',
430        "sec" => 'namedFn',
431        "sin" => 'namedFn',
432        "sinh" => 'namedFn',
433        "sup" => 'namedOp',
434        "tan" => 'namedFn',
435        "tanh" => 'namedFn',
436        "limits" => [ 'limits', 1 ],
437        "nolimits" => [ 'limits', 0 ],
438        "overline" => [ 'underOver', '203E' ],
439        "underline" => [ 'underOver', '_', null, true ],
440        "overarc" => [ 'underOver', '23DC', 1 ],
441        "overbrace" => [ 'underOver', '23DE', 1 ],
442        "underbrace" => [ 'underOver', '23DF', 1 ],
443        "overparen" => [ 'underOver', '23DC' ],
444        "underparen" => [ 'underOver', '23DD' ],
445        "overrightarrow" => [ 'underOver', '2192' ],
446        "underrightarrow" => [ 'underOver', '2192' ],
447        "overleftarrow" => [ 'underOver', '2190' ],
448        "underleftarrow" => [ 'underOver', '2190' ],
449        "overleftrightarrow" => [ 'underOver', '2194' ],
450        "underleftrightarrow" => [ 'underOver', '2194' ],
451        "overset" => 'overset',
452        "underset" => 'underset',
453        "overunderset" => 'Overunderset',
454        "stackrel" => [ 'macro', '\\mathrel{\\mathop{#2}\\limits^{#1}}', 2 ],
455        "stackbin" => [ 'macro', '\\mathbin{\\mathop{#2}\\limits^{#1}}', 2 ],
456        "over" => 'over',
457        "overwithdelims" => 'over',
458        "atop" => 'over',
459        "atopwithdelims" => 'over',
460        "above" => 'over',
461        "abovewithdelims" => 'over',
462        "brace" => [ 'over', '{', '}' ],
463        "brack" => [ 'over', '[', ']' ],
464        "choose" => [ 'over', '(', ')' ],
465        "frac" => 'frac',
466        "sqrt" => 'sqrt',
467        "root" => 'Root',
468        "uproot" => [ 'MoveRoot', 'upRoot' ],
469        "leftroot" => [ 'MoveRoot', 'leftRoot' ],
470        "left" => 'LeftRight',
471        "right" => 'LeftRight',
472        "middle" => 'LeftRight',
473        "llap" => 'lap',
474        "rlap" => 'lap',
475        "raise" => 'raiseLower',
476        "lower" => 'raiseLower',
477        "moveleft" => 'MoveLeftRight',
478        "moveright" => 'MoveLeftRight',
479        '\\,' => [ 'spacer', MathSpace::THINMATHSPACE ],
480        "\\'" => [ 'spacer', MathSpace::MEDIUMMATHSPACE ],
481        '\\>' => [ 'spacer', MathSpace::MEDIUMMATHSPACE ],
482        '\\;' => [ 'spacer', MathSpace::THICKMATHSPACE ],
483        '\\!' => [ 'spacer', MathSpace::NEGATIVETHINMATHSPACE ],
484        "enspace" => [ 'spacer', 0.5 ],
485        "quad" => [ 'spacer', 1 ],
486        "qquad" => [ 'spacer', 2 ],
487        "thinspace" => [ 'spacer', MathSpace::THINMATHSPACE ],
488        "negthinspace" => [ 'spacer', MathSpace::NEGATIVETHINMATHSPACE ],
489        "hskip" => 'hskip',
490        "hspace" => 'hskip',
491        "kern" => 'hskip',
492        "mskip" => 'hskip',
493        "mspace" => 'hskip',
494        "mkern" => 'hskip',
495        "rule" => 'rule',
496        "Rule" => [ 'Rule' ],
497        "Space" => [ 'Rule', 'blank' ],
498        "nonscript" => 'Nonscript',
499        "big" => [ 'makeBig', TexClass::ORD, 0.85 ],
500        "Big" => [ 'makeBig', TexClass::ORD, 1.15 ],
501        "bigg" => [ 'makeBig', TexClass::ORD, 1.45 ],
502        "Bigg" => [ 'makeBig', TexClass::ORD, 1.75 ],
503        "bigl" => [ 'makeBig', TexClass::OPEN, 0.85 ],
504        "Bigl" => [ 'makeBig', TexClass::OPEN, 1.15 ],
505        "biggl" => [ 'makeBig', TexClass::OPEN, 1.45 ],
506        "Biggl" => [ 'makeBig', TexClass::OPEN, 1.75 ],
507        "bigr" => [ 'makeBig', TexClass::CLOSE, 0.85 ],
508        "Bigr" => [ 'makeBig', TexClass::CLOSE, 1.15 ],
509        "biggr" => [ 'makeBig', TexClass::CLOSE, 1.45 ],
510        "Biggr" => [ 'makeBig', TexClass::CLOSE, 1.75 ],
511        "bigm" => [ 'makeBig', TexClass::REL, 0.85 ],
512        "Bigm" => [ 'makeBig', TexClass::REL, 1.15 ],
513        "biggm" => [ 'makeBig', TexClass::REL, 1.45 ],
514        "Biggm" => [ 'makeBig', TexClass::REL, 1.75 ],
515        "mathord" => [ 'TeXAtom', TexClass::ORD ],
516        "mathop" => [ 'TeXAtom', TexClass::OP ],
517        "mathopen" => [ 'TeXAtom', TexClass::OPEN ],
518        "mathclose" => [ 'TeXAtom', TexClass::CLOSE ],
519        "mathbin" => [ 'TeXAtom', TexClass::BIN ],
520        "mathrel" => [ 'TeXAtom', TexClass::REL ],
521        "mathpunct" => [ 'TeXAtom', TexClass::PUNCT ],
522        "mathinner" => [ 'TeXAtom', TexClass::INNER ],
523        "vcenter" => [ 'TeXAtom', TexClass::VCENTER ],
524        "buildrel" => 'BuildRel',
525        "hbox" => [ 'hBox', 0 ],
526        "text" => 'hBox',
527        "mbox" => [ 'hBox', 0 ],
528        "vbox" => [ 'vbox', 0 ], // added this here in addition
529        "fbox" => 'FBox',
530        "boxed" => [ 'macro', '\\fbox{$\\displaystyle{#1}$}', 1 ],
531        "framebox" => 'FrameBox',
532        "strut" => 'Strut',
533        "mathstrut" => [ 'macro', '\\vphantom{(}' ],
534        "phantom" => 'phantom',
535        "vphantom" => [ 'phantom', 1, 0 ],
536        "hphantom" => [ 'phantom', 0, 1 ],
537        "smash" => 'smash',
538        "acute" => [ 'accent', '00B4' ],
539        "grave" => [ 'accent', '0060' ],
540        "ddot" => [ 'accent', '00A8' ],
541        "tilde" => [ 'accent', '007E' ],
542        "bar" => [ 'accent', '00AF' ],
543        "breve" => [ 'accent', '02D8' ],
544        "check" => [ 'accent', '02C7' ],
545        "hat" => [ 'accent', '005E' ],
546        "vec" => [ 'accent', '2192' ],
547        "dot" => [ 'accent', '02D9' ],
548        "widetilde" => [ 'accent', '007E', 1 ],
549        "widehat" => [ 'accent', '005E', 1 ],
550        "matrix" => 'matrix',
551        "array" => 'matrix',
552        "pmatrix" => [ 'matrix', '(', ')' ],
553        "cases" => [ 'matrix', '{', '', 'left left', null, '.1em', null,
554        true ],
555        "eqalign" => [ 'matrix', null, null, 'right left',
556        "(0, lengths_js_1.em)(MathSpace::thickmathspace)", '.5em', 'D' ],
557        "displaylines" => [ 'matrix', null, null, 'center', null, '.5em', 'D' ],
558        "cr" => 'Cr',
559        "\\" => 'crLaTeX',
560        "newline" => [ 'crLaTeX', true ],
561        "hline" => [ 'hline', 'solid' ],
562        "hdashline" => [ 'hline', 'dashed' ],
563        "eqalignno" => [ 'matrix', null, null, 'right left',
564        "(0, lengths_js_1.em)(MathSpace::thickmathspace)", '.5em', 'D', null,
565        'right' ],
566        "leqalignno" => [ 'matrix', null, null, 'right left',
567        "(0, lengths_js_1.em)(MathSpace::thickmathspace)", '.5em', 'D', null,
568        'left' ],
569        "hfill" => 'HFill',
570        "hfil" => 'HFill',
571        "hfilll" => 'HFill',
572        "bmod" => [ 'macro', '\\mmlToken{mo}[lspace="0.2777777777777778em"' .
573            // "0.2777777777777778em" is equivlent to thickmathspace T320910
574            ' rspace="0.2777777777777778em"]{mod}' ],
575        "pmod" => [ 'macro', '\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}', 1 ],
576        "mod" => [ 'macro', '\\mathchoice{\\kern18mu}{\\kern12mu}' .
577            '{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1',
578        1 ],
579        "pod" => [ 'macro', '\\mathchoice{\\kern18mu}{\\kern8mu}' .
580            '{\\kern8mu}{\\kern8mu}(#1)', 1 ],
581        "iff" => [ 'macro', '\\;\\Longleftrightarrow\\;' ],
582        "skew" => [ 'macro', '{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}', 3 ],
583        "pmb" => [ 'macro', '\\rlap{#1}\\kern1px{#1}', 1 ],
584        "TeX" => [ 'macro', 'T\\kern-.14em\\lower.5ex{E}\\kern-.115em X' ],
585        "LaTeX" => [ 'macro', 'L\\kern-.325em\\raise.21em' .
586            '{\\scriptstyle{A}}\\kern-.17em\\TeX' ],
587        ' ' => [ 'macro', '\\text{ }' ],
588        "not" => 'not',
589        "dots" => 'dots',
590        "space" => 'Tilde',
591        '\u00A0' => 'Tilde',
592        "begin" => 'BeginEnd',
593        "end" => 'BeginEnd',
594        "label" => 'HandleLabel',
595        "ref" => 'HandleRef',
596        "nonumber" => 'HandleNoTag',
597        "mathchoice" => 'mathChoice',
598        "mmlToken" => 'MmlToken',
599        "intent" => 'intent'
600    ];
601
602    private const NULLARYMACROS = [
603        "AA" => "\u00C5",
604        "Coppa" => "\u03D8",
605        "Digamma" => "\u03DC",
606        "Koppa" => "\u03DE",
607        "Sampi" => "\u03E0",
608        "Stigma" => "\u03DA",
609        "coppa" => "\u03D9",
610        "euro" => "\u20AC",
611        "geneuro" => "\u20AC",
612        "geneuronarrow" => "\u20AC",
613        "geneurowide" => "\u20AC",
614        "koppa" => "\u03DF",
615        "officialeuro" => "\u20AC",
616        "sampi" => "\u03E1",
617        "stigma" => "\u03DB",
618        "textvisiblespace" => "\u2423"
619    ];
620
621    private const ENVIRONMENT = [
622        "array" => [ 'AlignedArray' ],
623        "equation" => [ 'Equation', null, true ],
624        "eqnarray" => [ 'EqnArray', null, true, true, 'rcl', null, '.5em' ]
625    ];
626
627    // Mathtools environment actually from Mathtools mappings tbd refactor
628    private const ENVIRONMNENTMT = [
629        'dcases' => [ 'array', null, '\\{', '', 'll', null, '.2em', 'D' ],
630        'rcases' => [ 'array', null, '', '\\}', 'll', null, '.2em' ],
631        'drcases' => [ 'array', null, '', '\\}', 'll', null, '.2em', 'D' ],
632        'dcases*' => [ 'Cases', null, '{', '', 'D' ],
633        'rcases*' => [ 'Cases', null, '', '}' ],
634        'drcases*' => [ 'Cases', null, '', '}', 'D' ],
635        'cases*' => [ 'Cases', null, '{', '' ],
636        'matrix*' => [ 'MtMatrix', null, null, null ],
637        'pmatrix*' => [ 'MtMatrix', null, '(', ')' ],
638        'bmatrix*' => [ 'MtMatrix', null, '[', ']' ],
639        'Bmatrix*' => [ 'MtMatrix', null, '\\{', '\\}' ],
640        'vmatrix*' => [ 'MtMatrix', null, '\\vert', '\\vert' ],
641        'Vmatrix*' => [ 'MtMatrix', null, '\\Vert', '\\Vert' ],
642        'smallmatrix*' => [ 'MtSmallMatrix', null, null, null ],
643        'psmallmatrix' => [ 'MtSmallMatrix', null, '(', ')', 'c' ],
644        'psmallmatrix*' => [ 'MtSmallMatrix', null, '(', ')' ],
645        'bsmallmatrix' => [ 'MtSmallMatrix', null, '[', ']', 'c' ],
646        'bsmallmatrix*' => [ 'MtSmallMatrix', null, '[', ']' ],
647        'Bsmallmatrix' => [ 'MtSmallMatrix', null, '\\{', '\\}', 'c' ],
648        'Bsmallmatrix*' => [ 'MtSmallMatrix', null, '\\{', '\\}' ],
649        'vsmallmatrix' => [ 'MtSmallMatrix', null, '\\vert', '\\vert', 'c' ],
650        'vsmallmatrix*' => [ 'MtSmallMatrix', null, '\\vert', '\\vert' ],
651        'Vsmallmatrix' => [ 'MtSmallMatrix', null, '\\Vert', '\\Vert', 'c' ],
652        'Vsmallmatrix*' => [ 'MtSmallMatrix', null, '\\Vert', '\\Vert' ],
653        'crampedsubarray' => [ 'array', null, null, null, null, '0em', '0.1em', 'S\'', 1 ],
654        'multlined' => 'MtMultlined',
655        'spreadlines' => [ 'SpreadLines', true ],
656        'lgathered' => [ 'amsEqnArray', null, null, null, 'l', null, '.5em', 'D' ],
657        'rgathered' => [ 'amsEqnArray', null, null, null, 'r', null, '.5em', 'D' ],
658    ];
659
660    private const COLORS = [
661        'Apricot' => '#FBB982',
662        'Aquamarine' => '#00B5BE',
663        'Bittersweet' => '#C04F17',
664        'Black' => '#221E1F',
665        'Blue' => '#2D2F92',
666        'BlueGreen' => '#00B3B8',
667        'BlueViolet' => '#473992',
668        'BrickRed' => '#B6321C',
669        'Brown' => '#792500',
670        'BurntOrange' => '#F7921D',
671        'CadetBlue' => '#74729A',
672        'CarnationPink' => '#F282B4',
673        'Cerulean' => '#00A2E3',
674        'CornflowerBlue' => '#41B0E4',
675        'Cyan' => '#00AEEF',
676        'Dandelion' => '#FDBC42',
677        'DarkOrchid' => '#A4538A',
678        'Emerald' => '#00A99D',
679        'ForestGreen' => '#009B55',
680        'Fuchsia' => '#8C368C',
681        'Goldenrod' => '#FFDF42',
682        'Gray' => '#949698',
683        'Green' => '#00A64F',
684        'GreenYellow' => '#DFE674',
685        'JungleGreen' => '#00A99A',
686        'Lavender' => '#F49EC4',
687        'LimeGreen' => '#8DC73E',
688        'Magenta' => '#EC008C',
689        'Mahogany' => '#A9341F',
690        'Maroon' => '#AF3235',
691        'Melon' => '#F89E7B',
692        'MidnightBlue' => '#006795',
693        'Mulberry' => '#A93C93',
694        'NavyBlue' => '#006EB8',
695        'OliveGreen' => '#3C8031',
696        'Orange' => '#F58137',
697        'OrangeRed' => '#ED135A',
698        'Orchid' => '#AF72B0',
699        'Peach' => '#F7965A',
700        'Periwinkle' => '#7977B8',
701        'PineGreen' => '#008B72',
702        'Plum' => '#92268F',
703        'ProcessBlue' => '#00B0F0',
704        'Purple' => '#99479B',
705        'RawSienna' => '#974006',
706        'Red' => '#ED1B23',
707        'RedOrange' => '#F26035',
708        'RedViolet' => '#A1246B',
709        'Rhodamine' => '#EF559F',
710        'RoyalBlue' => '#0071BC',
711        'RoyalPurple' => '#613F99',
712        'RubineRed' => '#ED017D',
713        'Salmon' => '#F69289',
714        'SeaGreen' => '#3FBC9D',
715        'Sepia' => '#671800',
716        'SkyBlue' => '#46C5DD',
717        'SpringGreen' => '#C6DC67',
718        'Tan' => '#DA9D76',
719        'TealBlue' => '#00AEB3',
720        'Thistle' => '#D883B7',
721        'Turquoise' => '#00B4CE',
722        'Violet' => '#58429B',
723        'VioletRed' => '#EF58A0',
724        'White' => '#FFFFFF',
725        'WildStrawberry' => '#EE2967',
726        'Yellow' => '#FFF200',
727        'YellowGreen' => '#98CC70',
728        'YellowOrange' => '#FAA21A',
729    ];
730
731    // This is from cancelConfiguration.js
732    private const CANCEL = [
733        "cancel" => [ 'cancel', Notation::UPDIAGONALSTRIKE ],
734        "bcancel" => [ 'cancel', Notation::DOWNDIAGONALSTRIKE ],
735        "xcancel" => [ 'cancel', Notation::UPDIAGONALSTRIKE . ' ' .
736            Notation::DOWNDIAGONALSTRIKE ],
737        "cancelto" => [ 'cancelTo', Notation::UPDIAGONALSTRIKE . " " . Notation::UPDIAGONALARROW .
738            " " . Notation::NORTHEASTARROW ]
739    ];
740    // They are currently from mhchemConfiguration.js
741    private const MHCHEM = [
742        "ce" => [ 'machine', 'ce' ],
743        "pu" => [ 'machine', 'pu' ],
744        "longrightleftharpoons" => [
745            'macro',
746            '\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}'
747        ],
748        "longRightleftharpoons" => [
749            'macro',
750            '\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{\\leftharpoondown}}'
751        ],
752        "longLeftrightharpoons" => [
753            'macro',
754            '\\stackrel{\\textstyle\\vphantom{{-}}{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}'
755        ],
756        "longleftrightarrows" => [
757            'macro',
758            '\\stackrel{\\longrightarrow}{\\smash{\\longleftarrow}\\Rule{0px}{.25em}{0px}}'
759        ],
760        "tripledash" => [
761            'macro',
762            '\\vphantom{-}\\raise{2mu}\\\kern{2mu}\\tiny\\text{-}\\kern{1mu}\\text{-}\\kern{1mu}\\text{-}\\kern{2mu}}'
763        ],
764        "xleftrightarrow" => [ 'xArrow', 0x2194, 6, 6 ],
765        "xrightleftharpoons" => [ 'xArrow', 0x21CC, 5, 7 ],
766        "xRightleftharpoons" => [ 'xArrow', 0x21CC, 5, 7 ],
767        "xLeftrightharpoons" => [ 'xArrow', 0x21CC, 5, 7 ],
768
769        "bond" => [ "chemCustom", "\\bond" ],
770    ];
771    // These are some mappings which are created customly for this
772    private const CUSTOM = [
773        "boldsymbol" => [ 'boldsymbol', '' ], // see boldsymbolConfiguration.js
774        "oint" => [ 'oint', '\u222E', [ "texClass" => TexClass::OP ] ],
775        "oiint" => [ 'oint', '\u222F', [ "texClass" => TexClass::OP ] ],
776        "oiiint" => [ 'oint', '\u2230', [ "texClass" => TexClass::OP ] ],
777        "ointctrclockwise" => [ 'oint', '\u2233', [ "texClass" => TexClass::OP ] ],
778        "varointclockwise" => [ 'oint', '\u2232', [ "texClass" => TexClass::OP ] ],
779        "\\P" => [ 'oint', '\u00B6', [ "texClass" => TexClass::OP ] ],
780        'textvisiblespace' => [ 'Insert', '\u2423' ], // From TextCompMappings.js (only makro it seems)
781        "Alpha" => [ 'customLetters', "A" ],
782        "Beta" => [ 'customLetters', "B" ],
783        "Chi" => [ 'customLetters', "X" ],
784        "Epsilon" => [ 'customLetters', "E" ],
785        "Eta" => [ 'customLetters', "H" ],
786        "Iota" => [ 'customLetters', "I" ],
787        "Kappa" => [ 'customLetters', "K" ],
788        "Mu" => [ 'customLetters', "M" ],
789        "Nu" => [ 'customLetters', "N" ],
790        "Omicron" => [ 'customLetters', "O" ],
791        "Rho" => [ 'customLetters', "P" ],
792        "Tau" => [ 'customLetters', "T" ],
793        "Zeta" => [ 'customLetters', "Z" ],
794        "ca" => [ "customLetters", "&#x223C;", true ]
795    ];
796
797    private const ALL = [
798        "special" => self::SPECIAL,
799        "macros" => self::MACROS,
800        "delimiter" => self::DELIMITER,
801        "mathchar7" => self::MATCHAR7,
802        "mathchar0mi" => self::MATHCHAR0MI,
803        "mathchar0mo" => self::MATHCHAR0MO,
804        "environment" => self::ENVIRONMENT,
805        "environmentMT" => self::ENVIRONMNENTMT,
806        "colors" => self::COLORS,
807        "cancel" => self::CANCEL,
808        "mhchem" => self::MHCHEM,
809        "custom" => self::CUSTOM
810    ];
811
812    private function __construct() {
813        // Just an empty private constructor, for singleton pattern
814    }
815
816    public static function removeInstance() {
817        self::$instance = null;
818    }
819
820    public static function getInstance() {
821        if ( self::$instance == null ) {
822            self::$instance = new BaseMappings();
823        }
824
825        return self::$instance;
826    }
827
828    public static function getEntryFromList( $keylist, $key ) {
829        if ( isset( self::ALL[$keylist][$key] ) ) {
830            return self::ALL[$keylist][$key];
831        }
832        return null;
833    }
834
835    public static function getOperatorByKey( $key ) {
836        return MMLutil::getMappingByKey( $key, self::MATHCHAR0MO, true );
837    }
838
839    public static function getIdentifierByKey( $key ) {
840        return MMLutil::getMappingByKey( $key, self::MATHCHAR0MI, true );
841    }
842
843    public static function getMacroByKey( $key ) {
844        return MMLutil::getMappingByKeySimple( $key, self::MACROS );
845    }
846
847    public static function getMTenvByKey( $key ) {
848        return MMLutil::getMappingByKeySimple( $key, self::ENVIRONMNENTMT );
849    }
850
851    public static function getSpecialByKey( $key ) {
852        $ret = MMLutil::getMappingByKeySimple( $key, self::SPECIAL );
853        // Only activated elements get found in this mapping currently.
854        if ( is_array( $ret ) && count( $ret ) >= 2 && $ret[1] ) {
855            return $ret;
856        }
857        return null;
858    }
859
860    public static function getCancelByKey( $key ) {
861        return MMLutil::getMappingByKeySimple( $key, self::CANCEL );
862    }
863
864    public static function getCharacterByKey( $key ) {
865        return MMLutil::getMappingByKeySimple( $key, self::MATCHAR7 );
866    }
867
868    public static function getCustomByKey( $key ) {
869        return MMLutil::getMappingByKeySimple( $key, self::CUSTOM );
870    }
871
872    public static function getMhChemByKey( $key ) {
873        return MMLutil::getMappingByKeySimple( $key, self::MHCHEM );
874    }
875
876    public static function getColorByKey( $key ) {
877        // Cast to uppercase first letter since mapping is structured that way.
878        $key = ucfirst( $key );
879        return MMLutil::getMappingByKey( $key, self::COLORS );
880    }
881
882    public static function getDelimiterByKey( $key ) {
883        return MMLutil::getMappingByKey( $key, self::DELIMITER, true );
884    }
885
886    public static function getNullaryMacro( $key ) {
887        return MMLutil::getMappingByKey( $key, self::NULLARYMACROS, true );
888    }
889}