/** Walk ancestors of this node until we find ALT with * alt!=null or leftRecursiveAltInfo!=null. Then grab label if any. * If not a rule element, just returns null. */ public String getAltLabel() { List<? extends Tree> ancestors = this.getAncestors(); if ( ancestors==null ) return null; for (int i=ancestors.size()-1; i>=0; i--) { GrammarAST p = (GrammarAST)ancestors.get(i); if ( p.getType()== ANTLRParser.ALT ) { AltAST a = (AltAST)p; if ( a.altLabel!=null ) return a.altLabel.getText(); if ( a.leftRecursiveAltInfo!=null ) { return a.leftRecursiveAltInfo.altLabel; } } } return null; }
/** Walk ancestors of this node until we find ALT with * alt!=null or leftRecursiveAltInfo!=null. Then grab label if any. * If not a rule element, just returns null. */ public String getAltLabel() { List<? extends Tree> ancestors = this.getAncestors(); if ( ancestors==null ) return null; for (int i=ancestors.size()-1; i>=0; i--) { GrammarAST p = (GrammarAST)ancestors.get(i); if ( p.getType()== ANTLRParser.ALT ) { AltAST a = (AltAST)p; if ( a.altLabel!=null ) return a.altLabel.getText(); if ( a.leftRecursiveAltInfo!=null ) { return a.leftRecursiveAltInfo.altLabel; } } } return null; }
/** Walk ancestors of this node until we find ALT with * alt!=null or leftRecursiveAltInfo!=null. Then grab label if any. * If not a rule element, just returns null. */ public String getAltLabel() { List<? extends Tree> ancestors = this.getAncestors(); if ( ancestors==null ) return null; for (int i=ancestors.size()-1; i>=0; i--) { GrammarAST p = (GrammarAST)ancestors.get(i); if ( p.getType()== ANTLRParser.ALT ) { AltAST a = (AltAST)p; if ( a.altLabel!=null ) return a.altLabel.getText(); if ( a.leftRecursiveAltInfo!=null ) { return a.leftRecursiveAltInfo.altLabel; } } } return null; }
/** Walk ancestors of this node until we find ALT with * alt!=null or leftRecursiveAltInfo!=null. Then grab label if any. * If not a rule element, just returns null. */ public String getAltLabel() { List<? extends Tree> ancestors = this.getAncestors(); if ( ancestors==null ) return null; for (int i=ancestors.size()-1; i>=0; i--) { GrammarAST p = (GrammarAST)ancestors.get(i); if ( p.getType()== ANTLRParser.ALT ) { AltAST a = (AltAST)p; if ( a.altLabel!=null ) return a.altLabel.getText(); if ( a.leftRecursiveAltInfo!=null ) { return a.leftRecursiveAltInfo.altLabel; } } } return null; }
/** Walk ancestors of this node until we find ALT with * alt!=null or leftRecursiveAltInfo!=null. Then grab label if any. * If not a rule element, just returns null. */ public String getAltLabel() { List<? extends Tree> ancestors = this.getAncestors(); if ( ancestors==null ) return null; for (int i=ancestors.size()-1; i>=0; i--) { GrammarAST p = (GrammarAST)ancestors.get(i); if ( p.getType()== ANTLRParser.ALT ) { AltAST a = (AltAST)p; if ( a.altLabel!=null ) return a.altLabel.getText(); if ( a.leftRecursiveAltInfo!=null ) { return a.leftRecursiveAltInfo.altLabel; } } } return null; }