//parserRuleSpec[RULE_REF/text() = ruleBlock/ruleAltList/labeledAlt/alternative/[name()='element'][1]/atom/ruleref/[1]/text()]

This XPath expression is the first important rule I wrote for Antlr grammars. It finds all rules that have direct left recursion, and is an important step for removing indirect left recursion.

My efforts for getting XPath working with Antlr are starting to finally pay off.

–Ken