Mark

All work

live2026

tohki

A tiny dependency-free Rust tokenizer that converts source code into typed tokens, used for syntax highlighting.

  • Rust
  • Library

Crates.ioSource

Tohki diagrams showing source classification, token details, and language definition fields.
Source code broken into typed tokens, with each token's kind, byte range, and text shown in a table.

01

Tohki

Tohki reads source text and returns a token for each fragment. These tokens contain metadata whose usage is up to the implementation/consumer.

Source code shown above a token table with each token's kind, byte range, and text.

02

Token definition

A token is composed of the kind, byte range, and source text of each fragment.

A Rust language definition listing names, comment markers, quotes, keywords, types, and constants.

03

Language Structure

A language is defined by its names, comments, quotes, keywords, types, and constants.

More work