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.0.3.tar.gz (1.4 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.0.3-cp39-abi3-win_amd64.whl (289.9 kB view details)

Uploaded CPython 3.9+Windows x86-64

tree_sitter_perl-1.0.3-cp39-abi3-musllinux_1_2_x86_64.whl (333.2 kB view details)

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

tree_sitter_perl-1.0.3-cp39-abi3-musllinux_1_2_aarch64.whl (332.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

tree_sitter_perl-1.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (372.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

tree_sitter_perl-1.0.3-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (344.1 kB view details)

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

tree_sitter_perl-1.0.3-cp39-abi3-macosx_11_0_arm64.whl (315.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: tree_sitter_perl-1.0.3.tar.gz
  • Upload date:
  • Size: 1.4 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.0.3.tar.gz
Algorithm Hash digest
SHA256 1c9453ddf3ac49937d59e3208fb2e1d1e86ad019efe8985f5fc9b3d62dffcda9
MD5 34bfaedeb4d77d27cf05c00c6f156c19
BLAKE2b-256 4d0669e03f73af1e7de04ae1edf0c3e57aa1a1a85a08a10f67dc5c3cefe43b33

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.3-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4607884605879845fb67603f9d0e0f9cbb5bc4708ee192e0f774c6796c6aacff
MD5 4f2143230652016ef2760c2501724f33
BLAKE2b-256 be40725c3fc8a5e3715ca154c1040031f22209ad8eab326641ece2789616d511

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.3-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 89c5110e761bfdb741441f6772c3beeb2a02cc95379b0ca94c16ec8f73dedd70
MD5 fae3f128460800dfa65467854696eb6a
BLAKE2b-256 8c14eb12da6bcfac53d59402665bb98d418dd869cc9506b0b9cf865fd12c8349

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.3-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 385641e596e930c11f2f80ed221ea5c02427f38174ab85291a29387ee0cc4904
MD5 1685ce34c95b090086fce0a4fc7bfb93
BLAKE2b-256 4e24b2f76d068e7d55f11955f9a6b7bd735692c015519d4a4d86e6c6dcb98754

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f25289d14054ae84e9ce02b184971dad24a50b03a7578a98c96e888b79d72a25
MD5 1d4f742a11bf1ac856e56f8bc9c5a827
BLAKE2b-256 d8e84ed7634a0d34b58627bd883a521e5d9f422f0ed4c24c1b3d42b45c19866f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_perl-1.0.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.0.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.0.3-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4706e2c53116caf9b426ba61ea4b51a66e479f34fe25ca7dd0ef03fc9db2a409
MD5 a064e1cdc9e8798c2c1af0abc5decd3a
BLAKE2b-256 1c7efd49a9af6a0fe5d087d917d0aff008d724fb57732bcb2f8c78e7663ddf91

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for tree_sitter_perl-1.0.3-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a933460fcda8ccfb0728fdf923d7d455a3cbc9d174a40bef7472720f2c7470d
MD5 234d450d3dfe9caa3960b01a3982dbcc
BLAKE2b-256 4ff650375ec147e5aaebd43b87e7e65d77bbdc964ac74cadcfb6bdab4c21fc54

See more details on using hashes here.

Provenance

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