Skip to main content

Crate tabnas_ini

Crate tabnas_ini 

Source
Expand description

An INI grammar plugin for the tabnas parsing engine.

INI is the oldest configuration format still in daily use, and the least specified: every implementation is a dialect. This one layers on the relaxed-JSON grammar from tabnas-jsonic and lexes keys, values and section-header segments with tabnas-hoover.

[server]
host = localhost
port = 8080

=> {"server":{"host":"localhost","port":"8080"}}

This is the Rust port; the TypeScript package (ts/src/ini.ts) is canonical and the Go port (go/ini.go) is the nearer structural model. The three are held together by the shared test/spec/*.tsv fixtures, which every runtime discovers and runs.

Structs§

CommentOptions
Comment handling. Line comments are always on; this controls the inline ones.
IniError
The engine’s error, re-exported under this crate’s name.
IniOptions
The INI plugin options.
IniPluginError
A failure to install the plugin: a missing base grammar, a hoover block the host refuses, or a grammar document the engine rejects.
InlineCommentOptions
Inline comment behaviour.
InlineEscapeOptions
Escape mechanisms for a literal comment character inside a value.
MultilineOptions
Multiline value continuation.
SectionOptions
Section header handling.
TranslationPart
One optional alchemy translation source and its explicit entry point.
TranslationParts
The package-local structural translation interface.

Enums§

Duplicate
How a repeated section header is treated.

Constants§

DEPTH_LIMIT
The deepest a document may nest before the parse is refused with the engine’s cancel code.
PLUGIN_NAME
The plugin name, and the namespace use_plugin files its option bag under.
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/ini.ts and const VERSION in go/ini.go.

Functions§

ini
Install the INI grammar on an engine that ALREADY carries jsonic.
make
Build an INI parser with the default options.
make_with
Build an INI parser with caller options.
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 INI is read as and written from (tree), the root its render needs (object), the file that holds the render, the sentences that say what the render does not keep, and the file that holds the transducer part (transduce), the document’s JSON events from the grammar’s rule passes under its default options, through which a host that reads parser events reads a document. The crate embeds its own copies, translate/manifest.json and translate/transduce.alc, since a packaged crate holds nothing outside rs/; tests/translate_test.rs holds each copy to its file.
parse
Parse an INI source string with the shared default parser.
parse_with
Parse an INI source string with caller options.
plugin
The plugin form of ini, for Tabnas::use_plugin.
render_text
INI’s render, alchemy/render.alc, the file the manifest’s translate.render names: a library of alchemy definitions, with no export, whose entry point ini-render writes a tree’s events as one INI document. A host links it with its own program. The crate embeds its own copy, translate/render.alc, held to the file as the manifest’s is.
translate
Return INI’s immutable translation parts.