Skip to main content

Crate hikari_token

Crate hikari_token 

Source
Expand description

hikari (光) — the one fleet-facing semantic highlight vocabulary.

The pleme-io fleet grew several byte-identical copies of a 16-variant highlight-class enum (escriba_ts::Semantic, caixa_theme::Semantic, …). This crate owns the single canonical definition — Semantic — plus a total morphism to/from hikari_core::HlClass (the palette-independent class the highlighter backends emit). Consumers re-export Semantic from here and delete their local copy, so the vocabulary lives in one place and every consumer inherits changes on the next dep bump.

A consumer takes ONE dependency: HlClass, ByteSpan, and HighlightSpan are re-exported.

Structs§

ByteSpan
A byte-offset span into the document. start <= end by construction, and (when produced through SpanSink) both ends land on UTF-8 char boundaries.
HighlightSpan
One classified region of the document.

Enums§

HlClass
A palette-independent semantic highlight class. A superset of the classes egui / tree-sitter / the fleet’s Semantic enums produce, so every backend lowers to this one waist and the theme layer maps it to color exactly once.
Semantic
The fleet semantic highlight class — the theme-facing vocabulary a renderer maps to color. Variant set + order are load-bearing: they are byte-identical to the historical escriba_ts::Semantic / caixa_theme::Semantic so serde / JsonSchema output does not drift when those crates re-export this one.

Functions§

hlclass_to_semantic
HlClass -> Semantic — total. HlClass is richer (it carries Type / Function / Escape / … that Semantic lacks), so this direction is lossy for those: they fold to the nearest Semantic (documented per arm). The mapping is chosen so Semantic -> HlClass -> Semantic is the identity.