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

Uploaded CPython 3.9+Windows x86-64

tree_sitter_perl-1.1.1-cp39-abi3-musllinux_1_2_x86_64.whl (358.2 kB view details)

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

tree_sitter_perl-1.1.1-cp39-abi3-musllinux_1_2_aarch64.whl (354.7 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_perl-1.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (395.9 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

tree_sitter_perl-1.1.1-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (370.0 kB view details)

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

tree_sitter_perl-1.1.1-cp39-abi3-macosx_11_0_arm64.whl (336.2 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: tree_sitter_perl-1.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 103f5a684c0eed743ff95fcd04d8059b508aa68c8b336de11c0858370c6badf7
MD5 87afff073bf790b8cb3977400d1c9705
BLAKE2b-256 2c4ba37013b16b0585d590affd479832a75db6b67fae0096c717e1342a82bed1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f0324eda6262b19e0aedebdb65c2ed4d6840ce759ae14276d73b414cde32a91b
MD5 2f66b338af8ca0e018e31492239f3e69
BLAKE2b-256 c548170adf1d306c001bfe8235239ddbdd0789175f46498ba15616459ff13ded

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.1-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 059104857498757ef488ccb9bbb434674b76edad384b16598af8b6192c763b4c
MD5 3afa8e116cbe8be371ee712259df7dfb
BLAKE2b-256 c04624f34cfe440d1eba564a95313a8b4b887b27bc2f22b30e61a1484fa61dbc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.1-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 97bb1a7dc233ea326a70212b823408e44ef339f0b4a575991690192bb77b1ca1
MD5 bfad741c1fecc6b9dcef114390854e16
BLAKE2b-256 269ed9096ef1bada809ff5ce805051f9a4eb5898fe8c0086e4cd56606ee1aace

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0ba1865167d18ce219965f51fc6d72c04c77fc6027a53a9e7b7def17a95930dd
MD5 7140d920300f07864989344e70b46785
BLAKE2b-256 ec5aa32bb46684652ca166295ce06732db75232cf71f4b4584414c3707226a16

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.1.1-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.1-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.1-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d0c5d5721896d1c31d21d371ebbadf54b4cdaec399193a7dd210043e42ef706e
MD5 3bf7585e39e56ee19f0a922000295d03
BLAKE2b-256 1eb4419909e2bf1bb3f6094b875303328c6b2bdf2c0f10defa4b519af9451d40

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.1.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 35e846385ddab208e1faefd85d71a909e320104ba6ef68203b266b1d8be8ac45
MD5 476fe7eb6c7f2de47d3f17dc5f5c52d7
BLAKE2b-256 b888b2985427f6f79378b4c3c0e722bf5be375e0cc02cf123126f1b849ae9f8e

See more details on using hashes here.

Provenance

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