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.

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_off_taxonomy-0.2.4.tar.gz (28.2 kB view details)

Uploaded Source

File details

Details for the file tree_sitter_off_taxonomy-0.2.4.tar.gz.

File metadata

  • Download URL: tree_sitter_off_taxonomy-0.2.4.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for tree_sitter_off_taxonomy-0.2.4.tar.gz
Algorithm Hash digest
SHA256 8ab4e3b5611cc8c40167c8708a312944da5a261d8051563a1a2b672e788cdeb4
MD5 0ff5429640201876f50df3f7b41da5de
BLAKE2b-256 edc1bdd69920edadb4d591308f4b8bbf58d130297f6ba8e5d94e2ec7bc7a9936

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.5

1 file

This release

0.2.4 This release

1 file

0.2.3

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page