MCPcopy Create free account
hub / github.com/antlr/codebuff / getChildIndex

Method getChildIndex

src/org/antlr/codebuff/Trainer.java:988–1001  ·  view source on GitHub ↗
(ParseTree t)

Source from the content-addressed store, hash-verified

986 }
987
988 public static int getChildIndex(ParseTree t) {
989 if ( t==null ) return -1;
990 ParseTree parent = t.getParent();
991 if ( parent==null ) {
992 return -1;
993 }
994 // Figure out which child index t is of parent
995 for (int i = 0; i<parent.getChildCount(); i++) {
996 if ( parent.getChild(i)==t ) {
997 return i;
998 }
999 }
1000 return -1;
1001 }
1002
1003 public static int rulealt(ParserRuleContext r) {
1004 return rulealt(r.getRuleIndex(), r.getAltNumber());

Callers 15

getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80
getIndexOfChildMethod · 0.80

Calls 3

getParentMethod · 0.45
getChildCountMethod · 0.45
getChildMethod · 0.45

Tested by

no test coverage detected