simvx.core.scene_io.syntax

How the scene editor refuses source it cannot read.

There is no subset any more. The editor reads and rewrites a scene through CPython’s own parser (:mod:simvx.core.scene_io.source), so the Python it accepts is exactly the Python that runs: a match, a parenthesized with, an except*, a type alias, a t-string or a PEP 758 except A, B: loads, opens, edits and saves like anything else. What this module used to hold – eight documented constructs, a classifier that named them, and the per-statement refusal that stopped an edit from rewriting lines inside one – is gone with the parser that needed it, because a file the reader cannot parse now has no statements to refuse an edit over: it does not open at all.

What is left is the one refusal that was always honest. Source that will not compile is refused at load, in CPython’s own words, with its line and its caret column, because a file that does not compile does not run either and there is nothing to show a reader of it.

class:

UnsupportedSceneSyntaxError keeps its name and its shape. Every editor call site catches it, and the name is the channel rather than a claim about which constructs are readable.

Module Contents

Classes

SyntaxIssue

One place the parser could not read, as it reported it.

Functions

refusal

Present a parse failure as the scene layer’s refusal to open subject.

Data

API

simvx.core.scene_io.syntax.__all__

[‘SyntaxIssue’, ‘UnsupportedSceneSyntaxError’, ‘refusal’]

exception simvx.core.scene_io.syntax.UnsupportedSceneSyntaxError(message: str, issues: list[simvx.core.scene_io.syntax.SyntaxIssue])[source]

Bases: ValueError

The scene holds source the parser cannot read, so it will not open.

Raised by :meth:~simvx.core.scene_io.SceneFile.load and

Meth:

~simvx.core.scene_io.SceneFile.from_source over source CPython itself refuses. The message is the parser’s own, so the author is told what is wrong with their file rather than what this layer’s limits are.

Attr:

issues carries the parse issues behind the refusal, first one first, for a caller that wants to place a marker rather than show a message.

Initialization

Initialize self. See help(type(self)) for accurate signature.

class __cause__
class __context__
__delattr__()
__dir__()
__eq__()
__format__()
__ge__()
__getattribute__()
__getstate__()
__gt__()
__hash__()
__le__()
__lt__()
__ne__()
__new__()
__reduce__()
__reduce_ex__()
__repr__()
__setattr__()
__setstate__()
__sizeof__()
__str__()
__subclasshook__()
class __suppress_context__
class __traceback__
add_note()
class args
with_traceback()
class simvx.core.scene_io.syntax.SyntaxIssue[source]

Bases: typing.NamedTuple

One place the parser could not read, as it reported it.

line: int

None

column: int

None

construct: str | None

None

message: str

None

describe() → str[source]

One line naming what is wrong and where it is, for a refusal.

simvx.core.scene_io.syntax.refusal(error: simvx.core.scene_io.source.SceneSyntaxError, *, subject: str) → simvx.core.scene_io.syntax.UnsupportedSceneSyntaxError[source]

Present a parse failure as the scene layer’s refusal to open subject.

subject is what holds the source (a path, "this source"). The parser’s message, line and caret column cross unedited: they are what the author needs in order to fix the file, and nothing here knows better.