Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compile: support empty patterns better
Some were rejected explicitly with this "alternations cannot currently contain empty sub-expressions" error. Some were causing alternations to be compiled into automaton matching a different regex. The root of the issue is that the compilation of the Empty pattern returns Patch { entry: self.insts.len(), .. }, that is it claims its entry point is the next instruction. This only works if the next instruction is unconditionally executed, which is not true for alternations. So we return None instead, and let the callers decide how to handle an empty regex. Fixes #524, Fixes #659, Closes #677
- Loading branch information