Re: [graphviz-interest] A question about formatting DOT files

Ron Savage <[email protected]> Sat, 08 Nov 2014 11:03:26 +1100
Newsgroups gmane.comp.video.graphviz
Message-ID <[email protected]>
Hi Emden

Thanx for the quick, and very valuable, reply. More below.

On 08/11/14 04:26, Emden R. Gansner wrote:
> On 11/6/14 7:45 PM, Ron Savage wrote:
>> So, finally, the question is: Are there any (other) cases where
>> replacing all (non-escaped) newlines with a single space would change
>> dot's interpretation?
> In terms of parsing, no.
> In terms of basic lexical analysis, a newline character or a space would
> serve equally well to terminate or separate tokens.
> The only tricky part deals with comments. Both the // comment and the #
> comment go until a newline character is encountered.
> Assuming you first remove all comments, and correctly handle escaped
> newlines within "..." strings and unescaped newlines within
> <...> strings during lexing, all other newlines could be replaced with
> spaces without affecting the semantics.

Comments, of 3 types, are already handled - even though DOT uses just 2:
o # ...
o // ...
o /* ... */

In part, that code is included as an exercise (for me) and a tutorial 
for others.

The parsing engine Marpa [1], which I did not write, already handles 
whitespace and hence whitespace being used for token termination.

[1] http://savage.net.au/Marpa.html

Thanx.

-- 
Ron Savage - savage.net.au
_______________________________________________
[email protected]
http://lists.research.att.com/mailman/listinfo/graphviz-interest