Diagram that could explain a state machine's code?
- by Incognito
We have a lot of concepts in making diagrams like UML and flowcharting or just making up whatever boxes-and-arrows combination works at the time, but I'm looking at doing a visual diagram on something that's actually really complex.
State machines like those that parse HTML or regular expressions tend to be very long and complicated bits of code.
For example, this is the stateLoop for FireFox 9 beta. It's actually generated by another file, but this is the code that runs.
How can I diagram something with the complexity of this in a way that explains flow of the code without taking it to a level where I draw every single line-of-code into it's own box on a flowchart?
I don't want to draw "Invoke loop, then return" but I don't want to explain every last detail.
What kind of graph is suitable to do this? Is there already something out there similar to this? Just an example of how to do this without going overboard in complexity or too-high-level is really what I want.
If you don't feel like looking at the code, basically it's 70 different state flags that could occur, inside an infinite loop that exists to a label based on some conditions, each flag has it's own infinite loop that exists to a label somewhere, and each of those loops has checks for different types of chars, which then runs off into various other methods.