If .dot file contains commented-out lines with #, it cannot be parsed, exception is being thrown:
guru.nidi.graphviz.parse.ParserException: Found unexpected character '#'
at guru.nidi.graphviz.parse.Lexer.ident (Lexer.java:121)
at guru.nidi.graphviz.parse.Lexer.numeralOrIdent (Lexer.java:98)
at guru.nidi.graphviz.parse.Lexer.token (Lexer.java:55)
at guru.nidi.graphviz.parse.ParserImpl.nextToken (ParserImpl.java:310)
at guru.nidi.graphviz.parse.ParserImpl.assertToken (ParserImpl.java:321)
at guru.nidi.graphviz.parse.ParserImpl.statementList (ParserImpl.java:77)
at guru.nidi.graphviz.parse.ParserImpl.lambda$parse$0 (ParserImpl.java:66)
at guru.nidi.graphviz.model.ThrowingFunction.applyNotThrowing (ThrowingFunction.java:24)
at guru.nidi.graphviz.model.CreationContext.use (CreationContext.java:44)
at guru.nidi.graphviz.model.CreationContext.use (CreationContext.java:38)
at guru.nidi.graphviz.parse.ParserImpl.parse (ParserImpl.java:50)
at guru.nidi.graphviz.parse.Parser.read (Parser.java:81)
at guru.nidi.graphviz.parse.Parser.read (Parser.java:76)
at myapp.GraphvizProcessor.parseDot (GraphvizProcessor.java:52)
at myapp.GraphvizProcessor.main (GraphvizProcessor.java:43)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:279)
at java.lang.Thread.run (Thread.java:1589)
Single-line comments # and block comments /* blabla */ are legal syntax of .dot files. I think library shouldn't fail when they are presented in provided file.
This is how I've used it:
private void parseDot(String dot, File dotDir) {
try {
// Graphviz.useEngine(new GraphvizCmdLineEngine());
Graphviz.useEngine(new GraphvizV8Engine(), new GraphvizJdkEngine());
MutableGraph g;
g = new Parser().read(dot);
If
.dot
file contains commented-out lines with#
, it cannot be parsed, exception is being thrown:Single-line comments
#
and block comments/* blabla */
are legal syntax of.dot
files. I think library shouldn't fail when they are presented in provided file.This is how I've used it: