Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug dot file generator #54

Closed
woutersl opened this issue Jul 20, 2018 · 8 comments

Comments

@woutersl
Copy link
Member

commented Jul 20, 2018

Original report by Anonymous.


Hello.
There is an issue with the generated dot file. Specifically if terminals/productions have symbols like " or .
The thing is viewer doesn't recognize labels like this:
state114 -> state31 [label=""]; -> error. Should be state114 -> state31 [label="\"];
state0 -> state1 [label="""]; -> error. Should be state0 -> state1 [label="""];

In short symbols like " or \ should be escaped in labels. Looks like this is trivial to fix.

@woutersl

This comment has been minimized.

Copy link
Member Author

commented Jul 24, 2018

Original comment by Laurent Wouters (Bitbucket: 557058:675792b6-d731-4823-9f7d-c6dfcb2df2b5, ).


Hello, indeed it looks like the labels for the nodes are properly escaped, but escaping the label on edges was overlooked. Thanks for reporting this!

@woutersl

This comment has been minimized.

Copy link
Member Author

commented Jul 24, 2018

Original comment by Laurent Wouters (Bitbucket: 557058:675792b6-d731-4823-9f7d-c6dfcb2df2b5, ).


[fix] Fixed issue #54 Proper escaping of labels in DOT edges

@woutersl woutersl closed this Jul 24, 2018

@woutersl

This comment has been minimized.

Copy link
Member Author

commented Jul 24, 2018

Original comment by Laurent Wouters (Bitbucket: 557058:675792b6-d731-4823-9f7d-c6dfcb2df2b5, ).


This fix will be published in the upcoming release 3.3.3

@woutersl

This comment has been minimized.

Copy link
Member Author

commented Jul 24, 2018

Original comment by Alexey Smirnov (Bitbucket: 5b4cb1f71fd8f72ca71b68ba, GitHub: RamyAlexis).


@woutersl

This comment has been minimized.

Copy link
Member Author

commented Jul 24, 2018

Original comment by Alexey Smirnov (Bitbucket: 5b4cb1f71fd8f72ca71b68ba, GitHub: RamyAlexis).


The initial issue was fixed (at least it looks like so). But for some reason i still can't get correct DOT file after generation. It is attached for reference.
The error from online dot to swg generator is "error on line 1 at column 1: Document is empty". I tried multiple ones to be totally sure. I don't know how to debug this further :(

@woutersl

This comment has been minimized.

Copy link
Member Author

commented Jul 24, 2018

Original comment by Laurent Wouters (Bitbucket: 557058:675792b6-d731-4823-9f7d-c6dfcb2df2b5, ).


It looks like the document contains some BOM at the beginning, which trips some graphviz implementations. BOM won't normally appear in text editors so it can be tricky. For example, on my system:

dot -Tpng sysvcDFA.dot -o result.png

indeed gets me the error: Error: sysvcDFA.dot: syntax error in line 1 near 'digraph'.

Removing the BOM fixes the issue. I also have tried the content of your document on some online graphviz services and unsurprisingly they all gave up due to the graph's size.

I don't know if the BOM has been inserted by Hime. I''ll look into it and fix it if that is the case.

Does removing the BOM fixes the issue on your end?

@woutersl

This comment has been minimized.

Copy link
Member Author

commented Jul 24, 2018

Original comment by Laurent Wouters (Bitbucket: 557058:675792b6-d731-4823-9f7d-c6dfcb2df2b5, ).


It looks like that a BOM is indeed emitted due to the way the .Net API for file writing is used.
I'll open a new ticket for this.

@woutersl

This comment has been minimized.

Copy link
Member Author

commented Jul 24, 2018

Original comment by Alexey Smirnov (Bitbucket: 5b4cb1f71fd8f72ca71b68ba, GitHub: RamyAlexis).


Yep. Removing the BOM do the trick. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.