graphviz: add an extra - to all graphviz shorthand to avoid conflicting with --.
Maybe we should rethink the graphviz syntax.locals-and-roots
parent
7db66ff8fe
commit
1f53ae307b
|
@ -103,22 +103,22 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
"filled" =style
|
"filled" =style
|
||||||
"lightgrey" =color
|
"lightgrey" =color
|
||||||
node[ "filled" =style "white" =color ]
|
node[ "filled" =style "white" =color ]
|
||||||
{ "a0" "a1" "a2" "a3" } ~->
|
{ "a0" "a1" "a2" "a3" } ~-->
|
||||||
"process #1" =label
|
"process #1" =label
|
||||||
add
|
add
|
||||||
1 <cluster>
|
1 <cluster>
|
||||||
node[ "filled" =style ]
|
node[ "filled" =style ]
|
||||||
{ "b0" "b1" "b2" "b3" } ~->
|
{ "b0" "b1" "b2" "b3" } ~-->
|
||||||
"process #2" =label
|
"process #2" =label
|
||||||
"blue" =color
|
"blue" =color
|
||||||
add
|
add
|
||||||
"start" "a0" ->
|
"start" "a0" -->
|
||||||
"start" "b0" ->
|
"start" "b0" -->
|
||||||
"a1" "b3" ->
|
"a1" "b3" -->
|
||||||
"b2" "a3" ->
|
"b2" "a3" -->
|
||||||
"a3" "a0" ->
|
"a3" "a0" -->
|
||||||
"a3" "end" ->
|
"a3" "end" -->
|
||||||
"b3" "end" ->
|
"b3" "end" -->
|
||||||
"start" add-node[ "Mdiamond" =shape ]
|
"start" add-node[ "Mdiamond" =shape ]
|
||||||
"end" add-node[ "Msquare" =shape ]
|
"end" add-node[ "Msquare" =shape ]
|
||||||
;
|
;
|
||||||
|
@ -139,7 +139,7 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
edge[ "invis" =style ]
|
edge[ "invis" =style ]
|
||||||
0 add-node[ "invis" =style "none" =shape ]
|
0 add-node[ "invis" =style "none" =shape ]
|
||||||
16 iota [
|
16 iota [
|
||||||
[ 0 -- ] [ colored-circle add ] bi
|
[ 0 --- ] [ colored-circle add ] bi
|
||||||
] each ;
|
] each ;
|
||||||
|
|
||||||
: dfa-example ( -- graph )
|
: dfa-example ( -- graph )
|
||||||
|
@ -149,20 +149,20 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
node[ "doublecircle" =shape ]
|
node[ "doublecircle" =shape ]
|
||||||
{ "LR_0" "LR_3" "LR_4" "LR_8" } add-nodes
|
{ "LR_0" "LR_3" "LR_4" "LR_8" } add-nodes
|
||||||
node[ "circle" =shape ]
|
node[ "circle" =shape ]
|
||||||
"LR_0" "LR_2" ->[ "SS(B)" =label ]
|
"LR_0" "LR_2" -->[ "SS(B)" =label ]
|
||||||
"LR_0" "LR_1" ->[ "SS(S)" =label ]
|
"LR_0" "LR_1" -->[ "SS(S)" =label ]
|
||||||
"LR_1" "LR_3" ->[ "S($end)" =label ]
|
"LR_1" "LR_3" -->[ "S($end)" =label ]
|
||||||
"LR_2" "LR_6" ->[ "SS(b)" =label ]
|
"LR_2" "LR_6" -->[ "SS(b)" =label ]
|
||||||
"LR_2" "LR_5" ->[ "SS(a)" =label ]
|
"LR_2" "LR_5" -->[ "SS(a)" =label ]
|
||||||
"LR_2" "LR_4" ->[ "S(A)" =label ]
|
"LR_2" "LR_4" -->[ "S(A)" =label ]
|
||||||
"LR_5" "LR_7" ->[ "S(b)" =label ]
|
"LR_5" "LR_7" -->[ "S(b)" =label ]
|
||||||
"LR_5" "LR_5" ->[ "S(a)" =label ]
|
"LR_5" "LR_5" -->[ "S(a)" =label ]
|
||||||
"LR_6" "LR_6" ->[ "S(b)" =label ]
|
"LR_6" "LR_6" -->[ "S(b)" =label ]
|
||||||
"LR_6" "LR_5" ->[ "S(a)" =label ]
|
"LR_6" "LR_5" -->[ "S(a)" =label ]
|
||||||
"LR_7" "LR_8" ->[ "S(b)" =label ]
|
"LR_7" "LR_8" -->[ "S(b)" =label ]
|
||||||
"LR_7" "LR_5" ->[ "S(a)" =label ]
|
"LR_7" "LR_5" -->[ "S(a)" =label ]
|
||||||
"LR_8" "LR_6" ->[ "S(b)" =label ]
|
"LR_8" "LR_6" -->[ "S(b)" =label ]
|
||||||
"LR_8" "LR_5" ->[ "S(a)" =label ]
|
"LR_8" "LR_5" -->[ "S(a)" =label ]
|
||||||
;
|
;
|
||||||
|
|
||||||
: record-example ( -- graph )
|
: record-example ( -- graph )
|
||||||
|
@ -210,23 +210,23 @@ SYMBOLS: supported-layouts supported-formats ;
|
||||||
"<f0> 0xf7fc43e0| | |1" =label
|
"<f0> 0xf7fc43e0| | |1" =label
|
||||||
]
|
]
|
||||||
|
|
||||||
"node0" "node1" ->[ "f0" =tailport "f0" =headport ]
|
"node0" "node1" -->[ "f0" =tailport "f0" =headport ]
|
||||||
"node0" "node2" ->[ "f1" =tailport "f0" =headport ]
|
"node0" "node2" -->[ "f1" =tailport "f0" =headport ]
|
||||||
"node1" "node3" ->[ "f0" =tailport "f0" =headport ]
|
"node1" "node3" -->[ "f0" =tailport "f0" =headport ]
|
||||||
"node1" "node4" ->[ "f1" =tailport "f0" =headport ]
|
"node1" "node4" -->[ "f1" =tailport "f0" =headport ]
|
||||||
"node1" "node5" ->[ "f2" =tailport "f0" =headport ]
|
"node1" "node5" -->[ "f2" =tailport "f0" =headport ]
|
||||||
"node4" "node3" ->[ "f0" =tailport "f0" =headport ]
|
"node4" "node3" -->[ "f0" =tailport "f0" =headport ]
|
||||||
"node4" "node6" ->[ "f1" =tailport "f0" =headport ]
|
"node4" "node6" -->[ "f1" =tailport "f0" =headport ]
|
||||||
"node4" "node10" ->[ "f2" =tailport "f0" =headport ]
|
"node4" "node10" -->[ "f2" =tailport "f0" =headport ]
|
||||||
"node6" "node3" ->[ "f0" =tailport "f0" =headport ]
|
"node6" "node3" -->[ "f0" =tailport "f0" =headport ]
|
||||||
"node6" "node7" ->[ "f1" =tailport "f0" =headport ]
|
"node6" "node7" -->[ "f1" =tailport "f0" =headport ]
|
||||||
"node6" "node9" ->[ "f2" =tailport "f0" =headport ]
|
"node6" "node9" -->[ "f2" =tailport "f0" =headport ]
|
||||||
"node7" "node3" ->[ "f0" =tailport "f0" =headport ]
|
"node7" "node3" -->[ "f0" =tailport "f0" =headport ]
|
||||||
"node7" "node1" ->[ "f1" =tailport "f0" =headport ]
|
"node7" "node1" -->[ "f1" =tailport "f0" =headport ]
|
||||||
"node7" "node8" ->[ "f2" =tailport "f0" =headport ]
|
"node7" "node8" -->[ "f2" =tailport "f0" =headport ]
|
||||||
"node10" "node11" ->[ "f1" =tailport "f0" =headport ]
|
"node10" "node11" -->[ "f1" =tailport "f0" =headport ]
|
||||||
"node10" "node12" ->[ "f2" =tailport "f0" =headport ]
|
"node10" "node12" -->[ "f2" =tailport "f0" =headport ]
|
||||||
"node11" "node1" ->[ "f2" =tailport "f0" =headport ]
|
"node11" "node1" -->[ "f2" =tailport "f0" =headport ]
|
||||||
;
|
;
|
||||||
|
|
||||||
:: with-global-value ( value variable quot -- )
|
:: with-global-value ( value variable quot -- )
|
||||||
|
|
|
@ -4,13 +4,19 @@ USING: graphviz graphviz.attributes help.markup help.syntax
|
||||||
kernel present sequences ;
|
kernel present sequences ;
|
||||||
IN: graphviz.notation
|
IN: graphviz.notation
|
||||||
|
|
||||||
{ add-edge \ add-edge[ -- ~-- \ --[ } related-words
|
{ add-edge \ add-edge[ --- ~--- \ ---[ } related-words
|
||||||
{ add-edge \ add-edge[ -> ~-> \ ->[ } related-words
|
{ add-edge \ add-edge[ --> ~--> \ -->[ } related-words
|
||||||
{
|
{
|
||||||
\ add-node[ \ add-edge[ \ --[ \ ->[ \ node[ \ edge[ \ graph[
|
\ add-node[
|
||||||
|
\ add-edge[
|
||||||
|
\ ---[
|
||||||
|
\ -->[
|
||||||
|
\ node[
|
||||||
|
\ edge[
|
||||||
|
\ graph[
|
||||||
} related-words
|
} related-words
|
||||||
|
|
||||||
HELP: --
|
HELP: ---
|
||||||
{ $values
|
{ $values
|
||||||
{ "graph" { $or graph subgraph } }
|
{ "graph" { $or graph subgraph } }
|
||||||
{ "tail" object }
|
{ "tail" object }
|
||||||
|
@ -29,9 +35,9 @@ HELP: --
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" 1 2 --"
|
" 1 2 ---"
|
||||||
" 3 4 --"
|
" 3 4 ---"
|
||||||
" 5 6 --"
|
" 5 6 ---"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
|
@ -44,7 +50,7 @@ HELP: --
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: ->
|
HELP: -->
|
||||||
{ $values
|
{ $values
|
||||||
{ "graph" { $or graph subgraph } }
|
{ "graph" { $or graph subgraph } }
|
||||||
{ "tail" object }
|
{ "tail" object }
|
||||||
|
@ -63,9 +69,9 @@ HELP: ->
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<digraph>"
|
"<digraph>"
|
||||||
" 1 2 ->"
|
" 1 2 -->"
|
||||||
" 3 4 ->"
|
" 3 4 -->"
|
||||||
" 5 6 ->"
|
" 5 6 -->"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
|
@ -78,7 +84,7 @@ HELP: ->
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: --[
|
HELP: ---[
|
||||||
{ $values
|
{ $values
|
||||||
{ "tail" object }
|
{ "tail" object }
|
||||||
{ "head" object }
|
{ "head" object }
|
||||||
|
@ -94,7 +100,7 @@ HELP: --[
|
||||||
"it looks better to write"
|
"it looks better to write"
|
||||||
{ $code
|
{ $code
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" 1 2 --[ \"red\" =color ]"
|
" 1 2 ---[ \"red\" =color ]"
|
||||||
}
|
}
|
||||||
"Compare this with the DOT language, where you'd write"
|
"Compare this with the DOT language, where you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
|
@ -105,7 +111,7 @@ HELP: --[
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: ->[
|
HELP: -->[
|
||||||
{ $values
|
{ $values
|
||||||
{ "tail" object }
|
{ "tail" object }
|
||||||
{ "head" object }
|
{ "head" object }
|
||||||
|
@ -157,7 +163,7 @@ HELP: add-edge[
|
||||||
"}"
|
"}"
|
||||||
}
|
}
|
||||||
$nl
|
$nl
|
||||||
"This has the advantage over " { $link \ --[ } " and " { $link \ ->[ } " of reading nicely for both directed " { $emphasis "and" } " undirected " { $link graph } "s."
|
"This has the advantage over " { $link \ ---[ } " and " { $link \ -->[ } " of reading nicely for both directed " { $emphasis "and" } " undirected " { $link graph } "s."
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -277,7 +283,7 @@ HELP: node[
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: ~--
|
HELP: ~---
|
||||||
{ $values
|
{ $values
|
||||||
{ "graph" { $or graph subgraph } }
|
{ "graph" { $or graph subgraph } }
|
||||||
{ "nodes" sequence }
|
{ "nodes" sequence }
|
||||||
|
@ -288,9 +294,9 @@ HELP: ~--
|
||||||
"Instead of writing"
|
"Instead of writing"
|
||||||
{ $code
|
{ $code
|
||||||
"<graph>"
|
"<graph>"
|
||||||
" 1 2 --"
|
" 1 2 ---"
|
||||||
" 2 3 --"
|
" 2 3 ---"
|
||||||
" 3 4 --"
|
" 3 4 ---"
|
||||||
}
|
}
|
||||||
"you can write"
|
"you can write"
|
||||||
{ $code
|
{ $code
|
||||||
|
@ -300,13 +306,13 @@ HELP: ~--
|
||||||
"whereas in the DOT language you'd write"
|
"whereas in the DOT language you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
"graph {"
|
"graph {"
|
||||||
" 1 -- 2 -- 3 -- 4"
|
" 1 --- 2 --- 3 --- 4"
|
||||||
"}"
|
"}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
HELP: ~->
|
HELP: ~-->
|
||||||
{ $values
|
{ $values
|
||||||
{ "graph" { $or graph subgraph } }
|
{ "graph" { $or graph subgraph } }
|
||||||
{ "nodes" sequence }
|
{ "nodes" sequence }
|
||||||
|
@ -324,7 +330,7 @@ HELP: ~->
|
||||||
"you can write"
|
"you can write"
|
||||||
{ $code
|
{ $code
|
||||||
"<digraph>"
|
"<digraph>"
|
||||||
" { 1 2 3 4 } ~->"
|
" { 1 2 3 4 } ~-->"
|
||||||
}
|
}
|
||||||
"whereas in the DOT language you'd write"
|
"whereas in the DOT language you'd write"
|
||||||
{ $code
|
{ $code
|
||||||
|
@ -408,17 +414,17 @@ ARTICLE: { "graphviz.notation" "synonyms" } "Aliases that resemble DOT code"
|
||||||
$nl
|
$nl
|
||||||
"Notation for edges without attributes:"
|
"Notation for edges without attributes:"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
\ --
|
\ ---
|
||||||
\ ->
|
\ -->
|
||||||
\ ~--
|
\ ~---
|
||||||
\ ~->
|
\ ~-->
|
||||||
}
|
}
|
||||||
"Notation for nodes/edges with local attributes:"
|
"Notation for nodes/edges with local attributes:"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
\ add-node[
|
\ add-node[
|
||||||
\ add-edge[
|
\ add-edge[
|
||||||
\ --[
|
\ ---[
|
||||||
\ ->[
|
\ -->[
|
||||||
}
|
}
|
||||||
"Notation for global attributes:"
|
"Notation for global attributes:"
|
||||||
{ $subsections
|
{ $subsections
|
||||||
|
|
|
@ -67,10 +67,10 @@ node node-attributes define-=attrs
|
||||||
|
|
||||||
COMPILE>
|
COMPILE>
|
||||||
|
|
||||||
ALIAS: -> add-edge ;
|
ALIAS: --> add-edge ;
|
||||||
ALIAS: -- add-edge ;
|
ALIAS: --- add-edge ;
|
||||||
ALIAS: ~-> add-path ;
|
ALIAS: ~--> add-path ;
|
||||||
ALIAS: ~-- add-path ;
|
ALIAS: ~--- add-path ;
|
||||||
|
|
||||||
SYNTAX: \ graph[ parse-quotation '[ <graph-attributes> @ add ] append! ;
|
SYNTAX: \ graph[ parse-quotation '[ <graph-attributes> @ add ] append! ;
|
||||||
SYNTAX: \ node[ parse-quotation '[ <node-attributes> @ add ] append! ;
|
SYNTAX: \ node[ parse-quotation '[ <node-attributes> @ add ] append! ;
|
||||||
|
@ -78,8 +78,8 @@ SYNTAX: \ edge[ parse-quotation '[ <edge-attributes> @ add ] append! ;
|
||||||
|
|
||||||
SYNTAX: \ add-node[ parse-quotation '[ <node> @ add ] append! ;
|
SYNTAX: \ add-node[ parse-quotation '[ <node> @ add ] append! ;
|
||||||
SYNTAX: \ add-edge[ parse-quotation '[ <edge> @ add ] append! ;
|
SYNTAX: \ add-edge[ parse-quotation '[ <edge> @ add ] append! ;
|
||||||
SYNTAX: \ ->[ parse-quotation '[ <edge> @ add ] append! ;
|
SYNTAX: \ -->[ parse-quotation '[ <edge> @ add ] append! ;
|
||||||
SYNTAX: \ --[ parse-quotation '[ <edge> @ add ] append! ;
|
SYNTAX: \ ---[ parse-quotation '[ <edge> @ add ] append! ;
|
||||||
|
|
||||||
! FIXME:
|
! FIXME:
|
||||||
! Can't really do add-path[ & add-nodes[ this way, since they
|
! Can't really do add-path[ & add-nodes[ this way, since they
|
||||||
|
|
Loading…
Reference in New Issue