TreasureTrails/node_modules/chevrotain/lib/src/scan/reg_exp_parser.js
2026-03-18 09:02:21 -05:00

23 lines
No EOL
788 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.clearRegExpParserCache = exports.getRegExpAst = void 0;
var regexp_to_ast_1 = require("regexp-to-ast");
var regExpAstCache = {};
var regExpParser = new regexp_to_ast_1.RegExpParser();
function getRegExpAst(regExp) {
var regExpStr = regExp.toString();
if (regExpAstCache.hasOwnProperty(regExpStr)) {
return regExpAstCache[regExpStr];
}
else {
var regExpAst = regExpParser.pattern(regExpStr);
regExpAstCache[regExpStr] = regExpAst;
return regExpAst;
}
}
exports.getRegExpAst = getRegExpAst;
function clearRegExpParserCache() {
regExpAstCache = {};
}
exports.clearRegExpParserCache = clearRegExpParserCache;
//# sourceMappingURL=reg_exp_parser.js.map