text: public List<String> getRuleInvocationStack(RuleContext p) {String[] ruleNames = getRuleNames();List<String> stack = new ArrayList<String>();while ( p!=null ) {int ruleIndex = p.getRuleIndex();if ( ruleIndex<0 ) stack.add("n/a");else stack.add(ruleNames[ruleIndex]);p = p.parent;}return stack;}