module lang::dot::Dot
rascal-0.40.16
Usage
import lang::dot::Dot;
Dependencies
import String;
import Set;
import Map;
alias Id
str
data DotGraph
Abstract Data Type of Dot language.
data DotGraph
= graph(Id id, Stms stmts)
| digraph(Id id, Stms stmts)
;
alias Stms
list[Stm]
alias NodeId
tuple[Id, PortId]
alias PortId
tuple[Id, CompassPt]
data CompassPt
data CompassPt
= N()
| NE()
| E()
| SE()
| S()
| SW()
| W()
| NW()
| C()
| _()
;
data Stm
data Stm
= N(Id id, Attrs attrs)
| N(Id id)
| N(NodeId nid, Attrs attrs)
| N(NodeId nid)
| E(Id from, Id to, Attrs attrs)
| E(Id from, Id to)
| E(NodeId nfrom, Id to, Attrs attrs)
| E(NodeId nfrom, Id to)
| E(Stm sfrom, Id to, Attrs attrs)
| E(Stm sfrom, Id to)
| E(Id from, NodeId nto, Attrs attrs)
| E(Id from, NodeId nto)
| E(NodeId nfrom, NodeId nto, Attrs attrs)
| E(NodeId nfrom, NodeId nto)
| E(Stm sfrom, NodeId nto, Attrs attrs)
| E(Stm sfrom, NodeId nto)
| E(Id from, Stm sto, Attrs attrs)
| E(Id from, Stm sto)
| E(NodeId nfrom, Stm sto, Attrs attrs)
| E(NodeId nfrom, Stm sto)
| E(Stm sfrom, Stm sto, Attrs attrs)
| E(Stm sfrom, Stm sto)
| S(Id id, Stms stms)
| S(Stms stms)
| A(Id prop, Id val)
| GRAPH(Attrs attrs)
| NODE(Attrs attrs)
| EDGE(Attrs attrs)
;
alias Attr
tuple[str prop, Id val]
alias Attrs
list[Attr]
alias Outline
map[int key, list[str] args]
alias Dotline
tuple[DotGraph graph, Outline outline]
function export
Dummy function call needed to tag initialized global variables of type DotGraph. It is possible to select that variable on the outline menu of the Rascal Editor. An application is for example to display dotgraphs.
DotGraph export(DotGraph g)
Dotline export(Dotline g)
function hasOutline
bool hasOutline(Dotline _)
bool hasOutline(DotGraph _)
function setCurrentOutline
void setCurrentOutline(Dotline current)
function toString
Translates DotGraph to String input for dot.
str toString(digraph(Id id,Stms stms))
str toString(Dotline g)
function getChildren
list[value] getChildren(value key)
function reLabel
str reLabel(str prop, str val)
function oAttrs
str oAttrs(Attrs attrs)
function oCompassPt
str oCompassPt(N())
str oCompassPt(NE())
str oCompassPt(E())
str oCompassPt(SE())
str oCompassPt(S())
str oCompassPt(SW())
str oCompassPt(W())
str oCompassPt(NW())
default str oCompassPt(CompassPt _)
function oPortId
str oPortId(PortId id)
function oNodeId
str oNodeId(NodeId id)
function oStms
str oStms(Stms stms, str sep)
function oStm
str oStm( N(Id id))
str oStm( N(Id id, Attrs attrs))
str oStm( E(Id from, Id to))
str oStm( E(Id from, Id to, Attrs attrs))
str oStm( E(NodeId from, Id to))
str oStm( E(Stm from, Id to))
str oStm( E(Stm from, Id to, Attrs attrs))
str oStm( E(Id from, NodeId to))
str oStm( E(Id from, NodeId to, Attrs attrs))
str oStm( E(NodeId from, NodeId to))
str oStm( E(Stm from, NodeId to))
str oStm( E(Stm from, NodeId to, Attrs attrs))
str oStm( E(Id from, Stm to))
str oStm( E(Id from, Stm to, Attrs attrs))
str oStm( E(NodeId from, Stm to))
str oStm( E(Stm from, Stm to))
str oStm( E(Stm from, Stm to, Attrs attrs))
str oStm( S(Stms stms))
str oStm( S(Id id, Stms stms))
str oStm( A(Id prop, Id val))
str oStm( GRAPH(Attrs attrs))
str oStm( EDGE(Attrs attrs))
str oStm( NODE(Attrs attrs))