Compiled FLM Serialization¶
Save/load FLM fragments with flm.flmdump¶
- class flm.flmdump.FLMDataDumper(*, environment)¶
Serializer that converts FLM compiled objects (fragments, nodes, parsing states) into JSON-compatible data structures.
The dumper tracks shared resources (latex walkers, spec-info objects, parsing states, nodes) in a resource table so that repeated references produce lightweight
$restype/$reskeypointers rather than duplicate copies.Use
add_object_dump()to serialize objects under named keys, then retrieve the full dump dictionary viaget_data().- clear()¶
Reset the internal dump state, discarding all previously added object dumps and resource entries.
- get_data()¶
- add_object_dump(key, obj)¶
- class flm.flmdump.FLMDataLoader(data, *, environment)¶
Deserializer that reconstructs FLM objects from JSON data previously produced by
FLMDataDumper.The loader resolves resource references, re-creates node trees, parsing states, spec-info objects, and fragments, reattaching them to the provided environment.
- Parameters:
data – The dump dictionary (as returned by
FLMDataDumper.get_data()).environment – The
FLMEnvironmentinstance used for reconstructing walkers, parsing states, and fragments.
- Raises:
ValueError – If the dump version in data does not match the expected version.
- get_keys()¶
- get_object_dump(key)¶
- class flm.flmdump.FLMDataLoadNotSupported¶
Sentinel class used as a placeholder for properties that cannot be deserialized from a dump (e.g.
latex_context).When a property was marked as
$skipduring dumping, the loader stores this class (not an instance) in place of the original value. This distinguishes genuinely absent data from properties that wereNonein the original object.