To achieve this (even reading from stdin) we have to read the first line, choose a parser version, and send the first line to the parser to be processed again.
A better design would be a further refactor that joins the 3 ragel machines (one per VCF version) in a single machine, that branches into 3 sub-machines after the first line. To keep the version grammars independent (and extract common actions and basic machines) we can use the "include" feature from ragel, following the structure in this example repo
Basically, remove the
-v
/--version
parameter.To achieve this (even reading from stdin) we have to read the first line, choose a parser version, and send the first line to the parser to be processed again.
A better design would be a further refactor that joins the 3 ragel machines (one per VCF version) in a single machine, that branches into 3 sub-machines after the first line. To keep the version grammars independent (and extract common actions and basic machines) we can use the "include" feature from ragel, following the structure in this example repo