Module ast

Source
Expand description

This module implements an Abstract Syntax Tree for Dot graphs. The main structure is Graph, which corresponds to the graph non-terminal in the grammar.

Re-exports§

pub use either;

Structs§

AList
A list of attributes. This corresponds to the a_list non-terminal of the grammar.
AttrList
A list of ALists, i.e. a list of list of attributes. This (strange) indirection is induced by the grammar. This structure corresponds to the attr_list non-terminal of the grammar.
EdgeRHS
The Right hand side of an edge description. This corresponds to the EdgeRHS non-terminal of the grammar. Notice that the grammar allows multiple EdgeRHS in sequence, to chain edges: A -> B -> C.
EdgeStmt
The description of an edge. This corresponds to the edge_stmt non-terminal of the grammar.
Graph
This structure is an AST for the DOT graph language. The generic A denotes the type of attributes. By default (and when parsing), it is (&'a str, &'a str), i.e. two strings, one for the key and one for the value of the attribute. The library provides functions to map from one type to an other.
Graphs
This is a thin wrapper over vectors of [Graph] in order to read files with multiple dotgraph descriptions.
ID
An identifier, i.e. “ID” in the grammar. Essentially a string.
NodeID
This structure corresponds to the node_id non-terminal of the grammar. If contains the identifier of the node, and possibly a port.
NodeStmt
This structure corresponds to the node_stmt non-terminal of the grammar. It is basically a node identifier attached to some attributes.
StmtList
A list of statements. This corresponds to the stmt_list non-terminal of the grammar.
Subgraph
A subgraph. This corresponds to the subgraph non-terminal of the grammar.

Enums§

AttrStmt
An attribute statement. This corresponds to the rule attr_stmt non-terminal of the grammar.
CompassPt
An enum that corresponds to the compass_pt non-terminal of the grammar.
GraphFromFileError
An error that can occur when reading from a file.
ParseError
This enum type contains errors that can occur when using a DotParser. In principle, those errors should never occur, as all parsing errors should be caught by DotParser::parse. Therefore, if such error occurs, it is a bug, probably a missing feature.
Port
This enum corresponds to the port non-terminal of the grammar.
Stmt
A statement of the graph. This corresponds to the stmt non-terminal of the grammar.

Type Aliases§

IOError
Type for I/O related errors. Those may occur when reading a file for parsing.
PestError
Type for errors that occur when parsing.