DME — Code Reflection¶
- class avulto.DME¶
A representation of a single Dreammaker environment.
The
DMEclass provides reflection information for a BYOND project. This includes looking up available types, proc and var names on those types, and basic support for AST walking.DMEinstances are created with the following methods:- static from_file(filename: os.PathLike[str] | str, parse_procs: bool = False) DME¶
Read the BYOND environment from the filename referring to a “.dme” file.
- Parameters:
filename – Path to the “.dme” file.
parse_procs – If
True, parsing is slower but reflection data is made available for all procs.
- Raises:
OSError – If the file is not found or there was an error opening it.
RuntimeError – If there was an error parsing the DME environment.
Once instantiated, the following properties and methods are available:
- property types: dict[TypePath | str, TypeDef]¶
A mapping of paths in the DME to their type definitions.
- class avulto.ProcDef¶
A single proc declaration.
- walk(walker: Any) None¶
Walk this proc’s AST with walker.
For each node class
Xinast.Nodeandast.Expression, walker may definevisit_X(node, source_loc); it is called with the node and itsSourceLoc. Undefined methods are skipped. As withast.NodeVisitor, the children of a node handled by a custom visitor are not visited.There is currently no analogous
generic_visitsupport.
- class avulto.VarDef¶
A single variable declaration.
- property type_path: Any¶
The type path the proc is declared on.
- class avulto.TypeDef¶
A single type declaration.
- property procs: ProcHolder¶
A class to access procs on this typepath.
- class avulto.ProcHolder¶
A collection of the procs on a
TypeDef, returned fromTypeDef.procs.
- class avulto.VarHolder¶
A collection of the vars on a
TypeDef, returned fromTypeDef.vars.- iter(vars)
Return an iterator over every
VarDefon the type.