The DFA (deterministic finite automaton) layer does several things it shouldn't.
- returns Either objects - these must be allocated, just to identify the return type. This should instead put the result in the Registers or other state objects and just return a boolean flag or case object.
- Registers objects are allocated frequently. These can just be a static part of the state of the parser - there is a maximum number of them we need given the most-complex combination of delimiters and escape schemes. We can put that many of them statically into the PState.
- Rules - this uses anonymous classes. These may or may not have performance impact, but they definitely make the code harder to debug, and in general for performance-sensitive inner-loop-like parts of the code base, we want to use a more Java-like coding style. These should become ordinary named object classes.
(note: removed discussion of markPos/resetPos, as that has been implemented on 1.2.0)