public bool ParserRuleCtxtExt_GetChild(string parentContextName, PRCExtensionTestContextTypes ctxtType) { ParserRuleContext result = null; var parentContext = AllTestingDeclarations.Where(dc => dc.IdentifierName.Equals(parentContextName)).First().Context; if (ctxtType == PRCExtensionTestContextTypes.SelectStmtCtxt) { result = parentContext.GetChild <VBAParser.SelectCaseStmtContext>(); } else if (ctxtType == PRCExtensionTestContextTypes.AsTypeCtxt) { result = parentContext.GetChild <VBAParser.AsTypeClauseContext>(); } return(result != null); }
public bool ParserRuleCtxtExt_GetDescendent(string parentName, PRCExtensionTestContextTypes descendentType) { var parentContext = AllTestingDeclarations.Where(dc => dc.IdentifierName.Equals(parentName)).First().Context; ParserRuleContext descendent = null; if (descendentType == PRCExtensionTestContextTypes.SelectStmtCtxt) { descendent = parentContext.GetDescendent <VBAParser.SelectCaseStmtContext>(); } if (descendentType == PRCExtensionTestContextTypes.PowOpCtxt) { descendent = parentContext.GetDescendent <VBAParser.PowOpContext>(); } return(descendent != null); }
public bool ParserRuleCtxtExt_GetAncestor(string name, PRCExtensionTestContextTypes ancestorType) { var context = AllTestingDeclarations.Where(dc => dc.IdentifierName.Equals(name)).First().Context; ParserRuleContext ancestor = null; if (ancestorType == PRCExtensionTestContextTypes.SelectStmtCtxt) { ancestor = context.GetAncestor <VBAParser.SelectCaseStmtContext>(); } if (ancestorType == PRCExtensionTestContextTypes.PowOpCtxt) { ancestor = context.GetAncestor <VBAParser.PowOpContext>(); } return(ancestor != null); }
public int ParserRuleCtxtExt_GetDescendents(string parentName, PRCExtensionTestContextTypes descendentType) { var parentContext = AllTestingDeclarations.Where(dc => dc.IdentifierName.Equals("Foo")).First().Context; var descendents = new List <ParserRuleContext>(); if (descendentType == PRCExtensionTestContextTypes.SelectStmtCtxt) { descendents = parentContext.GetDescendents <VBAParser.SelectCaseStmtContext>().Select(desc => (ParserRuleContext)desc).ToList(); } if (descendentType == PRCExtensionTestContextTypes.PowOpCtxt) { descendents = parentContext.GetDescendents <VBAParser.PowOpContext>().Select(desc => (ParserRuleContext)desc).ToList(); } return(descendents.Count()); }