MCPcopy
hub / github.com/highlightjs/highlight.js / parseRegex

Function parseRegex

test/regex/lib/util.js:97–107  ·  view source on GitHub ↗
(regex)

Source from the content-addressed store, hash-verified

95 * @returns {LiteralAST}
96 */
97const parseRegex = (regex) => {
98 const key = regex.toString();
99 let literal = astCache.get(key);
100 if (literal === undefined) {
101 const flags = parser.parseFlags(regex.flags, undefined);
102 const pattern = parser.parsePattern(regex.source, undefined, undefined, flags.unicode);
103 literal = { pattern, flags };
104 astCache.set(key, literal);
105 }
106 return literal;
107};
108
109module.exports = { BFS, regexFor, parseRegex };

Callers 1

forEachPatternFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…