public ParserRuleContext getInvokingContext(int ruleIndex) { ParserRuleContext p = _ctx; while (p != null) { if (p.getRuleIndex() == ruleIndex) return p; p = (ParserRuleContext) p.parent; } return null; }
public static ParserRuleContext findTopContext( ParserRuleContext context, IntervalSet values, boolean checkTop) { if (checkTop && values.contains(context.getRuleIndex())) { return context; } if (context.isEmpty()) { return null; } return findTopContext((ParserRuleContext) context.parent, values, true); }
public static boolean isInContexts( @NonNull ParserRuleContext context, boolean allowGaps, @NonNull int... stack) { Parameters.notNull("context", context); Parameters.notNull("stack", stack); if (allowGaps) { throw new UnsupportedOperationException("Not implemented yet."); } ParserRuleContext currentContext = context; for (int element : stack) { if (currentContext.getRuleIndex() != element) { return false; } currentContext = currentContext.getParent(); if (currentContext == null) { return false; } } return true; }
@Override public void exitEveryRule(ParserRuleContext ctx) { System.out.println( "exit " + getRuleNames()[ctx.getRuleIndex()] + ", LT(1)=" + _input.LT(1).getText()); }