@ Override public Tree getAncestor ( int ttype ) { Tree t = this ; t = t . getParent ( ) ; while ( t != null ) { if ( t . getType ( ) == ttype ) return t ; t = t . getParent ( ) ; } return null ; }
Walk upwards and get first ancestor with this token type .