pombreda / pydot

Automatically exported from code.google.com/p/pydot
MIT License
0 stars 0 forks source link

Dot parser doesn't allow for #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create the following Dot file:
digraph {
    a -> b[label="hi", decorate];   
}
(The validity of this graph can be verified by running Dot on it.)

2. Run  pydot.dot_parser.graph_definition().parseFile('/path/to/file.dot')

PyDot complains, 'ParseException: Expected "}" (at char 24), (line:2, col:15).'

This issue appears to be caused by an erroneous assumption in the P_AttrList 
class that attributes always appear in name/value pairs. 

I'm using the latest release of PyDot on Scientific Linux with Python 2.5.1.

I have provided a patch to fix this problem; it merely prevents suppression of 
the '=' character in attribute lists and uses that in P_AttrList construction 
to determine which attributes have values and which do not.

Original issue reported on code.google.com by yavy...@gmail.com on 2 Jul 2010 at 6:33

Attachments:

GoogleCodeExporter commented 9 years ago
Apologies for the mistyped issue title.

Original comment by yavy...@gmail.com on 2 Jul 2010 at 6:34

GoogleCodeExporter commented 9 years ago

Original comment by ero.carr...@gmail.com on 30 Oct 2010 at 5:39

GoogleCodeExporter commented 9 years ago
The patch is good but breaks a few other things. I've implemented built on it 
and then next version will handle this properly.

BTW, a better/simpler way of parsing a dot file is:

graph = pydot.graph_from_dot_file( path_to_file )

Original comment by ero.carr...@gmail.com on 1 Nov 2010 at 12:55