Skip to main content

A Tree-sitter parser for parsing Open Food Facts’s taxonomy source files.

Usage

Neovim (>= 0.12)

Make sure you already have treesitter for Neovim set up and working, and this repository cloned somewhere locally. You will also need to run the tree-sitter commands in the Development section.

Insert something like the following in your Neovim configuration:

-- Register off_taxonomy as a filetype
vim.filetype.add({
  pattern = {
    ['.*/taxonomies/.*%.txt'] = {'off_taxonomy', { priority = 50 } },
  },
})
vim.treesitter.language.add('off_taxonomy', '/path/to/tree-sitter-off_taxonomy')
vim.treesitter.language.register('off_taxonomy', {})

-- Add treesitter directories to runtimepath
vim.opt.runtimepath:prepend("/path/to/tree-sitter-off_taxonomy")

You may need to also set up some folders in the repository to provide the proper directory structure Neovim expects:

cd /path/to/tree-sitter-off_taxonomy
mkdir parser
cd parser
ln -s ../off_treesitter.so
cd ..
cd queries
ln -s . off_taxonomy

Alternatively you can create symlinks in $XDG_CONFIG_HOME/nvim/parser and/or …/queries or similar. See the treesitter for Neovim documentation for details on where Neovim expects to find these files/directories.

Development

Make sure you have Tree-sitter and its CLI and dependencies installed. You should preferably also have pre-commit installed.

You generally want to do something like this to get started:

# Clone the repository
git clone https://codeberg.org/Freso/tree-sitter-off_taxonomy.git
cd tree-sitter-off_taxonomy
# Generate all the derived files
tree-sitter init
tree-sitter generate
# Install pre-commit hooks
pre-commit install
# Run tests
tree-sitter test
# Tests also get run as part of pre-commit, so alternatively:
pre-commit run --all-files

Commit style

Keep commits atomic, use Conventional Commits [*], and write good commit messages.

License

This Tree-sitter parser is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Some parts of the repository may be distributed under different terms. This project adheres to the REUSE Specification and any files or code deviating from the general license of the project will be annotated accordingly.

Metadata

Release files for tree-sitter-off-taxonomy 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tree-sitter-off-taxonomy 0.2.5
File Size Uploaded
tree_sitter_off_taxonomy-0.2.5.tar.gz 28.2 kB Details

Release files / tree_sitter_off_taxonomy-0.2.5.tar.gz

Download URL tree_sitter_off_taxonomy-0.2.5.tar.gz
Size 28.2 kB
Tags Source
SHA-256 checksum
How to use checksums
caa396ba82292d23a696fb6799eb70299c61038181b9876befc4366cd145ba52
BLAKE2b-256 checksum
How to use checksums
22198a69628a55f5e341536c1935f5a0c2f7527a341ddf83897302a9781cc689
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.2.5 This release

1 release file

0.2.4

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page