ast

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 28, 2015 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Abstract Syntax Tree representing the DOT grammar

Index

Constants

View Source
const (
	FALSE = Bool(false)
	TRUE  = Bool(true)
)
View Source
const (
	GRAPH   = GraphType(false)
	DIGRAPH = GraphType(true)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AList

type AList []*Attr

func AppendAList

func AppendAList(as, a Elem) (AList, error)

func NewAList

func NewAList(a Elem) (AList, error)

func (AList) String

func (this AList) String() string

func (AList) Walk

func (this AList) Walk(v Visitor)

type Attr

type Attr struct {
	Field Id
	Value Id
}

func NewAttr

func NewAttr(f, v Elem) (*Attr, error)

func (*Attr) String

func (this *Attr) String() string

func (*Attr) Walk

func (this *Attr) Walk(v Visitor)

type AttrList

type AttrList []AList

func AppendAttrList

func AppendAttrList(as, a Elem) (AttrList, error)

func NewAttrList

func NewAttrList(a Elem) (AttrList, error)

func PutMap

func PutMap(attrmap map[string]string) AttrList

func (AttrList) GetMap

func (this AttrList) GetMap() map[string]string

func (AttrList) String

func (this AttrList) String() string

func (AttrList) Walk

func (this AttrList) Walk(v Visitor)

type Bool

type Bool bool

func (Bool) String

func (this Bool) String() string

func (Bool) Walk

func (this Bool) Walk(v Visitor)

type EdgeAttrs

type EdgeAttrs AttrList

func NewEdgeAttrs

func NewEdgeAttrs(a Elem) (EdgeAttrs, error)

func (EdgeAttrs) String

func (this EdgeAttrs) String() string

func (EdgeAttrs) Walk

func (this EdgeAttrs) Walk(v Visitor)

type EdgeOp

type EdgeOp bool
const (
	DIRECTED   EdgeOp = true
	UNDIRECTED EdgeOp = false
)

func (EdgeOp) String

func (this EdgeOp) String() string

func (EdgeOp) Walk

func (this EdgeOp) Walk(v Visitor)

type EdgeRH

type EdgeRH struct {
	Op          EdgeOp
	Destination Location
}

func (*EdgeRH) String

func (this *EdgeRH) String() string

func (*EdgeRH) Walk

func (this *EdgeRH) Walk(v Visitor)

type EdgeRHS

type EdgeRHS []*EdgeRH

func AppendEdgeRHS

func AppendEdgeRHS(e, op, id Elem) (EdgeRHS, error)

func NewEdgeRHS

func NewEdgeRHS(op, id Elem) (EdgeRHS, error)

func (EdgeRHS) String

func (this EdgeRHS) String() string

func (EdgeRHS) Walk

func (this EdgeRHS) Walk(v Visitor)

type EdgeStmt

type EdgeStmt struct {
	Source  Location
	EdgeRHS EdgeRHS
	Attrs   AttrList
}

func NewEdgeStmt

func NewEdgeStmt(id, e, attrs Elem) (*EdgeStmt, error)

func (EdgeStmt) String

func (this EdgeStmt) String() string

func (EdgeStmt) Walk

func (this EdgeStmt) Walk(v Visitor)

type Elem

type Elem interface {
	String() string
}

type Graph

type Graph struct {
	Type     GraphType
	Strict   bool
	Id       Id
	StmtList StmtList
}

func NewGraph

func NewGraph(t, strict, id, l Elem) (*Graph, error)

func (*Graph) String

func (this *Graph) String() string

func (*Graph) Walk

func (this *Graph) Walk(v Visitor)

type GraphAttrs

type GraphAttrs AttrList

func NewGraphAttrs

func NewGraphAttrs(a Elem) (GraphAttrs, error)

func (GraphAttrs) String

func (this GraphAttrs) String() string

func (GraphAttrs) Walk

func (this GraphAttrs) Walk(v Visitor)

type GraphType

type GraphType bool

func (GraphType) String

func (this GraphType) String() string

func (GraphType) Walk

func (this GraphType) Walk(v Visitor)

type Id

type Id string

func NewId

func NewId(id Elem) (Id, error)

func (Id) String

func (this Id) String() string

func (Id) Walk

func (this Id) Walk(v Visitor)

type Location

type Location interface {
	Elem
	Walkable

	GetId() Id
	GetPort() Port
	IsNode() bool
	// contains filtered or unexported methods
}

type NodeAttrs

type NodeAttrs AttrList

func NewNodeAttrs

func NewNodeAttrs(a Elem) (NodeAttrs, error)

func (NodeAttrs) String

func (this NodeAttrs) String() string

func (NodeAttrs) Walk

func (this NodeAttrs) Walk(v Visitor)

type NodeId

type NodeId struct {
	Id   Id
	Port Port
}

func MakeNodeId

func MakeNodeId(id string, port string) *NodeId

func NewNodeId

func NewNodeId(id Elem, port Elem) (*NodeId, error)

func (*NodeId) GetId

func (this *NodeId) GetId() Id

func (*NodeId) GetPort

func (this *NodeId) GetPort() Port

func (*NodeId) IsNode

func (this *NodeId) IsNode() bool

func (*NodeId) String

func (this *NodeId) String() string

func (*NodeId) Walk

func (this *NodeId) Walk(v Visitor)

type NodeStmt

type NodeStmt struct {
	NodeId *NodeId
	Attrs  AttrList
}

func NewNodeStmt

func NewNodeStmt(id, attrs Elem) (*NodeStmt, error)

func (NodeStmt) String

func (this NodeStmt) String() string

func (NodeStmt) Walk

func (this NodeStmt) Walk(v Visitor)

type Port

type Port struct {
	Id1 Id
	Id2 Id
}

TODO semantic analysis should decide which Id is an Id and which is a Compass Point

func NewPort

func NewPort(id1, id2 Elem) (Port, error)

func (Port) String

func (this Port) String() string

func (Port) Walk

func (this Port) Walk(v Visitor)

type Stmt

type Stmt interface {
	Elem
	Walkable
	// contains filtered or unexported methods
}

type StmtList

type StmtList []Stmt

func AppendStmtList

func AppendStmtList(ss, s Elem) (StmtList, error)

func NewStmtList

func NewStmtList(s Elem) (StmtList, error)

func (StmtList) String

func (this StmtList) String() string

func (StmtList) Walk

func (this StmtList) Walk(v Visitor)

type SubGraph

type SubGraph struct {
	Id       Id
	StmtList StmtList
}

func NewSubGraph

func NewSubGraph(id, l Elem) (*SubGraph, error)

func (*SubGraph) GetId

func (this *SubGraph) GetId() Id

func (*SubGraph) GetPort

func (this *SubGraph) GetPort() Port

func (*SubGraph) IsNode

func (this *SubGraph) IsNode() bool

func (*SubGraph) String

func (this *SubGraph) String() string

func (*SubGraph) Walk

func (this *SubGraph) Walk(v Visitor)

type Visitor

type Visitor interface {
	Visit(e Elem) Visitor
}

type Walkable

type Walkable interface {
	Walk(v Visitor)
}

Jump to

Keyboard shortcuts

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