MCPcopy Create free account
hub / github.com/TruthHun/BookStack / parseRegexGroup

Method parseRegexGroup

static/katex/katex.mjs:15483–15502  ·  view source on GitHub ↗

* Parses a regex-delimited group: the largest sequence of tokens * whose concatenated strings match `regex`. Returns the string * formed by the tokens plus some position information.

(regex, modeName)

Source from the content-addressed store, hash-verified

15481
15482
15483 parseRegexGroup(regex, modeName) {
15484 const outerMode = this.mode;
15485 this.mode = "text";
15486 const firstToken = this.nextToken;
15487 let lastToken = firstToken;
15488 let str = "";
15489
15490 while (this.nextToken.text !== "EOF" && regex.test(str + this.nextToken.text)) {
15491 lastToken = this.nextToken;
15492 str += lastToken.text;
15493 this.consume();
15494 }
15495
15496 if (str === "") {
15497 throw new ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken);
15498 }
15499
15500 this.mode = outerMode;
15501 return firstToken.range(lastToken, str);
15502 }
15503 /**
15504 * Parses a color description.
15505 */

Callers 3

parseSizeGroupMethod · 0.95
katex.jsFile · 0.80
katex.min.jsFile · 0.80

Calls 2

consumeMethod · 0.95
rangeMethod · 0.45

Tested by

no test coverage detected