From 02a9cfa53c8b57cb51e64019f53e2419d7ab83c6 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 1 Sep 2025 20:57:01 +0000 Subject: [PATCH] docs: add README for Perl support implementation Document the implementation status and instructions for obtaining the required tree-sitter-perl.wasm file --- .../tree-sitter/PERL_SUPPORT_README.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/services/tree-sitter/PERL_SUPPORT_README.md diff --git a/src/services/tree-sitter/PERL_SUPPORT_README.md b/src/services/tree-sitter/PERL_SUPPORT_README.md new file mode 100644 index 0000000000..3b2637b538 --- /dev/null +++ b/src/services/tree-sitter/PERL_SUPPORT_README.md @@ -0,0 +1,66 @@ +# Perl Support for Tree-sitter + +This implementation adds Perl language support to the tree-sitter codebase indexing feature. + +## Implementation Status + +✅ **Completed:** + +- Added Perl file extensions (.pl, .pm, .pod, .t) to supported extensions +- Created comprehensive Perl query patterns for tree-sitter parsing +- Added Perl language parser configuration in languageParser.ts +- Created test suite for Perl parsing +- Added sample Perl fixture for testing + +⚠️ **Pending:** + +- The `tree-sitter-perl.wasm` file needs to be added to `src/dist/` + +## Missing WASM File + +The tree-sitter-perl WASM file is not available via npm package manager and needs to be built from source. + +### How to obtain tree-sitter-perl.wasm: + +1. Clone the tree-sitter-perl repository: + + ```bash + git clone https://github.com/tree-sitter-grammars/tree-sitter-perl + ``` + +2. Build the WASM file using tree-sitter CLI: + + ```bash + cd tree-sitter-perl + npm install + npx tree-sitter build-wasm + ``` + +3. Copy the generated `tree-sitter-perl.wasm` file to `src/dist/` + +## Testing + +Once the WASM file is in place, you can run the tests: + +```bash +cd src +npx vitest run services/tree-sitter/__tests__/parseSourceCodeDefinitions.perl.spec.ts +``` + +## Supported Perl Constructs + +The implementation supports parsing of: + +- Package declarations +- Subroutine definitions (including prototypes and attributes) +- Variable declarations (my, our, local, state) +- Constants +- Use and require statements +- BEGIN, END, CHECK, INIT, UNITCHECK blocks +- AUTOLOAD and DESTROY special subroutines +- Regular expressions (match, substitution, transliteration) +- Format declarations +- Labels +- POD documentation blocks +- Anonymous subroutines +- Moose/Moo style attributes (has declarations)