MCPcopy Create free account
hub / github.com/KaTeX/KaTeX / parseStringGroup

Method parseStringGroup

src/Parser.ts:630–646  ·  view source on GitHub ↗

* Parses a group, essentially returning the string formed by the * brace-enclosed tokens plus some position information.

(
        optional: boolean,
    )

Source from the content-addressed store, hash-verified

628 * brace-enclosed tokens plus some position information.
629 */
630 parseStringGroup(
631 optional: boolean,
632 ): Token | null {
633 const argToken = this.gullet.scanArgument(optional);
634 if (argToken == null) {
635 return null;
636 }
637 let str = "";
638 let nextToken: Token;
639 while ((nextToken = this.fetch()).text !== "EOF") {
640 str += nextToken.text;
641 this.consume();
642 }
643 this.consume(); // consume the end of the argument
644 argToken.text = str;
645 return argToken;
646 }
647
648 /**
649 * Parses a regex-delimited group: the largest sequence of tokens

Callers 4

parseGroupOfTypeMethod · 0.95
parseColorGroupMethod · 0.95
parseSizeGroupMethod · 0.95
parseUrlGroupMethod · 0.95

Calls 3

fetchMethod · 0.95
consumeMethod · 0.95
scanArgumentMethod · 0.80

Tested by

no test coverage detected