Skip to main content

Tree-sitter for the latest version of Minecraft mcfunction syntax

Project description

Tree-sitter for MCFunction

Tree-sitter grammar for modern Minecraft data pack function language. Supports 26.1 and earlier versions.

If you have any issues with parsing/highlighting, feel free to create an issue.

Neovim installation

Using lazy:

return {
    "bbfh-dev/tree-sitter-mcfunction",
    config = function()
        local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
        parser_config.mcfunction = {
            install_info = {
                url = "https://github.com/bbfh-dev/tree-sitter-mcfunction",
                files = { "src/parser.c" },
                branch = "main",
                generate_requires_npm = false, -- stand-alone parser without npm dependencies
                requires_generate_from_grammar = false, -- folder contains pre-generated src/parser.c
                queries = "queries/mcfunction",
            },
        }

        vim.filetype.add({
            extension = {
                mcfunction = "mcfunction",
            },
        })
    end,
}

If needed, run: :TSInstall mcfunction.

Other editors

Refer to your editor's documentation on custom tree-sitter grammars.

I do not use other text editors, but I will happily accept contributions for plugins/add-ons/extensions that enable this grammar in a different editor.

Addendum

1 Macros

This grammar accepts $(macro)-s in many common places. However, some $(macro) tricks simply cannot be properly handled and can lead to errors.

2 Testing

[!IMPORTANT] Quantity ≠ quality. I used all projects I could scramble on my machine, but that does not mean that all possible syntax is covered.

Alongside tree-sitter tests, the grammar was tested on at least 19,293 files (~146,314 lines) worth of mcfunction code.

The script used can be found in this repository: test_local_files.sh. (Note: the script is sloppy, I did not intend for it to even be public)

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_mcfunction-0.4.0.tar.gz (190.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_mcfunction-0.4.0-cp310-abi3-win_arm64.whl (68.3 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_mcfunction-0.4.0-cp310-abi3-win_amd64.whl (71.3 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_mcfunction-0.4.0-cp310-abi3-musllinux_1_2_x86_64.whl (81.0 kB view details)

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

tree_sitter_mcfunction-0.4.0-cp310-abi3-musllinux_1_2_aarch64.whl (79.8 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

tree_sitter_mcfunction-0.4.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (80.4 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

tree_sitter_mcfunction-0.4.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (81.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_mcfunction-0.4.0-cp310-abi3-macosx_11_0_arm64.whl (71.1 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

tree_sitter_mcfunction-0.4.0-cp310-abi3-macosx_10_9_x86_64.whl (66.7 kB view details)

Uploaded CPython 3.10+macOS 10.9+ x86-64

File details

Details for the file tree_sitter_mcfunction-0.4.0.tar.gz.

File metadata

  • Download URL: tree_sitter_mcfunction-0.4.0.tar.gz
  • Upload date:
  • Size: 190.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tree_sitter_mcfunction-0.4.0.tar.gz
Algorithm Hash digest
SHA256 765d3c3e6a3af6f4dcbfcdeef8535925447a2cf5c44fe5750a83d526aa6bba77
MD5 d52b3223d9abe0d959de3fabb4017dfe
BLAKE2b-256 8ee13c41f77ec36e6814be73dbacb5e9a8548db55b3a5c49f5490f9d8015e2d9

See more details on using hashes here.

File details

Details for the file tree_sitter_mcfunction-0.4.0-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_mcfunction-0.4.0-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 4ffb738686815a57765bf53031b0531ae3b79f802957fd730445e3b610493201
MD5 7860e9623542ad49e6e97398ad2c6b9e
BLAKE2b-256 22303278050931a58c1441d9e34a2a3a7a6d2cf08c3e4e9f00ac9b66930f1cc8

See more details on using hashes here.

File details

Details for the file tree_sitter_mcfunction-0.4.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_mcfunction-0.4.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a8dbb292bab91e2bee1adba7212b8e03a620863a4130fcd556d28b64400a5f61
MD5 97dba14bcbe34a91da06973b9c372723
BLAKE2b-256 a87866425ae7a9cdef727474e17970bfc5927277ace8c665760447fd174be3d8

See more details on using hashes here.

File details

Details for the file tree_sitter_mcfunction-0.4.0-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mcfunction-0.4.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 64e296d766c5b1a40e48b8988e56812b87da2e66d20ee6af98ff228b40a3c602
MD5 84efe7d3d3eed40c6cec46804458f04a
BLAKE2b-256 9dfa235802b5df9ef0d75231c65e16da1ed8d0c241c2b7e3f2481eddff53d7f2

See more details on using hashes here.

File details

Details for the file tree_sitter_mcfunction-0.4.0-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_mcfunction-0.4.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f4f3b437380ce1ca03b9e749d6e518ce0d08ccfda96a00484e0f17afbbd240d3
MD5 b36dd52c43758ef6fe18132ab8867df4
BLAKE2b-256 5d7016bd1906e7d80e6b0d464b4369b18d393c54655689376ce048ca5db64fdd

See more details on using hashes here.

File details

Details for the file tree_sitter_mcfunction-0.4.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_mcfunction-0.4.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1b36d6a580daffbbbb5a47ee23622d6465d6e7af4aab47d2cd7f3e803a22f434
MD5 4eede38a6156eafc50911eaf58fdbed3
BLAKE2b-256 b770c04541d6ee0e1108c2a048956bb04766f731641c0f035742b754fdaf4e05

See more details on using hashes here.

File details

Details for the file tree_sitter_mcfunction-0.4.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mcfunction-0.4.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 5d390b7d059f168a9648fd054e0a919d482c7097c31d954e6cef34c29f10a463
MD5 e576de71ba8144f3f7402dad537cc0d3
BLAKE2b-256 add051521f43b96f906d530cf2e45e146a0c4d874cc1eb3996eefc576e622365

See more details on using hashes here.

File details

Details for the file tree_sitter_mcfunction-0.4.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_mcfunction-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f6d8995ebe5090e38092984549c82484a3c9a43c6c21bc4b19f59a5d8f01eab
MD5 81c34dbeea37fa4cb8a0f10f9f5f6789
BLAKE2b-256 9b8c0bf121b5d911ca564948745752d021c03aae2dac94d970f1fdce270ca5f4

See more details on using hashes here.

File details

Details for the file tree_sitter_mcfunction-0.4.0-cp310-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_mcfunction-0.4.0-cp310-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dc17bc87e09235089a227e0951b5298486ccf922699cd7f3a67d4a8853b821b3
MD5 3be37137c59e7355753024bdc51c0afc
BLAKE2b-256 03d54f9a4ccea9c3f28b35719e596c526989e65a6fc20e5c47606ceca88980d9

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