Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replacement of the libfsm json output with json that I hope is a little more convenient.
Typically it looks like this, with output for human-readable labels:
and similarly as an NFA:
With the
.consolidate_edges
option disabled, edges are given independently and this is visible with asymbol
attribute (as opposed tolabel
, which is intended for human consumption):And with numeric output for byte values (intended for machine consumption):
I didn't write a json schema for this, sorry. I should provide one, I know.
I did experiment with using dagre for node placement.
Here's Graphviz's rendering for the above anchored
/a|b*c?e|d+/
regexp:And the same FSM with a quick mock-up page rendering that using dagre-D3:
I had wanted to use this json to model using dagre's algorithm for node placement,
in combination with dot(1)'s algorithm for edges. Unfortunately Graphviz will only
heed pre-defined coordinates when rendering using neato, which produces straight
lines for edges, which is of course not what I had hoped for:
Regardless, I wrote a nodejs script to read in this new json, and to format it out
to .dot format with the coordinates populated:
which produces output like: