Skip to main content

Crate tabnas_json

Crate tabnas_json 

Source
Expand description

A standard JSON grammar plugin for the tabnas parsing engine.

The engine ships no grammar of its own; this crate supplies the strict, standard-JSON one. The rule set (val / map / list / pair / elem) is jsonic’s “Plain JSON” grammar, the pure-JSON core jsonic defines before extending it for the relaxed jsonic format. Here that core is installed on its own, with the lexer restricted to strict JSON and none of jsonic’s extended grammar (comments, unquoted keys, implicit objects/arrays, trailing commas, single/backtick strings, path diving).

This plugin is intended to be the foundation other tabnas grammar plugins build on: install it first, then layer additional rules on the shared val / map / list / pair / elem rules.

Structs§

JsonError
The error a failed parse produces, re-exported so callers need not depend on the engine crate directly. Mirrors the TypeScript export { TabnasError as JsonError }.
TranslationPart
One optional alchemy source and the entry point a host calls.
TranslationParts
The package-local structural translation interface.

Constants§

VERSION
This crate’s version. It MUST equal ts/package.json “version”: the release orchestrator rewrites both, and tests/version_test.rs fails the build if they drift. Mirrors VERSION in ts/src/json.ts and const VERSION in go/json.go.

Functions§

json
Install the strict JSON options and the JSON rule set on parser.
make
Build a standard-JSON parser instance.
manifest_text
The plugin’s manifest, tabnas.plugin.json, as the repository carries it. Its translate object is what a host that translates reads: the shape JSON is read as and written from (tree) and the render that writes it, which is the json render alchemy carries rather than a file of this repository’s. It declares no loss: that render keeps every value and every number’s spelling, so a JSON document written from a JSON tree loses nothing. The crate embeds its own copy, translate/manifest.json, since a packaged crate holds nothing outside rs/; tests/translate_test.rs holds the copy to the file.
parse
Parse a JSON source string with the shared default parser.
translate
Return JSON’s immutable translation parts.