public static IList <Tree> getSeparators <T1>(ParserRuleContext ctx, IList <T1> siblings) where T1 : Antlr4.Runtime.ParserRuleContext { ParserRuleContext first = siblings[0] as ParserRuleContext; ParserRuleContext last = siblings[siblings.Count - 1] as ParserRuleContext; int start = BuffUtils.indexOf(ctx, first); int end = BuffUtils.indexOf(ctx, last); IEnumerable <ITree> xxxx = Trees.GetChildren(ctx).Where((n, i) => i >= start && i < end + 1); IList <Tree> elements = xxxx.ToList(); return(BuffUtils.filter(elements, c => c is TerminalNode)); }