Code Analysis
未读初始化tree-sitter
安装tree-sitter
1pip install tree-sitter
语言支持
12345# 针对要解析的语言,创建文件夹,并从github的tree-sitter仓库下载语言支持mkdir vendorcd vendorgit clone https://github.com/tree-sitter/tree-sitter-cppgit clone https://github.com/tree-sitter/tree-sitter-c
创建build文件夹
12# build于vendor是同级文件夹mkdir build
创建language_build.py,生成.so文件,该文件相当于自定义的编译器,用于解析代码生成语法树
1234567891011from tree_sitter import Language, ParserLanguage.build_library( # Store the library in the `build` directory 'my-languages.so', # Incl ...