10 | ||| A keyword
13 | ||| An identifier as a name
15 | ||| An identifier as a numeral
17 | ||| An identifier as a double-quoted string
19 | ||| An identifier as a HTML string
22 | ||| An edge operation in a directed graph
24 | ||| An edge operation in a graph
26 | ||| A compass point (used in combination with ports)
28 | ||| A comment
30 | ||| A multiline indicator
32 | ||| A double-quoted-string concatenation operator ('+')
35 | ||| Any amount of whitespace
38 | ||| [
40 | ||| ]
42 | ||| {
44 | ||| }
46 | ||| ,
48 | ||| ;
50 | ||| :
52 | ||| =
55 | export
78 | ------------------------------------------------------------------------
79 | -- Keywords
81 | -- DOT keywords are case-insensitive
101 | ||| Keywords are "node", "edge", "graph", "digraph", "subgraph", and "strict"
102 | ||| (without the quotes)
112 | ------------------------------------------------------------------------
113 | -- Identifiers
126 | ||| Any string of alphabetic characters, underscores, or digits, not beginning
127 | ||| with a digit.
137 | -- \.[0-9]+
141 | -- \.[0-9]*
145 | -- [0-9]+(\.[0-9]*)?
149 | -- \.[0-9]+|[0-9]+(\.[0-9]*)?
154 | ||| A numeral:
155 | ||| [-]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)
159 | ||| Any double-quoted string possibly containing escaped quotes.
163 | -- v this is probably a library on its own...
164 | ||| An HTML string
169 | ------------------------------------------------------------------------
170 | -- Edge operations
179 | ------------------------------------------------------------------------
180 | -- Compass Points
209 | -- The compass point "_" specifies that an appropriate side of the port adjacent
210 | -- to the exterioior of the node should be used, if such exists. Otherwise, the
211 | -- center is used. If no compass point is used with a portname, the default
212 | -- value is "_".
216 | -- (n | ne | e | se | s | sw | w | nw | c | _)
230 | ------------------------------------------------------------------------
231 | -- Comments
233 | -- "a line beginning with a '#' character is considered a line output from a C
234 | -- preprocessor and discarded"
245 | ||| The language supports C++-style comments `/* */` and `//`. Line starting
246 | ||| with a '#' are considered pre-processer output and ignored.
253 | ------------------------------------------------------------------------
254 | -- Misc
256 | -- DOT allows double-quoted strings to span multiple physical lines using the
257 | -- standard C convention of a backslash immediately preceding a newline
258 | -- character
262 | -- double-quoted strings can be concatenated using a '+' operator
266 | -- "any amount of whitespace may be inserted [...]"
295 | ------------------------------------------------------------------------
296 | -- TOKEN MAP
298 | ||| A mapping from the @Lexer@s to a function of type String -> @DOTToken@
304 | -- , (htmlID, \html => HTML_ID html)
320 | ]
322 | -- comments and whitespace are irrelevant to the program
328 | -- removes the irrelevant tokens
333 | ||| Given a source file, return the token stream
334 | export