public static List<? extends Tree> getAncestors(Tree t) {
		if ( t.getParent()==null ) return Collections.emptyList();
		List<Tree> ancestors = new ArrayList<Tree>();
		t = t.getParent();
		while ( t!=null ) {
			ancestors.add(0, t); // insert at start
			t = t.getParent();
		}
		return ancestors;
	}
Return a list of all ancestors of this node.  The first node of
 list is the root and the last is the parent of this node.

 @since 4.5.1
runtime/Java/src/org/antlr/v4/runtime/tree/Trees.java