As I already mentioned the parser from the Python interpreter shared library strips the comments. Certainly, the interpreter does not need them however it is critical not to loose them when a flowchart diagram is generated. Therefore a second pass over the input buffer was required to collect comments.

Luckily Python has a very simple grammar: there are no multi line comments and there is no pre-processor. The only thing which needs an attention is whether the # character is within a string literal or not. The comments are collected as a list of fragments. Each fragment describes a single line and holds the line number, the start and the end positions in the line as well as their absolute positions.