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

Uploaded CPython 3.9+Windows x86-64

tree_sitter_perl-1.1.2-cp39-abi3-musllinux_1_2_x86_64.whl (344.9 kB view details)

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

tree_sitter_perl-1.1.2-cp39-abi3-musllinux_1_2_aarch64.whl (342.5 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_perl-1.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (384.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

tree_sitter_perl-1.1.2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (357.0 kB view details)

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

tree_sitter_perl-1.1.2-cp39-abi3-macosx_11_0_arm64.whl (320.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: tree_sitter_perl-1.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 6a409e154c3104972b7e36d57885e29d0a050a31f8b2b179425a68f0ad9fd32d
MD5 1cdca2777aa15c6fc86f6a05178fbd0b
BLAKE2b-256 d7178160cec31ad221cf2affbfb6ca1e3d289a9c384513dbd7c23abbafd77666

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6a9502b6d27de9bfcad3b1b9ca83e2d11f7a2ac8518cfb0a3a91c1deaaf9e13a
MD5 50e951c51842786eda5b445bdedd323e
BLAKE2b-256 7350aa9e01397010939f36ae0488551bc846454485c18bc3c960705f0ce3eba0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.2-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b02ede44abe884afae10c3968ed67b734aff2c20deb2133835e6dd5e0cd6749c
MD5 144611b86f637ec5786ca7fe1c4b21f2
BLAKE2b-256 5868a04ac2b7eafebd4dfa672bac004a78918da8f14f286ba8a88ee26594dfc1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.2-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 02db0243afdd05526262716b5f6a0d6b006cc7692179a275b8b36bf68bf14081
MD5 5975585f37e7b0aaaaab59ef8c6d0e3b
BLAKE2b-256 0516cc78e2a97cea8152aaf409b905dc6e9909af980e85b6d4a78accbc141aab

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6906247dad8bbf5fb295fe6cbe2bc0f0c7f06dd69cd3c9ddddd2b9cf5b46d9b3
MD5 7d34339800ab1333bcf9db8a289187f7
BLAKE2b-256 1d32a2578f7f4b493bca15a044cce8ab3a08e1993d04430ba1f49f8888a9cf97

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.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.1.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.1.2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 174c7d5b7f6b73a65a1e6f4bf8c2e4f7b15c9f007ecaf99754fafe4683fa1de3
MD5 9b4e8404c0d57a35c38c63e5eaa00f22
BLAKE2b-256 c4a94a0b7ecf0cf7867193d3576862e266ab28bcd97df844d3d31b98774389b1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ca6dbd1dcc24575c4a7a6d79c5c87db9f3eef98768dc2e35e5ab0e0b2fb9e68
MD5 1dcce576c736d30047bf701ce16ec745
BLAKE2b-256 dac2013f2eaf52552b55e0088bed63d87add44f6b487ec4a2035b2286d75450c

See more details on using hashes here.

Provenance

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