visualizer

package
v1.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 9 Imported by: 0

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:

  1. Lexer: Breaks the raw string into a stream of tokens.
  2. Parser: Constructs an Abstract Syntax Tree (AST) from the tokens.
  3. 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:

  1. Interpreter: Reads the entry file, recursively resolves and parses all imported modules, and merges their functions into a single "Super AST".
  2. 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL