comparison toolboxes/graph_visualisation/share/graphviz/doc/html/info/lang.html @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <!--
3 This is a generated document. Do not edit.
4 -->
5 <HTML VERSION="2.0">
6 <HEAD>
7 <TITLE>The DOT Language</TITLE>
8 </HEAD>
9 <BODY BGCOLOR=white>
10 <A NAME="top"></A>
11 <H1 ALIGN=CENTER>The DOT Language</H1>
12 <HR>
13 The following is an abstract grammar defining the DOT language.
14 Terminals are shown in bold font and nonterminals in italics.
15 Literal characters are given in single quotes.
16 Parentheses ( and ) indicate grouping when needed.
17 Square brackets [ and ] enclose optional items.
18 Vertical bars | separate alternatives.
19 <TABLE>
20 <TR>
21 <TD ALIGN=RIGHT><I>graph</I></TD>
22 <TD ALIGN=LEFT>:</TD>
23 <TD ALIGN=LEFT>[ <B>strict</B> ] (<B>graph</B> | <B>digraph</B>) [ <I>ID</I> ] <B>'{'</B> <I>stmt_list</I> <B>'}'</B></TD>
24 </TR>
25 <TR>
26 <TD ALIGN=RIGHT><I>stmt_list</I></TD>
27 <TD ALIGN=LEFT>:</TD>
28 <TD ALIGN=LEFT>[ <I>stmt</I> [ <B>';'</B> ] [ <I>stmt_list</I> ] ]</TD>
29 </TR>
30 <TR>
31 <TD ALIGN=RIGHT><I>stmt</I></TD>
32 <TD ALIGN=LEFT>:</TD>
33 <TD ALIGN=LEFT><I>node_stmt</I></TD>
34 </TR>
35 <TR>
36 <TD ALIGN=RIGHT></TD>
37 <TD ALIGN=LEFT>|</TD>
38 <TD ALIGN=LEFT><I>edge_stmt</I></TD>
39 </TR>
40 <TR>
41 <TD ALIGN=RIGHT></TD>
42 <TD ALIGN=LEFT>|</TD>
43 <TD ALIGN=LEFT><I>attr_stmt</I></TD>
44 </TR>
45 <TR>
46 <TD ALIGN=RIGHT></TD>
47 <TD ALIGN=LEFT>|</TD>
48 <TD ALIGN=LEFT><I>ID</I> <B>'='</B> <I>ID</I></TD>
49 </TR>
50 <TR>
51 <TD ALIGN=RIGHT></TD>
52 <TD ALIGN=LEFT>|</TD>
53 <TD ALIGN=LEFT><I>subgraph</I></TD>
54 </TR>
55 <TR>
56 <TD ALIGN=RIGHT><I>attr_stmt</I></TD>
57 <TD ALIGN=LEFT>:</TD>
58 <TD ALIGN=LEFT>(<B>graph</B> | <B>node</B> | <B>edge</B>) <I>attr_list</I></TD>
59 </TR>
60 <TR>
61 <TD ALIGN=RIGHT><I>attr_list</I></TD>
62 <TD ALIGN=LEFT>:</TD>
63 <TD ALIGN=LEFT><B>'['</B> [ <I>a_list</I> ] <B>']'</B> [ <I>attr_list</I> ]</TD>
64 </TR>
65 <TR>
66 <TD ALIGN=RIGHT><I>a_list</I></TD>
67 <TD ALIGN=LEFT>:</TD>
68 <TD ALIGN=LEFT><I>ID</I> [ <B>'='</B> <I>ID</I> ] [ <B>','</B> ] [ <I>a_list</I> ]</TD>
69 </TR>
70 <TR>
71 <TD ALIGN=RIGHT><I>edge_stmt</I></TD>
72 <TD ALIGN=LEFT>:</TD>
73 <TD ALIGN=LEFT>(<I>node_id</I> | <I>subgraph</I>) <I>edgeRHS</I> [ <I>attr_list</I> ]</TD>
74 </TR>
75 <TR>
76 <TD ALIGN=RIGHT><I>edgeRHS</I></TD>
77 <TD ALIGN=LEFT>:</TD>
78 <TD ALIGN=LEFT><I>edgeop</I> (<I>node_id</I> | <I>subgraph</I>) [ <I>edgeRHS</I> ]</TD>
79 </TR>
80 <TR>
81 <TD ALIGN=RIGHT><I>node_stmt</I></TD>
82 <TD ALIGN=LEFT>:</TD>
83 <TD ALIGN=LEFT><I>node_id</I> [ <I>attr_list</I> ]</TD>
84 </TR>
85 <TR>
86 <TD ALIGN=RIGHT><I>node_id</I></TD>
87 <TD ALIGN=LEFT>:</TD>
88 <TD ALIGN=LEFT><I>ID</I> [ <I>port</I> ]</TD>
89 </TR>
90 <TR>
91 <TD ALIGN=RIGHT><I>port</I></TD>
92 <TD ALIGN=LEFT>:</TD>
93 <TD ALIGN=LEFT><B>':'</B> <I>ID</I> [ <B>':'</B> <I>compass_pt</I> ]</TD>
94 </TR>
95 <TR>
96 <TD ALIGN=RIGHT></TD>
97 <TD ALIGN=LEFT>|</TD>
98 <TD ALIGN=LEFT><B>':'</B> <I>compass_pt</I></TD>
99 </TR>
100 <TR>
101 <TD ALIGN=RIGHT><I>subgraph</I></TD>
102 <TD ALIGN=LEFT>:</TD>
103 <TD ALIGN=LEFT>[ <B>subgraph</B> [ <I>ID</I> ] ] <B>'{'</B> <I>stmt_list</I> <B>'}'</B></TD>
104 </TR>
105 <TR>
106 <TD ALIGN=RIGHT><I>compass_pt</I></TD>
107 <TD ALIGN=LEFT>:</TD>
108 <TD ALIGN=LEFT>(<B>n</B> | <B>ne</B> | <B>e</B> | <B>se</B> | <B>s</B> | <B>sw</B> | <B>w</B> | <B>nw</B> | <B>c</B> | <B>_</B>)</TD>
109 </TR>
110 </TABLE>
111 <P>
112 The keywords <B>node</B>, <B>edge</B>, <B>graph</B>, <B>digraph</B>,
113 <B>subgraph</B>, and <B>strict</B> are case-independent.
114 Note also that the allowed compass point values are not keywords, so
115 these strings can be used elsewhere as ordinary identifiers and, conversely,
116 the parser will actually accept any identifier.
117 <P>
118 An <I>ID</I> is one of the following:
119 <MENU>
120 <LI> Any string of alphabetic (<TT>[a-zA-Z\200-\377]</TT>) characters, underscores (<TT>'_'</TT>) or
121 digits (<TT>[0-9]</TT>), not beginning with a digit;
122 <LI> a number [<tt>-</tt>]<sup>?</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>+</sup> | [<tt>0</tt>-<tt>9</tt>]<sup>+</sup>(<tt>.</tt>[<tt>0</tt>-<tt>9</tt>]<sup>*</sup>)<sup>?</sup> );
123 <LI> any double-quoted string (&quot;...&quot;) possibly containing escaped
124 quotes (\&quot;)<SUP>1</SUP>;
125 <LI> an <A NAME=html>HTML string</A> (&lt;...&gt;).
126 </MENU>
127 Note that in HTML strings, angle
128 brackets must occur in matched pairs, and unescaped newlines are allowed.
129 In addition, the content must be legal XML, so that the special XML
130 escape sequences for &quot;, &amp;, &lt;, and &gt; may be necessary
131 in order to embed these characters in attribute values or raw text.
132 <P>
133 Both quoted strings and HTML strings are scanned as a unit, so
134 any embedded comments will be treated as part of the strings.
135 <P>
136 An <I>edgeop</I> is <TT>-></TT> in directed graphs and <TT>--</TT> in
137 undirected graphs.
138 <P>
139 An <I>a_list</I> clause of the form <I>ID</I> is equivalent to
140 <I>ID</I><TT>=true</TT>.
141 <P>
142 The language supports C++-style comments: <TT>/* */</TT> and <TT>//</TT>.
143 In addition, a line beginning with a '#' character is considered a line
144 output from a C preprocessor (e.g., # 34 to indicate line 34 ) and discarded.
145 <P>
146 Semicolons aid readability but are not required except in the rare case
147 that a named subgraph with no body immediately preceeds an anonymous
148 subgraph, since the precedence rules cause this sequence to be parsed as
149 a subgraph with a heading and a body.
150 Also, any amount of whitespace may be inserted between terminals.
151 <P>
152 As another aid for readability, dot allows single logical lines to
153 span multiple physical lines using the standard C convention of a
154 backslash immediately preceding a newline character. In addition,
155 double-quoted strings can be concatenated using a '+' operator.
156 As HTML strings can contain newline characters, they do not support the
157 concatenation operator.
158 <H2>Semantic Notes</H2>
159 If a default attribute is
160 defined using a <B>node</B>, <B>edge</B>, or <B>graph</B> statement,
161 or by an attribute assignment not attached to a node or edge, any object of the
162 appropriate type defined afterwards will inherit this attribute value.
163 This holds until the default attribute is set to a new value, from which
164 point the new value is used. Objects defined before a default attribute
165 is set will have an empty string value attached to the attribute once
166 the default attribute definition is made.
167 <P>
168 Note, in particular, that a subgraph receives the attribute settings of
169 its parent graph at the time of its definition. This can be useful; for
170 example, one can assign a font to the root graph and all subgraphs will
171 also use the font. For some attributes, however, this property is
172 undesirable. If one attaches a label to the root graph, it is probably
173 not the desired effect to have the label used by all subgraphs. Rather
174 than listing the graph attribute at the top of the graph, and the
175 resetting the attribute as needed in the subgraphs, one can simple defer
176 the attribute definition if the graph until the appropriate subgraphs
177 have been defined.
178 <P>
179 If an edge belongs to a cluster, its endpoints belong to that cluster.
180 Thus, where you put an edge can effect a layout, as clusters are sometimes
181 laid out recursively.
182 <H2>Character encodings</H2>
183 The DOT language assumes at least the ascii character set.
184 Quoted strings, both ordinary and HTML-like, may contain non-ascii characters.
185 In most cases, these strings are uninterpreted: they simply serve as
186 unique identifiers or values passed through untouched. Labels, however,
187 are meant to be displayed, which requires that the software be able to
188 compute the size of the text and determine the appropriate glyphs.
189 For this, it needs to know what character encoding is used.
190 <P>
191 By default, DOT assumes the UTF-8 character encoding. It also accepts
192 the Latin1 (ISO-8859-1) character set, assuming the input graph uses
193 the <B><A HREF=attrs.html#a:charset>charset</A></B> attribute to
194 specify this. For graphs using other
195 character sets, there are usually programs, such as <TT>iconv</TT>, which
196 will translate from one character set to another.
197 <P>
198 Another way to avoid non-ascii characters in labels is to use HTML entities
199 for special characters. During label evaluation, these entities are
200 translated into the underlying character. This
201 <a HREF="http://www.graphviz.org/doc/char.html">
202 table</a> shows the supported entities, with their Unicode value, a typical
203 glyph, and the HTML entity name. Thus, to include a lower-case Greek beta
204 into a string, one can use the ascii sequence <TT>&amp;beta;</TT>.
205 In general, one should only use entities that are allowed in the output
206 character set, and for which there is a glyph in the font.
207 <HR>
208 <OL TYPE="1">
209 <LI> In quoted strings in DOT, the only escaped character is double-quote
210 ("). That is, in quoted strings, the dyad \" is converted to "; all other
211 characters are left unchanged. In particular, \\ remains \\. Layout
212 engines may apply additional escape sequences.
213 </OL>
214 </BODY>
215 </HTML>