Before this patch [-Wmatch-empty-rule] was based on:
- DFA structural analyses (skeleton phase)
- rule reachability analyses (skeleton phase)
Now it is based on:
- NFA structural analyses (NFA phase)
- rule reachability analyses (skeleton phase)
It's much easier to find nullable rules in NFA than in DFA.
The problem with DFA is in rules with trailing context, both
dynamic and especially static (as it leaves no trace in DFA
states). re2c currently treats static context as dynamic, but
it will change soon.
On the other side NFA may give some false positives because of
unreachable rules:
[^] {}
"" {}
infinite rules:
[^]* {}
or self-shadowing rules:
[^]?
Reachability analyses in skeleton helps to filter out unreachable
and infinite rules, but not self-shadowing ones.