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.0.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.0-cp39-abi3-win_amd64.whl (320.1 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_perl-1.2.0-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.0-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.0-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.0-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.0-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.0.tar.gz.

File metadata

  • Download URL: tree_sitter_perl-1.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 10fb600e4d61b7c685b8375f786417453d37c058673335372e1c46be49439b29
MD5 b47fcccc762a3a241e61ce19184e672b
BLAKE2b-256 324158e42da8b5c16bd00aa23b10734d6bdb723d42a9b6e0faf6da603443e7d4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 63f960dd579d57e6db0227162762c859c775ebbe7c71bf3acddf0790b26b4672
MD5 9ae2eccb03b96165e58ea6ea6bcd6bf6
BLAKE2b-256 ebc6b8d13bc6b19de5dbd3720ccc6e4cb2cc6fcd6564c63a1debae64ef39a5b2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 49efbb1a723b463e7ad1bce924dbf3fa574a248c727969f7a0cf4076c76241bb
MD5 b42f3b2c3f957328363e62f90b29b70d
BLAKE2b-256 04e6805a8a29f28d9ad59e767ad4f4a44babb7c7ff6bf2e2b08d373c266b7548

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 d82f29c19dbcdc62f1765c69abf0ce8aec1172cbfd78bdcb619f5e66f53a9fb1
MD5 8c970756d36fde5ab87e8712b4006d0d
BLAKE2b-256 ef32a13729c76f9e61ef5a8697f4661e5bfc7ee96d10ccf5c84e6f8644cdce4f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a83d2da587985e6424707a96dde1e3a46be6a3fa02d105c2ad61306a11eb3dcc
MD5 cb53d82de8bc1cb5221b973b22c756e7
BLAKE2b-256 12dce325dc1b81ebe36e3423e002ef2d18635a746ffcb319f80a59e9087504c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.2.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.2.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.2.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b29be467ac9d7b6395df341d3c295846e40a42b89cf66f7fee435e34964d1cb
MD5 3529a688ae8b39ed158334e0ccffb1d5
BLAKE2b-256 5a587cf65138fc084a17d7f3f6802133e5c1ddb53ff004e0d90ec89febca18a8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 621c4ccf7c556f004620f24d89d7b353049ac18c8e4a866ea538311523c865ed
MD5 b0d4cde2666935a1b86c1c86d4d117a5
BLAKE2b-256 1d5673074d09e4fe15bbc9fb8bcbe6e90dc9eba3c1c60c707108d36ba430b07e

See more details on using hashes here.

Provenance

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