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.2.1.tar.gz (1.7 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.2.1-cp39-abi3-win_amd64.whl (320.1 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_perl-1.2.1-cp39-abi3-musllinux_1_2_x86_64.whl (373.2 kB view details)

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

tree_sitter_perl-1.2.1-cp39-abi3-musllinux_1_2_aarch64.whl (370.9 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_perl-1.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (409.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

tree_sitter_perl-1.2.1-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (385.2 kB view details)

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

tree_sitter_perl-1.2.1-cp39-abi3-macosx_11_0_arm64.whl (347.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: tree_sitter_perl-1.2.1.tar.gz
  • Upload date:
  • Size: 1.7 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.2.1.tar.gz
Algorithm Hash digest
SHA256 7b5ce3fe9cd7d23b1619ed49d5539b106e301b68dd7139bcae6b9d4ad1e3a1d3
MD5 be721d1e438d289e62671efab33c51d3
BLAKE2b-256 f844c211fda4f42c01791391928b23192b50d160b14e676f2c1fcce1850d76d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.2.1.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.2.1-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 168704111ed36461b1d1da1a36b16332e2c8e2693b5daec57bd8abada1e02f58
MD5 b6c30491eeba4eeb443cf2c3452c3cb3
BLAKE2b-256 8ddca17bd77d350cc7344baf6f3f568f297a1d1a88d2afbf3024a8e86618e96f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.2.1-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.2.1-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.1-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0cfd166f0f11de834b96d99432a86b54444ccbd270d9e19eed06c2de9d6f932e
MD5 14a4c68bd420278d9d3f9b1412a82a58
BLAKE2b-256 7fcd6fbecae40fb5f78bcb95432fc41d6eb0b6a246e43bb63237544c92aa271a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.2.1-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.2.1-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.1-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 66361e2d61467843aeb9ef1233a461e2880ed294a368d81e4b898b33c76913fe
MD5 b893df40e533292566c5070f65599bcf
BLAKE2b-256 8b7776486f28c0d837d1424d3a314736ca2b6916a56b5adf073d6e038fb03522

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.2.1-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.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a18f09b6b76d9bb52da49f3bb4ed7fe4db0857fbf21d1aad78021abaddb47d72
MD5 3298597f4ea94e6f569fda54bbb14b25
BLAKE2b-256 c5b37489ac765c9d5e2a8ef75f43caaa5f1df3cbc93bbc5c0f49559bc4c2e280

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.2.1-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.2.1-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.2.1-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c6cd149c5f5fb5f82d337d5764d8626eecb03b00604c8c0c7ffc4e165e26b273
MD5 595246f2c2916555fc3d48a4d6a53e4f
BLAKE2b-256 a3507340015653da77bc5d12e45678c9339cabf389aba7404d3f5e0514e04acc

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.2.1-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.2.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e77a13168ae5699ee9942aaa928920b9a2d8ce051934550ba2a4b547833a8ba
MD5 f069ac02217228551027cf6159cd0adc
BLAKE2b-256 85294cdb0da188ce7864507317e70db6c9dc045f41d6250f0865aef03294eeb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.2.1-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