MCPcopy Index your code
hub / github.com/TruthHun/BookStack / parseGroupOfType

Method parseGroupOfType

static/katex/katex.mjs:15369–15411  ·  view source on GitHub ↗

* Parses a group when the mode is changing.

(name, type, optional, greediness)

Source from the content-addressed store, hash-verified

15367
15368
15369 parseGroupOfType(name, type, optional, greediness) {
15370 switch (type) {
15371 case "color":
15372 return this.parseColorGroup(optional);
15373
15374 case "size":
15375 return this.parseSizeGroup(optional);
15376
15377 case "url":
15378 return this.parseUrlGroup(optional);
15379
15380 case "math":
15381 case "text":
15382 return this.parseGroup(name, optional, greediness, undefined, type);
15383
15384 case "raw":
15385 {
15386 if (optional && this.nextToken.text === "{") {
15387 return null;
15388 }
15389
15390 const token = this.parseStringGroup("raw", optional, true);
15391
15392 if (token) {
15393 return {
15394 type: "raw",
15395 mode: "text",
15396 string: token.text
15397 };
15398 } else {
15399 throw new ParseError("Expected raw group", this.nextToken);
15400 }
15401 }
15402
15403 case "original":
15404 case null:
15405 case undefined:
15406 return this.parseGroup(name, optional, greediness);
15407
15408 default:
15409 throw new ParseError("Unknown group type as " + name, this.nextToken);
15410 }
15411 }
15412
15413 consumeSpaces() {
15414 while (this.nextToken.text === " ") {

Callers 3

parseArgumentsMethod · 0.95
katex.jsFile · 0.80
katex.min.jsFile · 0.80

Calls 5

parseColorGroupMethod · 0.95
parseSizeGroupMethod · 0.95
parseUrlGroupMethod · 0.95
parseGroupMethod · 0.95
parseStringGroupMethod · 0.95

Tested by

no test coverage detected