parse_scene#
Import |
|
Defined in |
|
Install |
|
Since |
0.1 |
Stability |
Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how. |
- scenet.frontends.yaml_front.parse_scene(text, *, source=None)[source]#
Parse a multi-panel document, resolving
overinheritance.A document with a top-level
panels:mapping holds a sequence; anything else is treated as a single panel named “panel”, so the two forms share one entry point and a single-panel file needs no ceremony.Panel order follows declaration order, which is reading order.
page:andpages:are read and checked, but only the panels come back: seeparse_scene_document.- Parameters:
- Return type:
- Returns:
Panel name to scene graph, each with the chain of
overit names already resolved.- Raises:
PanelSyntaxError – The document is malformed, or a panel does not validate.
CompositionError – An
over:names a panel that does not exist, or the chain is a cycle.
Note
Pages are not read:
parse_scene_documentkeeps them.Example
>>> from scenet import parse_scene >>> panels = parse_scene( ... "panels: {wide: {cast: {a: {reference: alice}}}, close: {over: wide}}" ... ) >>> list(panels), list(panels["close"].cast) (['wide', 'close'], ['a'])
See also
compile_scene, to compile it.