Skip to content

encoding/dot: support edge ports on Unmarshal/decode

Sebastien Binet requested to merge 32bitkid:decode-edge-ports into master

Created by: 32bitkid

This PR introduces a new interface for emitting DOT :port:compass information on Unmarshal() (resolves #462 (closed))

Internal changes:

The parser now returns the ast.CompassPointNone if a compass direction is undefined in the source graph. This allows for disambiguation between a non-defined compass direction and the explicit default override _.

Potentially interesting/related changes:

This change apllies ports through an edge chain, however, I don't think the general attributes get applied in the same way. For instance, the follow graphs are equivalent:

digraph {
  a:p1 -> b:p2 -> c:p3
}

digraph {
  a:p1 -> b:p2 
  b:p2 -> c:p3
}

However, the same is not true for edge attributes, which I think the reference DOT implementation does:

digraph {
  a -> b -> c [color=red]
}

digraph {
  a -> b [color=red]
  b -> c [color=red]
}

However, I think attribute application across a chained-edge should probably be addressed in a different PR. But I'm open to rethink that/discuss it.

Merge request reports