This regex accepts empty string, so the lexgen state never failed and instead looped when it's supposed to fail.
Now, I've never needed this in a lexer, but this kind of rule can be used to switch to another state on failure, so I guess it's not completely useless. However I suspect for the majority of the use cases it actually means a bug in the lexer, so perhaps it makes sense to generate a warning for rules that accept empty strings, with a pragma to explicitly suppress the warning.
Recently I debugged a lexer with this rule:
This regex accepts empty string, so the lexgen state never failed and instead looped when it's supposed to fail.
Now, I've never needed this in a lexer, but this kind of rule can be used to switch to another state on failure, so I guess it's not completely useless. However I suspect for the majority of the use cases it actually means a bug in the lexer, so perhaps it makes sense to generate a warning for rules that accept empty strings, with a pragma to explicitly suppress the warning.