Skip to main content

VHDL grammar for tree-sitter

Project description

Tree-sitter-vhdl

CI Fuzz matrix

A VHDL parser for syntax highlighting.

References

Screenshots

Neovim, using nvim-treesitter and a Catppuccin colour scheme:

Screenshot

Other colour schemes

Neovim, using nvim-treesitter and a Tokyo Night colour scheme:

TokyoNight

Neovim, using nvim-treesitter and a One Dark colour scheme:

OneDark

If you'd like your favourite colour scheme to be listed here, issue a PR with a new screenshot of the screenshot example in the same style and composition as the other screenshots.

History

This version started off as a fork of alemuller/tree-sitter-vhdl, but ended up as a complete rewrite of the parser and highlighting scripts. It has very little in common with the original.

Limitations

This parser uses a simplified grammar, because the full formal grammar in the VHDL standard is highly ambiguous without compiling the entire code-base into a symbol table. In many cases, invalid syntax will parse into a valid tree.

For the same reason, there might be cases where valid syntax does not map to a valid tree. In this case, please log a bug report.

In addition, the following features are not implemented, and are considered outside the scope of this project.

  • IEEE Property Specification Language
  • VHDL Procedural Interface

Neovim Setup Process

This parser has been merged into the official nvim-treesitter, so it should work out of the box after adding it to the list of languages to install.

If you would like to use the develop branch instead (because it contains the latest features that might not have been merged upstream yet), configure your treesitter.lua (or equivalent) as follows:

local parser_config = require('nvim-treesitter.parsers').get_parser_configs()

parser_config.vhdl = {
  install_info = {
    url = "https://github.com/jpt13653903/tree-sitter-vhdl.git",
    files = { 'src/parser.c', 'src/scanner.c' },
    branch = 'develop',
    generate_requires_npm = false,
    requires_generate_from_grammar = false,
  },
  filetype = 'vhdl',
}

local treesitter = require('nvim-treesitter.configs')

treesitter.setup {
  ensure_installed = {
    -- Some list of languages...
    'vhdl',
    -- Some more languages...
  },

  -- Some other options and configuration...
}

Then copy the contents of the queries/Neovim folder to your after/queries/vhdl configuration folder, typically ~/.config/nvim/after/queries/vhdl on Linux and ~/AppData/Local/nvim/after/queries/vhdl on Windows.

Finally, run :TSUpdate.

If this does not work, change the url to a local clone of this repo instead. The nvim-treesitter installer doesn't always follow the override if the url points to an online repository.

Helix Setup Process

Helix still uses a fork of the old unmaintained alemuller/tree-sitter-vhdl. To manually use this tree-sitter instead, clone the Helix repo. In languages.toml replace the line:

source = { git = "https://github.com/teburd/tree-sitter-vhdl", rev = "c57313adee2231100db0a7880033f6865deeadb2" }

with:

source = { git = "https://github.com/jpt13653903/tree-sitter-vhdl", rev = "f4c492accff02b5c85517ff5dd4720e2229feb75" }

Adjust the revision git hash if necessary (latest stable is recommended).

Now build Helix from source. You can check if you got the right tree-sitter source files in the helix/runtime/grammars/sources/vhdl/ directory.

Replace the helix/runtime/queries/vhdl/highlights.scm file with the queries/Helix/highlights.scm from this repo. You can also adjust the highlights.scm file to your liking or change the highlighting in your theme .toml file.

Building

  • Follow the instructions here to setup your development environment.
  • Run npm install --save-dev tree-sitter-cli
  • Add node_modules/.bin to your environment path
  • Run tree-sitter generate
  • Run tree-sitter test

Contributing

Contributions are welcome. Read Contributing.md for more information.

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_vhdl-1.2.5.tar.gz (396.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_vhdl-1.2.5-cp310-abi3-win_arm64.whl (181.6 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_vhdl-1.2.5-cp310-abi3-win_amd64.whl (193.3 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_vhdl-1.2.5-cp310-abi3-musllinux_1_2_x86_64.whl (267.3 kB view details)

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

tree_sitter_vhdl-1.2.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (266.5 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

tree_sitter_vhdl-1.2.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (258.9 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

tree_sitter_vhdl-1.2.5-cp310-abi3-macosx_11_0_arm64.whl (190.5 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_vhdl-1.2.5-cp310-abi3-macosx_10_9_x86_64.whl (179.1 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_vhdl-1.2.5.tar.gz.

File metadata

  • Download URL: tree_sitter_vhdl-1.2.5.tar.gz
  • Upload date:
  • Size: 396.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tree_sitter_vhdl-1.2.5.tar.gz
Algorithm Hash digest
SHA256 56f717b3ca16a5099b9496200c1635d6adeb88664edc72d2dfc59071330fe220
MD5 1e3b9992c17ce4781efbec2ba09f9875
BLAKE2b-256 b6e82d3e7f0fe0700f5e1dcd927c5c671ef46ae2fc4f11a7825ccfbbd9611642

See more details on using hashes here.

File details

Details for the file tree_sitter_vhdl-1.2.5-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_vhdl-1.2.5-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 3f224b3aaae706a98d36813da24e3b2140952704b7779e49a62813fbf462c729
MD5 efb50d2368c95263a7645016a3a3b0f7
BLAKE2b-256 053ed73ed61a770d7ca65ff59168e498523d3e5f99bd8047ca2bd35d864bad53

See more details on using hashes here.

File details

Details for the file tree_sitter_vhdl-1.2.5-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_vhdl-1.2.5-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b9a6a8080dad8cd88c0bfe9993aac586d6b1917008b456f3405f16d3740c1c92
MD5 39a800d6629846daede2690966bd7fed
BLAKE2b-256 4ef3913b570886e518194912a1b79b77bbe0404f93df5dcb27fd0cbf15062e32

See more details on using hashes here.

File details

Details for the file tree_sitter_vhdl-1.2.5-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_vhdl-1.2.5-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 42e32e23a5c4925866b0612c3c6b157377b51a73bedbf6ba6fb0c7089161aa51
MD5 e64fd3faca67fc76d17779da1ad4c480
BLAKE2b-256 f11dd0b97dd604014be1bf15b8a2ae168ab9fba5f2a0d2fc962d943ae0712b80

See more details on using hashes here.

File details

Details for the file tree_sitter_vhdl-1.2.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_vhdl-1.2.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fca0bf10f95d525c7070414654699b5c5a5f21f419b88caeb93d779b8da9e5b2
MD5 1187701972b474524fdd11c999394330
BLAKE2b-256 7d63ced3d7ea9dae0d998c8fb6cad21a0e29f3fcf174df6625ce895fe5576c0e

See more details on using hashes here.

File details

Details for the file tree_sitter_vhdl-1.2.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_vhdl-1.2.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3d63a22a4682c51fde89073d98e72e57252312a903684594d7ffee558cb281a8
MD5 b3892cd7156595c924d6caec541d42cf
BLAKE2b-256 a92a4396f393b144c1bfd2aa6c8c89181ce2464f7ddad5a3deedd93174bec2e3

See more details on using hashes here.

File details

Details for the file tree_sitter_vhdl-1.2.5-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_vhdl-1.2.5-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 71a8ba7379f143dcb6595a1e725215d528f1154bfa5584266bdb05a072dff3d4
MD5 815c01ae914bdc5b165d7acfec8c5b7f
BLAKE2b-256 5ce4cba15952307dfc9c1fc79fec99fdb2183962018e4ed768ee4f758c1c60d6

See more details on using hashes here.

File details

Details for the file tree_sitter_vhdl-1.2.5-cp310-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_vhdl-1.2.5-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0389444af3fe48f65341ffb890d3a1ce516194f1c914e1263eebcca6f34575fd
MD5 b81407d40d3a9e5816194b643092f132
BLAKE2b-256 618bf038830fb9e2e001a3a20da8c98192a3cb11cddc6bedba0c2e33382635c2

See more details on using hashes here.

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