Index of sample files created by MarpaX::Languages::Dash V 1.00.

This demo was created as part of my article Conditional preservation of whitespace when parsing with Marpa::R2.

More-or-less all the coding effort has gone into the problem of handling the various quoting rules (below).

I'm currently (2016-12-25) using Marpa::R2 V 3.


All input files and output files required to generate these examples are shipped in the MarpaX::Languages::Dash distro.


Herewith a brief summary of the syntax.
This syntax is a cut-down version of Graphviz's DOT language.
Some sample data might not be acceptable to Graphviz. If it is, there will be an image on the right-hand-side.

ElementSyntax
Edge namesEither '->' or '--'.
Node names 1: Delimited by '[' and ']'.
2: May be quoted with " or '.
3: Escaped characters, using '\', are allowed.
4: Internal spaces in node names are preserved even if not quoted.
Both edges and nodes can have attributes.
Attributes 1: Delimited by '{' and '}'.
2: Within that, any number of "key : value" pairs separated by ';'.
3: Values may be quoted with " or ' or '<...>' or '<<table>...</table>>'.
4: Escaped characters, using '\', are allowed.
5: Internal spaces in attribute values are preserved even if not quoted.

Input file # 1 - data/edge.01.dash:
# Edge with attributes. OK.
-> {color:cornflowerblue; label: This edge's color is blueish ;}
# Edge with attributes. OK.

Output file # 1 - html/edge.01.svg
Input file # 2 - data/edge.02.dash:
# Juxtaposed edges (without comma) with attributes. OK.
-- {color: cornflowerblue; label: Top row\nBottom row}
-- {color:red; label: Edges use cornflowerblue and red}
# Juxtaposed edges (without comma) with attributes. OK.

Output file # 2 - html/edge.02.svg
Input file # 3 - data/edge.03.dash:
# Edge followed by node. OK.
-> [node.1]{label: \N }
# Edge followed by node. OK.

Output file # 3 - html/edge.03.svg
Input file # 4 - data/edge.04.dash:
# Edges with fancy arrows. OK.
[node.1] {label: Node 1} -> {arrowhead: box; dir: forward; label: A box} [node.2]{color:blue}
[node.3] {label: 'Node 3'} -> {arrowhead: crow; dir: forward; label: A crow} [node.4]{color:blue}
[node.5] {label: "Node 5"} -> {arrowhead: diamond; dir: forward; label: A diamond} [node.6]{color:blue}
[node.7] {label: <Node 7>} -> {arrowhead: veevee; dir: forward; label: A veevee} [node.8]{color:blue}
[node.9] {label: Node 9} -> {arrowhead: teetee; dir: forward; label: A teetee} [node.10]{color:blue}
# Edges with fancy arrows. OK.

Output file # 4 - html/edge.04.svg
Input file # 5 - data/edge.05.dash:
# Edge with attributes. OK.
-> {color:cornflowerblue; label: Use various escaped chars (\' \" \< \>) in label}
# Edge with attributes. OK.

Output file # 5 - html/edge.05.svg
Input file # 6 - data/edge.06.dash:
# Juxtaposed edges (without any spacing) without attributes. OK.
------
# Juxtaposed edges (without any spacing) without attributes. OK.

Output file # 6 - html/edge.06.svg
Input file # 7 - data/graph.01.dash:
# Ends with edge without attributes. OK.
[node.1]{color: red; label: Node A}
->{color: green; label: Edge B;}
->{color: red; label: Edge C C ; }
[node.2]
->
# Ends with edge without attributes. OK.

Output file # 7 - html/graph.01.svg
Input file # 8 - data/graph.02.dash:
# Juxtapositioned edges (without comma). OK.
[node] {label: "n 1"}
-> {label: 'e 1'}
-> {label: e 2}
[] {label: n 2}
-> {label : e 3}
# Juxtapositioned edges (without comma). OK.

Output file # 8 - html/graph.02.svg
Input file # 9 - data/graph.03.dash:
# Juxtapositioned edges (with and without commas). OK.
[node.1] {label: "n 1"}
-> {label: 'e 1'}
-> {label: e 2}
[] {label: n 2}
-> {label : e 3}
[node.3] {label: "n 3"}
-> {label: 'e 4'},
-> {label: e 5}
[] {label: n 2}
-> {label : e 6}
# Juxtapositioned edges (with and without commas). OK.

Output file # 9 - html/graph.03.svg
Input file # 10 - data/graph.04.dash:
# Juxtapositioned edges (-> -> twice). OK.
->
->

[node]
[node] ->
-> {label: Start} -> {color: red} [node.1] {color: green} -> [node.2]
[node.1] [node.2] [node.3]

[]
[node.1]
[node 1]
[\[node\]]
["node"]
[ From here ] -> [ To there ]
# Juxtapositioned edges (-> -> twice). OK.

Output file # 10 - html/graph.04.svg
Input file # 11 - data/node.01.dash:
# Anonymous node. OK.
[]
# Anonymous node. OK.

Output file # 11 - html/node.01.svg
Input file # 12 - data/node.02.dash:
# Named node with space. OK.
[Perl 6] {color: red}
# Named node with space. OK.

Output file # 12 - html/node.02.svg
Input file # 13 - data/node.03.dash:
# Anonymous node with attributes. OK.
[]{color:red}
# Anonymous node with attributes. OK.

Output file # 13 - html/node.03.svg
Input file # 14 - data/node.04.dash:
# Juxtaposed nodes (without comma) with attributes. OK.
[node.1]{label: A and B}
[node.2]{label : A or B}
# Juxtaposed nodes (without comma) with attributes. OK.

Output file # 14 - html/node.04.svg
Input file # 15 - data/node.05.dash:
# Named node, with spaces. OK.
[ node.1 ]
# Named node, with spaces. OK.

Output file # 15 - html/node.05.svg
Input file # 16 - data/node.06.dash:
# Named node with attributes, with spaces. OK.
[ node.1 ] { label : ' A Z ' }
# Named node with attributes, with spaces. OK.

Output file # 16 - html/node.06.svg
Input file # 17 - data/node.07.dash:
# Named node with attributes, with spaces. OK.
[ node.1 ] { label : Flight Path from Melbourne to London }
# Named node with attributes, with spaces. OK.

Output file # 17 - html/node.07.svg
Input file # 18 - data/node.08.dash:
# Complete graph. OK.
[node.1]
-> {arrowhead: odot; arrowtail: ediamond; color: green; dir: both; label: A 1; penwidth: 1}
-> {color: blue; label: B 2; penwidth: 3}
-> {arrowhead: box; arrowtail: invdot; color: maroon; dir: both; label: C 3; penwidth: 5}
[] {label: 'Some node'}
-> [node.2]
# Complete graph. OK.

Output file # 18 - html/node.08.svg
Input file # 19 - data/node.09.dash:
# Named node with escape chars. OK.
[\[node\]]
# Named node with escape chars. OK.

Output file # 19 - html/node.09.svg
Input file # 20 - data/node.10.dash:
# Named node with [] in name. OK.
[[ \]]
# Named node with [] in name. OK.

Output file # 20 - html/node.10.svg
Input file # 21 - data/node.11.dash:
# Named node with escape chars. OK.
[" a \' b \" c"]
# Named node with escape chars. OK.

Output file # 21 - html/node.11.svg
Input file # 22 - data/quote.01.dash:
# Named node with ; in label. OK.
[node] {color: red; label: \; ; shape: square}
# Named node with ; in label. OK.

Output file # 22 - html/quote.01.svg
Input file # 23 - data/quote.02.dash:
# Named node with ; in label. OK.
[node] {color: red; label: ";" ; shape: square}
# Named node with ; in label. OK.

Output file # 23 - html/quote.02.svg
Input file # 24 - data/quote.03.dash:
# Named node with ; in label. OK.
[node] {color: red; label: ';' ; shape: square}
# Named node with ; in label. OK.

Output file # 24 - html/quote.03.svg
Input file # 25 - data/quote.04.dash:
# Named node with ; in label. OK.
[node] {color: red; label: <;>; shape: square}
# Named node with ; in label. OK.

Output file # 25 - html/quote.04.svg
Input file # 26 - data/quote.05.dash:
# Named node with ; in label. OK.
[node.1] {color: pink; label: <<table border='1'><tr><td>;</td></tr></table>>; shape: rectangle}
# Named node with ; in label. OK.

Output file # 26 - html/quote.05.svg
Input file # 27 - data/quote.06.dash:
# Named node with " in label. OK.
[node] {color: red; label: \"; shape: square}
# Named node with " in label. OK.

Output file # 27 - html/quote.06.svg
Input file # 28 - data/quote.07.dash:
# Named node with " in label. OK.
[node] {color: red; label: '"' ; shape: square}
# Named node with " in label. OK.

Output file # 28 - html/quote.07.svg
Input file # 29 - data/quote.08.dash:
# Named node with " in label. OK.
[node] {color: red; label: <"> ; shape: square}
# Named node with " in label. OK.

Output file # 29 - html/quote.08.svg
Input file # 30 - data/quote.09.dash:
# Named node with " in label. OK.
[node.1] {color: pink; label: <<table border='1'><tr><td>"</td></tr></table>>; shape: rectangle}
# Named node with " in label. OK.

Output file # 30 - html/quote.09.svg
Input file # 31 - data/quote.10.dash:
# Named node with ' in label. OK.
[node] {color: red; label: \'; shape: square}
# Named node with ' in label. OK.

Output file # 31 - html/quote.10.svg
Input file # 32 - data/quote.11.dash:
# Named node with ' in label. OK.
[node] {color: red; label: "'"; shape: square}
# Named node with ' in label. OK.

Output file # 32 - html/quote.11.svg
Input file # 33 - data/quote.12.dash:
# Named node with ' in label. OK.
[node] {color: red; label: <'> ; shape: square}
# Named node with ' in label. OK.

Output file # 33 - html/quote.12.svg
Input file # 34 - data/quote.13.dash:
# Named node with ' in label. OK.
[node.1] {color: pink; label: <<table border='1'><tr><td>'</td></tr></table>>; shape: rectangle}
# Named node with ' in label. OK.

Output file # 34 - html/quote.13.svg
Input file # 35 - data/quote.14.dash:
# Named node with } in label. OK.
[node] {color: red; label: \} ; shape: square}
# Named node with } in label. OK.

Output file # 35 - html/quote.14.svg
Input file # 36 - data/quote.15.dash:
# Named node with } in label. OK.
[node] {color: red; label: "}"; shape: square}
# Named node with } in label. OK.

Output file # 36 - html/quote.15.svg
Input file # 37 - data/quote.16.dash:
# Named node with } in label. OK.
[node] {color: red; label: '}'; shape: square}
# Named node with } in label. OK.

Output file # 37 - html/quote.16.svg
Input file # 38 - data/quote.17.dash:
# Named node with } in label. OK.
[node] {color: red; label: <}>; shape: square}
# Named node with } in label. OK.

Output file # 38 - html/quote.17.svg
Input file # 39 - data/quote.18.dash:
# Named node with } in label. OK.
[node.1] {color: green; label: <<table border='1'><tr><td>}</td></tr></table>>; shape: rectangle}
# Named node with } in label. OK.

Output file # 39 - html/quote.18.svg
Input file # 40 - data/quote.19.dash:
# Named node with < in label. OK.
[node.1] {color: green; label: '<'; shape: rectangle}
# Named node with < in label. OK.

Output file # 40 - html/quote.19.svg
Input file # 41 - data/quote.20.dash:
# Named node with > in label. OK.
[node.1] {color: green; label: '>'; shape: rectangle}
# Named node with > in label. OK.

Output file # 41 - html/quote.20.svg
Input file # 42 - data/quote.21.dash:
# Named node with << in label. OK.
[node.1] {color: green; label: '<<'; shape: rectangle}
# Named node with << in label. OK.

Output file # 42 - html/quote.21.svg
Input file # 43 - data/quote.22.dash:
# Named node with >> in label. OK.
[node.1] {color: green; label: '>>'; shape: rectangle}
# Named node with >> in label. OK.

Output file # 43 - html/quote.22.svg
Input file # 44 - data/table.01.dash:
# Node with HTML-style and ' in label. OK.
[node.1] {color: pink; label: <<table border='1'><tr><td>HTML-style label and '</td></tr></table>>; shape: rectangle}
# Node with HTML-style and ' in label. OK.

Output file # 44 - html/table.01.svg
Input file # 45 - data/table.02.dash:
# Node with HTML-style and " in label. OK.
[node.1] {color: pink; label: <<table border="1"><tr><td>HTML-style label and "</td></tr></table>>; shape: rectangle}
# Node with HTML-style and " in label. OK.

Output file # 45 - html/table.02.svg
Input file # 46 - data/table.03.dash:
# Node with HTML-style and " and ' in label. OK.
[node.1] {color: pink; label: <<table border="1"><tr><td>HTML-style label and " and '</td></tr></table>>; shape: rectangle}
# Node with HTML-style and " and ' in label. OK.

Output file # 46 - html/table.03.svg
Input file # 47 - data/table.04.dash:
# Node with HTML-style and ' and " in label. OK.
[node.1] {color: pink; label: <<table border='1'><tr><td>HTML-style label and ' and "</td></tr></table>>; shape: rectangle}
# Node with HTML-style and ' and " in label. OK.

Output file # 47 - html/table.04.svg
Input file # 48 - data/table.05.dash:
# Node with HTML-style and ' label. OK.
[node.1] {color: red; label: <<table border='0'><tr><td>HTML-style label but without borders</td></tr></table>>; shape: tripleoctagon}
# Node with HTML-style and ' label. OK.

Output file # 48 - html/table.05.svg
Input file # 49 - data/table.06.dash:
# Node with HTML-style and " label. OK.
[node.1] {color: red; label: <<table border="0"><tr><td>HTML-style label but without borders</td></tr></table>>; shape: tripleoctagon}
# Node with HTML-style and " label. OK.

Output file # 49 - html/table.06.svg
Input file # 50 - data/table.07.dash:
# Node with HTML-style entities in label. OK.
[node.1] {color: pink; label: <<table border='1'><tr><td>HTML-style entities: &amp;, &lt;, &gt; and &quot; in label</td></tr></table>>; shape: rectangle}
# Node with HTML-style entities in label. OK.

Output file # 50 - html/table.07.svg
Input file # 51 - data/utf8.01.dash:
# Graph with utf8 attributes. OK.
[From]{color: green; label: Reichwaldstraße}
-> {color:red; label: Πηληϊάδεω Ἀχιλῆος}
[To]{color: blue; label: Δ Lady}
# Graph with utf8 attributes. OK.

Output file # 51 - html/utf8.01.svg

Links

Index page for all graph module demos


Environment

Author
Date
2016-12-25
OS
Debian V 8.6
Perl
5.20.2