MCPcopy
hub / github.com/KaTeX/KaTeX / MacroContextInterface

Interface MacroContextInterface

src/defineMacro.ts:10–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8 * MacroExpander.
9 */
10export interface MacroContextInterface {
11 mode: Mode;
12
13 /**
14 * Object mapping macros to their expansions.
15 */
16 macros: Namespace<MacroDefinition>;
17
18 /**
19 * Returns the topmost token on the stack, without expanding it.
20 * Similar in behavior to TeX's `\futurelet`.
21 */
22 future(): Token;
23
24 /**
25 * Remove and return the next unexpanded token.
26 */
27 popToken(): Token;
28
29 /**
30 * Consume all following space tokens, without expansion.
31 */
32 consumeSpaces(): void;
33
34 /**
35 * Expand the next token only once if possible.
36 */
37 expandOnce(expandableOnly?: boolean): number | boolean;
38
39 /**
40 * Expand the next token only once (if possible), and return the resulting
41 * top token on the stack (without removing anything from the stack).
42 * Similar in behavior to TeX's `\expandafter\futurelet`.
43 */
44 expandAfterFuture(): Token;
45
46 /**
47 * Recursively expand first token, then return first non-expandable token.
48 */
49 expandNextToken(): Token;
50
51 /**
52 * Fully expand the given macro name and return the resulting list of
53 * tokens, or return `undefined` if no such macro is defined.
54 */
55 expandMacro(name: string): Token[] | undefined;
56
57 /**
58 * Fully expand the given macro name and return the result as a string,
59 * or return `undefined` if no such macro is defined.
60 */
61 expandMacroAsText(name: string): string | undefined;
62
63 /**
64 * Fully expand the given token stream and return the resulting list of
65 * tokens. Note that the input tokens are in reverse order, but the
66 * output tokens are in forward order.
67 */

Callers 30

macros.tsFile · 0.65
midMacroFunction · 0.65
parseSizeGroupMethod · 0.65
parseArrayFunction · 0.65
handlerFunction · 0.65
handlerFunction · 0.65
macros.tsFile · 0.65
midMacroFunction · 0.65
getRHSFunction · 0.65
handlerFunction · 0.65
macros.tsFile · 0.65
parseSizeGroupMethod · 0.65

Implementers 1

MacroExpandersrc/MacroExpander.ts

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…