"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initializeParser = initializeParser;
const web_tree_sitter_1 = require("web-tree-sitter");
const parsers = new Map();
async function initializeParser(grammarPath) {
    if (parsers.has(grammarPath)) {
        return parsers.get(grammarPath);
    }
    await web_tree_sitter_1.Parser.init();
    const newParser = new web_tree_sitter_1.Parser();
    const language = await web_tree_sitter_1.Language.load(grammarPath);
    newParser.setLanguage(language);
    parsers.set(grammarPath, newParser);
    return newParser;
}
//# sourceMappingURL=parser.js.map