Refactor to allow passing in a configuration mapping from string to char.
Create Parser struct to maintain state. (In other langs, would just use closure.)
Still transitional refactoring! Search is still hardcoded to one or two lookahead.
Finish generalized implementation. Generate prefix/suffix pairs and explore tree-recursively,
combining results at the end.
Use flat_map for efficiency.