Skip to content

Add native grammar registration and external crate guide#171

Merged
fasterthanlime merged 2 commits into
mainfrom
codex/grammar-store-registration
Mar 11, 2026
Merged

Add native grammar registration and external crate guide#171
fasterthanlime merged 2 commits into
mainfrom
codex/grammar-store-registration

Conversation

@fasterthanlime
Copy link
Copy Markdown
Collaborator

Summary

This adds a minimal public API for registering third-party compiled grammars into Arborium's shared GrammarStore.
It also documents the outside-the-repo workflow for packaging an Arborium-compatible grammar crate and includes a full standalone example crate that registers itself into Arborium.

Changes

  • add GrammarStore::insert(...) to the generated store template with explicit normalization and override semantics
  • document that Highlighter::with_store(...) and related shared-store flows pick up registered grammars
  • add focused tests for custom grammar registration, coexistence with built-ins, and duplicate insert behavior
  • add EXTERNAL_GRAMMAR_CRATES.md explaining how to build an Arborium-compatible grammar crate from outside this repo
  • add examples/arborium-example-json as a full standalone example crate with a runnable Arborium integration example
  • link the new external-crate guide from the Arborium docs

Testing

  • cargo nextest run --manifest-path /Users/amos/bearcove/arborium/crates/arborium/Cargo.toml --features lang-rust
  • cargo check --manifest-path /Users/amos/bearcove/arborium/examples/arborium-example-json/Cargo.toml --example highlight_with_arborium
  • cargo run --manifest-path /Users/amos/bearcove/arborium/examples/arborium-example-json/Cargo.toml --example highlight_with_arborium

@fasterthanlime fasterthanlime merged commit b7a8eb8 into main Mar 11, 2026
19 checks passed
@fasterthanlime fasterthanlime deleted the codex/grammar-store-registration branch March 11, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant