MCPcopy
hub / github.com/KaTeX/KaTeX / handler

Function handler

src/functions/def.ts:68–79  ·  view source on GitHub ↗
({parser, funcName})

Source from the content-addressed store, hash-verified

66 allowedInText: true,
67
68 handler({parser, funcName}) {
69 parser.consumeSpaces();
70 const token = parser.fetch();
71 if (globalMap[token.text]) {
72 // KaTeX doesn't have \par, so ignore \long
73 if (funcName === "\\global" || funcName === "\\\\globallong") {
74 token.text = globalMap[token.text];
75 }
76 return assertNodeType(parser.parseFunction(), "internal");
77 }
78 throw new ParseError(`Invalid token after macro prefix`, token);
79 },
80});
81
82// Basic support for macro definitions: \def, \gdef, \edef, \xdef

Callers

nothing calls this directly

Calls 13

assertNodeTypeFunction · 0.90
checkControlSequenceFunction · 0.85
getRHSFunction · 0.85
letCommandFunction · 0.85
fetchMethod · 0.80
parseFunctionMethod · 0.80
setMethod · 0.80
pushTokenMethod · 0.80
consumeSpacesMethod · 0.65
popTokenMethod · 0.65
futureMethod · 0.65
consumeArgMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…