MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / createPythonParser

Function createPythonParser

masfactory-visualizer/src/parser/treeSitter.ts:47–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45}
46
47export function createPythonParser(): Parser | null {
48 // `web-tree-sitter` requires `Parser.init()` before any `new Parser()` calls.
49 // So we only construct the parser after initTreeSitter() has successfully loaded the language.
50 if (!pythonLanguage) {return null;}
51
52 const parser = new Parser();
53 try {
54 parser.setLanguage(pythonLanguage);
55 } catch (err) {
56 console.error('[TreeSitter] Failed to assign Python language to parser:', err);
57 return null;
58 }
59 return parser;
60}

Callers 7

getParserMethod · 0.90
detectBuilderFunctionFunction · 0.90
parseBuilderFunctionFunction · 0.90
parseBuilderFunctionBodyFunction · 0.90
parseComponentStructureFunction · 0.90
parseTemplateStructureFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected