Using multiple parsers #420
-
Hello community! At the moment, there is a py-treesitter project that allows you to use python binding for the treesitter engine. I need to add a script that will allow using a specific parser from the tree-sitter-grammars or tree-sitter community for any available language, depending on the TLD of the file. For example, if we encounter a .php file, then we load the parser. https://github.com/tree-sitter/tree-sitter-php , and if we encounter a file .c then we load the parser https://github.com/tree-sitter/tree-sitter-cpp . How can I implement such logic? I would like to use python for this or at least the usual cli tree sitter. Is it necessary to build these grammars beforehand? This process is not clear. I really appreciate your help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
pip install tree-sitter tree-sitter-php tree-sitter-cpp
etc. and go to town.