public static bool InRule(this ParserRuleContext parserContext, RuleContextType contextType) { RuleContext current = parserContext.Parent; while (current != null) { if (current.GetType().Name.ToUpper() == contextType.ToString()) { return(true); } current = current.Parent; } return(false); }
public static RuleContext GoOutRule(this ParserRuleContext parserContext, RuleContextType contextType) { RuleContext current = parserContext; while (current != null) { if (current.GetType().Name.ToUpper() == contextType.ToString()) { return(current); } current = current.Parent; } return(null); }