lua/visitors/visualizer library

Classes

GzBaseNode
DOT language Graph Viz markup node. Every node is given a unique key from the ever-increasing GzBaseNode.globalKeys counter. This ensures nodes in the Lua AST can be uniquely identified even if they contain similar content. This is utilized by GzBaseNode.stubId. If a node's label is non-empty, then GzBaseNode.stubLabel will construct the expression to set that attribute in DOT language.
GzChunk
Represents a chunk in a DOT graph as the AST visits every Lua node. It introduces new nodes and links them together in the GzChunk.toString implementation which should be called in GzGraph.toString only.
GzGraph
Represents the graph block in DOT language. Introduces new getters GzGraph.stubHeaders and GzGraph.stubBody which fill the graph with nodes and links them together respectively.
GzNode
Represents a DOT node that has no children.
Visualizer
Walks the AST and generates a new AST corresponding to DOT language nodes which can render a graph for visualizing in DOT preview tools. The highest node will be a GzGraph whose GzGraph.label is "Program".

Constants

muave → const String
pink → const String
seafoamGreen → const String
Note that I am color coding the LUA AST as follows:
skyBlue → const String

Functions

node(String id, {List<GzBaseNode>? children, String? label, String? color, String? fontColor, String? shape}) GzBaseNode
A shorthand util that constructs either a GzChunk node or a GzNode based on whether or not children are provided.
quote(String s) String
Helper util to quote strings.