> Why we can only label all rules or none? Why antlr design like this?
Where did you see a rule like that? Rules cannot be labelled. Your question makes no sense.
However, when you ask why either all or none of top level alts in a rule must be labelled, the answer is this:
Because by labelling an alternative in a rule ANTLR4 replaces the overall rule context by a specific context for that alt. Hence, the original context is no longer available (it would be kinda semi-duplicate of the alt context). And if there's no rule context anymore, you need contexts for all other alts as well, which means, they also must be labelled.
Mike
--
www.soft-gems.net