-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Thanks for the great library! I found a bug in the graph writer:
Consider a graph with a node attribute x=-1.4703333520951247e-16, when writing and reading the same graph, graphlib-dot yields TypeError: v is null in peg$c34:
var dot = require('graphlib-dot');
var graphlib = require('graphlib');
// prepare graph
var graph = new graphlib.Graph({directed: false});
graph.setNode(42, { x: -1.4703333520951247e-16 });
// show output
dot.write(graph); // -> 'strict graph {\n "42" [x=-1.4703333520951247e-16]\n}\n'
// trigger TypeError
dot.read(dot.write(graph));
// Uncaught TypeError: Cannot read property '3' of null
// at peg$c34 (node_modules/graphlib-dot/lib/dot-grammar.js:114:28)
// at peg$parseidDef (node_modules/graphlib-dot/lib/dot-grammar.js:1421:16)
// at peg$parseaList (node_modules/graphlib-dot/lib/dot-grammar.js:1173:20)
// at peg$parseattrListBlock (node_modules/graphlib-dot/lib/dot-grammar.js:1093:16)
// at peg$parseattrList (node_modules/graphlib-dot/lib/dot-grammar.js:1012:12)
// at peg$parsenodeStmt (node_modules/graphlib-dot/lib/dot-grammar.js:808:16)
// at peg$parsestmt (node_modules/graphlib-dot/lib/dot-grammar.js:689:20)
// at peg$parsestmtList (node_modules/graphlib-dot/lib/dot-grammar.js:538:12)
// at peg$parsegraphStmt (node_modules/graphlib-dot/lib/dot-grammar.js:452:28)
// at Object.parse (node_modules/graphlib-dot/lib/dot-grammar.js:2372:18)I think dot.write() produces a non-compliant string (because the ID is not allowed to have a dash -). The parser looks fine.
I'm using [email protected].
Metadata
Metadata
Assignees
Labels
No labels