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.4.tar.gz (1.8 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.4-cp39-abi3-win_amd64.whl (338.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_perl-1.1.4-cp39-abi3-musllinux_1_2_x86_64.whl (397.1 kB view details)

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

tree_sitter_perl-1.1.4-cp39-abi3-musllinux_1_2_aarch64.whl (403.1 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_perl-1.1.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (427.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

tree_sitter_perl-1.1.4-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (408.4 kB view details)

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

tree_sitter_perl-1.1.4-cp39-abi3-macosx_11_0_arm64.whl (385.6 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: tree_sitter_perl-1.1.4.tar.gz
  • Upload date:
  • Size: 1.8 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.4.tar.gz
Algorithm Hash digest
SHA256 9fc0446e26c198498cdeffe233d166055bf8b64170ec747cf538b5b64c2796d2
MD5 22588565ea95983b96094687b61ef1c0
BLAKE2b-256 8a0345c4e8c7709234ee07280c40e5868d52df3a1e8c107316faecc3a05a01f8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3d1efacf8d1c6ef6c92f81b5b9a220b0114ac6d613b19cecc661c89c959f8f2b
MD5 f4ff9e9f89f908717b4be5fefd88cbb9
BLAKE2b-256 58c1c2dc314e828d0286de0bad216f53b01d5649ba560f2d612d447a8553bb94

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.4-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f97e99f5661a1a1150f07504a5728c6710d4a4d4aed75b04c49cf0a717861418
MD5 c2bb5401723c4023f5f54e4bf8187532
BLAKE2b-256 ac4d7df1edd8a2efbb3b461d66a20db96cfe8b00b8b64c4fa90197a838fdf69a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.4-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 99264b191b6c6bcd63831ef2e4e77f915376f0972968da965de08d6cd27b4f2d
MD5 af46093ef0e8cd64a425b3260152b6fd
BLAKE2b-256 72f5ee1198e2a685e35302699bf2891f57f4f2dc9b9ae2aba1d5789fcdd4d466

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bb60145f378db76a42570da94cc22b93a68c0b2fdfbd6e03afb0be593a81319f
MD5 40d3786e22e3e7e2610d31eed6480c92
BLAKE2b-256 637db7adbe66d62f1b8779f68ff5bca7edb0cfa178a423e15559e9e2cbb98be5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.4-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.4-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.4-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 41d748a7a290acd2708b85571e3e8da3cee16aaee71f2572c25304523f97541a
MD5 6e020c863366b1a62ab5ac7a9b74b698
BLAKE2b-256 f4b0bf0eaa497c0e9bcfea193771643ab1909eac1794152a5d87485f5dd5e165

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04a98b3233a00329052d0dd816500d75ecf065661e62917d9d8be37e62e87ad9
MD5 e42e395bb5be641c0537793473de479d
BLAKE2b-256 c94b0859cc877a218be4bf1579fa699a5911037956ad7ca013bd33e25e184b96

See more details on using hashes here.

Provenance

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