Quote:
Example 1: If you need to know information about the next line(s) or previous line(s) to decide how to process the current line.
Example 2: The current line indicates you have read too far and you must send it to a different context of your parser.
Both of such problems are usually solved in parsers using the look-ahead mechanism (see for instance
Parsing - Wikipedia[
^] ), that, if I am not wrong, you already find yourself as a possible solution
Quote:
Storing two or three lines at a time and using references to process them as a set