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.0.2.tar.gz (1.4 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.0.2-cp39-abi3-win_amd64.whl (284.2 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_perl-1.0.2-cp39-abi3-musllinux_1_2_x86_64.whl (319.6 kB view details)

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

tree_sitter_perl-1.0.2-cp39-abi3-musllinux_1_2_aarch64.whl (317.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_perl-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (347.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

tree_sitter_perl-1.0.2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (329.2 kB view details)

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

tree_sitter_perl-1.0.2-cp39-abi3-macosx_11_0_arm64.whl (309.6 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: tree_sitter_perl-1.0.2.tar.gz
  • Upload date:
  • Size: 1.4 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.0.2.tar.gz
Algorithm Hash digest
SHA256 681575eef2770a9713be3b7b5c8cda30705f9eb2e12915177364b877f78b9381
MD5 c16a8a1a32b3035aac0ac9963fffa314
BLAKE2b-256 94d56f7ddcab130bd9bd4bc61020b4aae82d3e68b0eb97051b4c5821d8e5a9dc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a44113e2e0ce9ba10df048cb046ed0d5aa56fdd608472a57c0e00388ba287cc3
MD5 2d678f6dce04f7dbfe6f14c43365c123
BLAKE2b-256 3d4801f6b7711567bf919ea5d887f3ff2745d8988ef174c08ddceae0f9812367

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.2-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 03cad3be76a5a3bd4a3664a4d35fa6af265f5268e42461e0cd9c264ea0864518
MD5 cde4c46662d7bd1be1557bccf3795781
BLAKE2b-256 830c869a8c7645173a70b9a240240f9146af7964f5f511ab5f82e9b1dc0604e8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.2-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 008f905f1b3855b0c711ba066edd6e04bed817b8b9da51721ec12153f3d444bd
MD5 2c8913c9c477529a64895898c6ecebeb
BLAKE2b-256 d8be44fb8ae09fccd2c15d4e48dc68cbdc6697ea1ff9bbc97d0b766bad92738b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e5487e1d8e4a3724604e62ea77de8d146d09a8ed58a5b5a3302773ee9bbabe49
MD5 4dc1b569727442950cb541a49fd0b45c
BLAKE2b-256 7b7703ea8836e6f2ae475b098f82aace40ad3edf14afd3c433446979514e771d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.0.2-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.0.2-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.0.2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae9c60109cd740c5282dff80b03fb7c095212b0b47ed4b810e3e534f55f735fe
MD5 00eb06a450902522e3c9597757b16d3e
BLAKE2b-256 ce5f9fdd9e13fec02990c2912974eabadb5870a86fa82956a4eeb50518046339

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cf3375fcb1e1aba5902378f0ba738c706a4605a024c84855fa7432210521c06
MD5 00331bd95a5db449223fc52d24efb159
BLAKE2b-256 856dd7d05ca0b56979153a96bb8c93085a7226e9eb306240a26270a3a722c7e9

See more details on using hashes here.

Provenance

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