Antlr4.Misc.TreeParserExtensions.GetAncestor C# (CSharp) Method

GetAncestor() private static method

Helper for static InContext(ITreeAdaptor, string[], object, string).
private static GetAncestor ( ITreeAdaptor adaptor, string tokenNames, object t, string goal ) : object
adaptor ITreeAdaptor
tokenNames string
t object
goal string
return object
        private static object GetAncestor(ITreeAdaptor adaptor, string[] tokenNames, object t, string goal)
        {
            while (t != null)
            {
                string name = tokenNames[adaptor.GetType(t)];
                if (name.Equals(goal))
                    return t;

                t = adaptor.GetParent(t);
            }

            return null;
        }
    }
TreeParserExtensions