tabnas-debug (Rust)
Debug / introspection plugin for the
tabnas parser engine, crate
tabnas-debug (library tabnas_debug).
It makes a grammar visible: describe dumps an instance's installed
grammar (tokens, rules, plugins) as labelled text, model returns the
same information as structured, serialisable data, abnf re-expresses it
as ABNF, and tracing logs a parse event by event. A dev/test aid, never
a runtime dependency.
This is the Rust port of the canonical TypeScript implementation in
../ts; the TypeScript version is authoritative and this crate
tracks it. The Rust engine exposes tracing and introspection through
different idioms, so the surface differs in shape: free functions
instead of instance methods, typed options instead of an option map, and
a use_plugin wrapper for the print option. See
the concepts doc and reference for
the details, and ../docs/reference.md for the
authoritative cross-runtime divergence register.
Install
The tabnas crate is not published to a registry, so the engine is
consumed as a sibling checkout, the standard tabnas development
model. Clone https://github.com/tabnas/parser next to this repository
and point at it:
[]
= { = "../parser/rs" }
= { = "../debug/rs" }
Use
use Tabnas;
use ;
describe, model and abnf read a live instance and have no side
effects, so they work on any Tabnas whether or not the plugin is
installed. Installing the plugin is what turns on tracing and the USE:
dump.
To capture output instead of writing it to stderr, set the engine's sink:
# let mut parser = new;
parser.options.debug.output = Some;
Documentation
- Tutorial. Zero to a working inspection, step by step.
- How-to guide. Focused recipes.
- Reference. The exact exports, options, and output.
- Concepts. How it works and how it differs from the TypeScript version.
Build and test
The engine is a path dependency on the sibling checkout, so there is nothing to fetch and nothing to build first:
Or, from the repository root, make test-rs runs the tests and Clippy.
There is only one resolution here, always the sibling engine, unlike
the Go module's pinned/workspace pair.
The suite runs the shared ../test/spec/*.tsv conformance fixtures (the
same files the TypeScript and Go suites run) over the same named
grammars. A row green in one runtime and red in another is a failure, not
a discrepancy.
License
MIT.