Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Visualize ¶
func Visualize(code string, targetFunction string, splitFiles bool, output ...io.Writer) (map[string][]byte, error)
Visualize parses the provided Piton source code and generates a graphical representation of the program's logic.
The process follows a strict pipeline:
- Lexer: Breaks the raw string into a stream of tokens.
- Parser: Constructs an Abstract Syntax Tree (AST) from the tokens.
- Visualizer: Traverses the AST to produce a D2-based diagram following flowchart standards.
Parameters:
- targetFunction: If non-empty, generates a diagram ONLY for the specified function.
- splitFiles: If true, generates a separate diagram for each function in the code.
Returns a map where keys are suggested filenames (e.g., "main_myFunc.svg" or "flowchart.svg") and values are the rendered SVG byte slices. Returns an error if lexical or structural analysis fails.
func VisualizeProject ¶
func VisualizeProject(entryFilePath, targetFunction string, splitFiles bool, output ...io.Writer) (map[string][]byte, error)
VisualizeProject parses the provided entry Piton file and automatically resolves all its dependencies ('vykorystaty' statements) to generate a comprehensive flowchart of the entire project's logic.
Unlike Visualize, which only processes a single isolated file or string, this function delegates the creation of a unified Abstract Syntax Tree (AST) to the interpreter.
The process follows a strict pipeline:
- Interpreter: Reads the entry file, recursively resolves and parses all imported modules, and merges their functions into a single "Super AST".
- Visualizer: Traverses this complete AST to produce unified or split D2-based diagrams following flowchart standards.
Parameters:
- entryFilePath: The path to the main Piton file.
- targetFunction: If non-empty, generates a diagram ONLY for the specified function.
- splitFiles: If true, generates a separate diagram for each function across all modules.
Returns a map where keys are suggested filenames (e.g., "math_average.svg") and values are the rendered SVG byte slices. Returns an error if file reading, parsing, or import resolution fails.
Types ¶
This section is empty.