See the linked review comments for more details. The jist of it is that when an %ES; is in a delimiter, the associated DFA is not getting compiled correctly, and it actually will match a literal %ES;. There is code in DelimiterParser.scala that inefficiently looks for ES when a match isn't found, and accepts it as an empty match. Instead, the DFA scanner should be returning the %ES; as a successful match in the parse results, and then DelimiterParser.scala can use the same logic to determine which DFA matched. This would allow us to get rid of the hasES functions and be more efficient.
Note that some things may be tricky because when scanning for a delimiter, we have to ignore the %ES;, since they'll match anything. We may need new iterators that ignore these.