package astx

import "gonum.org/v1/gonum/graph/formats/dot/internal/astx"

Package astx implements utility functions for generating abstract syntax trees of Graphviz DOT graphs.

Index

Functions

func AppendAttr

func AppendAttr(list, attr interface{}) ([]*ast.Attr, error)

AppendAttr appends attr to the given attribute list.

func AppendAttrList

func AppendAttrList(optList, optAttrs interface{}) ([]*ast.Attr, error)

AppendAttrList appends the optional attrs to the given optional attribute list.

func AppendGraph

func AppendGraph(file, graph interface{}) (*ast.File, error)

AppendGraph appends graph to the given file.

func AppendStmt

func AppendStmt(list, stmt interface{}) ([]ast.Stmt, error)

AppendStmt appends stmt to the given statement list.

func NewAttr

func NewAttr(key, val interface{}) (*ast.Attr, error)

NewAttr returns a new attribute based on the given key-value pair.

func NewAttrList

func NewAttrList(attr interface{}) ([]*ast.Attr, error)

NewAttrList returns a new attribute list based on the given attribute.

func NewAttrStmt

func NewAttrStmt(kind, optAttrs interface{}) (*ast.AttrStmt, error)

NewAttrStmt returns a new attribute statement based on the given graph component kind and attributes.

func NewEdge

func NewEdge(directed, vertex, optTo interface{}) (*ast.Edge, error)

NewEdge returns a new edge based on the given edge direction, destination vertex and optional outgoing edge.

func NewEdgeStmt

func NewEdgeStmt(from, to, optAttrs interface{}) (*ast.EdgeStmt, error)

NewEdgeStmt returns a new edge statement based on the given source vertex, outgoing edge and optional attributes.

func NewFile

func NewFile(graph interface{}) (*ast.File, error)

NewFile returns a new file based on the given graph.

func NewGraph

func NewGraph(strict, directed, optID, optStmts interface{}) (*ast.Graph, error)

NewGraph returns a new graph based on the given graph strictness, direction, optional ID and optional statements.

func NewID

func NewID(id interface{}) (string, error)

NewID returns a new identifier based on the given ID token.

func NewNode

func NewNode(id, optPort interface{}) (*ast.Node, error)

NewNode returns a new node based on the given node id and optional port.

func NewNodeStmt

func NewNodeStmt(node, optAttrs interface{}) (*ast.NodeStmt, error)

NewNodeStmt returns a new node statement based on the given node and optional attributes.

func NewPort

func NewPort(id, optCompassPoint interface{}) (*ast.Port, error)

NewPort returns a new port based on the given id and optional compass point.

func NewStmtList

func NewStmtList(stmt interface{}) ([]ast.Stmt, error)

NewStmtList returns a new statement list based on the given statement.

func NewSubgraph

func NewSubgraph(optID, optStmts interface{}) (*ast.Subgraph, error)

NewSubgraph returns a new subgraph based on the given optional subgraph ID and optional statements.

Source Files

astx.go doc.go

Version
v0.15.1 (latest)
Published
Aug 16, 2024
Platform
linux/amd64
Imports
4 packages
Last checked
12 hours ago

Tools for package owners.