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

Uploaded CPython 3.9+Windows x86-64

tree_sitter_perl-1.1.3-cp39-abi3-musllinux_1_2_x86_64.whl (360.7 kB view details)

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

tree_sitter_perl-1.1.3-cp39-abi3-musllinux_1_2_aarch64.whl (358.1 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_perl-1.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (397.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

tree_sitter_perl-1.1.3-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (371.8 kB view details)

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

tree_sitter_perl-1.1.3-cp39-abi3-macosx_11_0_arm64.whl (336.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: tree_sitter_perl-1.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 80ad9e15df7934acd9c2b91ea186a192e9f07ccd9d7f1c4411af8589a8044b28
MD5 886fb0941f35257a2f7c2d33bd50edf2
BLAKE2b-256 b94c112bb1ee1edbae793ecdca79c122d09cf0f7aced6acb0de211ececc34ad8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.3-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c90864fac7fa4b0d495892d20958f2f781712422dc21d7f8b31fbe5c71ede712
MD5 cb449a845a81fde8370bf534b7e7b7cb
BLAKE2b-256 34c956d9c591c53e581860c664e1aec88439ef6eec64f97db23843db78ee5964

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.3-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f7d04e6318250418e2f5d67755a9ffbc3346160a3533a3fd4cb834fa6c2e066c
MD5 131a2f01a94a95c832192deed4699feb
BLAKE2b-256 f01bda73b40fc9532e3a6930f8e63312e672a1c4d3750a39106e187d00807f19

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.3-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 9a36f71d49b5b0eab236ec11216b224f8c5d4fba61d1a1d2b5bf7230f7ce7bea
MD5 af8f5eea731edaa1439160bf56430a32
BLAKE2b-256 d0c1c485cd1bd14a1e107913752e1dab6245ddb77d1e349c6f70b77501b8ed29

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c331ba211ae0df6de56dc55189e257a61f73d8fe203189acdc84727a6701581c
MD5 8b1f92b44f81d2ef5abae00e241c2d8e
BLAKE2b-256 a0ffca67225f3ca757af9450500914526a1d5a859cb9d47c1fde9423e47b1842

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.3-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.3-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.3-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aba5e8ae67dcf405c2ed6e602d701fbc62bf5022a672c60c8fe28590e4d1c41f
MD5 8b764a086408fc6c8ce2e20fde09b638
BLAKE2b-256 1d7acd72e24a10aef2285683a0d0fb77380c8c56f330a2fd5f2f53a51a6cc387

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.3-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 da3360d7db731e6c71ddb17d57b62c23d2af092cd21b7667cc50ee676e033e8d
MD5 1c7ea34e5df951a48de4d9363cbfc5ee
BLAKE2b-256 76ed50d21548bc0987e4b0e9c5886f8a43dc2e143bf45b65e9322b9251af3b6a

See more details on using hashes here.

Provenance

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