Skip to main content

Perl grammar for tree-sitter

Project description

tree-sitter-perl

A tree-sitter grammar for Perl. Maintained at https://github.com/tree-sitter-perl/tree-sitter-perl

Installation

Package managers

# npm
npm install tree-sitter-perl

# cargo
cargo add ts-parser-perl

# pip
pip install tree-sitter-perl

Neovim

A version of this parser is part of the nvim-treesitter plugin.

To use a version that has not yet made it into nvim-treesitter:

local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.perl = {
  install_info = {
    url = 'https://github.com/tree-sitter-perl/tree-sitter-perl',
    revision = 'release',
    files = { "src/parser.c", "src/scanner.c" },
  }
}

Then :TSInstall perl. Copy the queries from the queries directory into queries/perl somewhere in your runtimepath.

Emacs

As of Emacs 29.1, if you have the tree-sitter library installed:

(setq treesit-language-source-alist
  '((perl . ("https://github.com/tree-sitter-perl/tree-sitter-perl" "release"))))
(treesit-install-language-grammar 'perl)

From source

Pre-built files are on the release branch. We don't store generated files on master because the 18MB parser.c makes branch switching painful.

Developing

Prerequisites

Install the tree-sitter CLI. Node.js v20+ is needed for tree-sitter generate (the grammar uses advanced regex features for unicode support).

Building

tree-sitter generate   # generates src/parser.c from grammar.js
tree-sitter test       # runs the test corpus
cargo test             # runs the Rust binding tests

If you aren't changing grammar.js, you can generate from the checked-in src/grammar.json with just the tree-sitter CLI (no Node needed):

tree-sitter generate src/grammar.json

Releasing

script/bump-version 0.2.0          # syncs version across package.json, Cargo.toml, pyproject.toml
git add -A && git commit -m 'chore: bump version to 0.2.0'
git tag v0.2.0
git push origin master v0.2.0      # tag push triggers publish to npm, crates.io, PyPI, GitHub

Tests

Tests are in test/corpus/. Reference: https://tree-sitter.github.io/tree-sitter/creating-parsers#command-test

Contributing

Pull requests welcome! The grammar is in grammar.js. For subtle points, please leave comments — the extra bytes go a long way.

Supporting scripts

unicode_ranges.pl generates unicode ranges for the C and JS sides of the parser. Dependencies are in the cpanfile. Only needed if working on unicode identifiers.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_perl-1.1.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_perl-1.1.0-cp39-abi3-win_amd64.whl (292.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_perl-1.1.0-cp39-abi3-musllinux_1_2_x86_64.whl (344.9 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

tree_sitter_perl-1.1.0-cp39-abi3-musllinux_1_2_aarch64.whl (342.3 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_perl-1.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (384.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

tree_sitter_perl-1.1.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (357.9 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_perl-1.1.0-cp39-abi3-macosx_11_0_arm64.whl (323.4 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file tree_sitter_perl-1.1.0.tar.gz.

File metadata

  • Download URL: tree_sitter_perl-1.1.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tree_sitter_perl-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f5288444e32695ef3216485c986ac4c26a8eac7754e1f464d5bf80eee3de9870
MD5 6142639717f3c79b2559669b3ed6825b
BLAKE2b-256 da0a0701b83cd55b973847d8314c50b87f1ce4f7bd0deb36c48562a75cf87a59

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.0.tar.gz:

Publisher: publish.yml on tree-sitter-perl/tree-sitter-perl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_perl-1.1.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 98f740945465135348ba6956b6e720fd4c7a4564bd58fe61e8c72741a4d60696
MD5 b3cab22a080924c028d2bc58ba8c485b
BLAKE2b-256 7e35028cc2d459a31a25f16d0c01b974940b29e7311adf11bfaeef81cba8f669

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.0-cp39-abi3-win_amd64.whl:

Publisher: publish.yml on tree-sitter-perl/tree-sitter-perl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_perl-1.1.0-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c7e58a2c0d32053e48ac0b24295494cf21c3cb7c518f1c4f120045e4693d5619
MD5 2b8b42bb42cc4e984668b1f78fc0eaeb
BLAKE2b-256 3846e3d459cc959ad9646c3857d2ff97ad1f9e2d86fd7c2bfef1180cd38fa72c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.0-cp39-abi3-musllinux_1_2_x86_64.whl:

Publisher: publish.yml on tree-sitter-perl/tree-sitter-perl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_perl-1.1.0-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a9dc56daf05afdcb45917ddf5cecfbb3ba7373b99fb62084d7ce134dee018619
MD5 6a705a70b037af43a15ddb20b27d3fd0
BLAKE2b-256 ec9c08ec568c62f08a656fdbfb858e0f8d68f1a18c6c9a25e2a3dd8bcdbe36f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.0-cp39-abi3-musllinux_1_2_aarch64.whl:

Publisher: publish.yml on tree-sitter-perl/tree-sitter-perl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_perl-1.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e52075075d13ada4f8e18214bf176ab2ab77ff233e7feaaf689c35ac29a15808
MD5 8d9bb065fb565f6fe4f133ccf0b86b60
BLAKE2b-256 5a568bd2848348c220d0e54e7083c3a6c9d2d46beb326096dc32324d581dbbbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on tree-sitter-perl/tree-sitter-perl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_perl-1.1.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fcd33ea490e566e773b9b9e3c4632f67489558d68fd57858843865b675a35bcb
MD5 222e7e2b0d929e42012c40fc541e6206
BLAKE2b-256 5a91e5d1b9eafee43cc3ee192891992920229fc80de686a5036cbe900bcbf4e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on tree-sitter-perl/tree-sitter-perl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_perl-1.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe95e72ffe485a1f25b992c66c9254902e7594202201bf45608970229e22220f
MD5 5fb38208f18835feb3a9507c8c20bfa5
BLAKE2b-256 f6123f3a01175a6678235d568189a0813391c6140468cdfd03e0be0680b30e05

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on tree-sitter-perl/tree-sitter-perl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page