Context¶
-
class
Cocotec.CocoPlatform.Coco.Context
¶ Contains AST nodes created from Coco files. A context is the main container for AST nodes created from Coco models.
Subclassed by Cocotec.CocoPlatform.Coco.Ide.ProjectContext, Cocotec.CocoPlatform.Coco.StandaloneContext
Public Functions
-
Cocotec.CocoPlatform.Coco.SourceRange
NodePosition
(Cocotec.CocoPlatform.Coco.Node node)¶ Returns the given node’s position in the Coco file.
-
List<Cocotec.CocoPlatform.Coco.Node>
ImportedModules
(Cocotec.CocoPlatform.Coco.Node module)¶ For a module, returns the list of non-stdlib modules that this module directly imports. This does not include transitive dependencies.
-
List<Cocotec.CocoPlatform.Coco.Node>
LoadedModules
()¶ Returns all modules that have been loaded into this context.
-
Cocotec.CocoPlatform.Coco.ArchitectureDiagram
GenerateArchitectureDiagram
(Cocotec.CocoPlatform.Coco.Node node, string font, bool componentNames, bool componentTypes, bool portNames, bool portTypes, bool hidePorts)¶ Generates a Graphviz diagram (rendered as SVG) of a component, recursively showing all subcomponents.
-
Cocotec.CocoPlatform.Coco.StateDiagram
GenerateStateDiagramGraph
(Cocotec.CocoPlatform.Coco.Node node, bool collapseEdges, bool hideTransitionLabels)¶ Generate dot graph(s) of any state machines found under the specified node. Returns an empty string if no state machines are found.
-
string
InjectStylesIntoStateDiagramSvg
(string diagramSvg)¶ Inject Coco CSS styling into the given state machine diagram generated by generate_state_diagram_graph() and rendered by ‘dot’ into an SVG graphics. The CSS styling text will be injected along with an enclosing style element directly after the first svg element opening. Returns a copy of the given SVG with the CSS injected or the empty string if the injecting failed.
-
bool
Generate
(Cocotec.CocoPlatform.Coco.CodeGenerationLanguage language, string outputDirectory)¶ Generates code from all modules that are currently loaded.
- Return
- true on error. Diagnostics will have been created on failure.
-
Cocotec.CocoPlatform.Coco.SourceRange