/** {@code (BLOCK (ALT .))} or {@code (BLOCK (ALT 'a') (ALT .))}. */
 public static boolean blockHasWildcardAlt(@NotNull GrammarAST block) {
   for (Object alt : block.getChildren()) {
     if (!(alt instanceof AltAST)) continue;
     AltAST altAST = (AltAST) alt;
     if (altAST.getChildCount() == 1) {
       Tree e = altAST.getChild(0);
       if (e.getType() == ANTLRParser.WILDCARD) {
         return true;
       }
     }
   }
   return false;
 }
 /**
  *
  *
  * <pre>
  * (RULE e int _p (returns int v)
  * 	(BLOCK
  * 	  (ALT
  * 		(BLOCK
  * 			(ALT INT {$v = $INT.int;})
  * 			(ALT '(' (= x e) ')' {$v = $x.v;})
  * 			(ALT ID))
  * 		(* (BLOCK
  * 		(OPTIONS ...)
  * 			(ALT {7 >= $_p}? '*' (= b e) {$v = $a.v * $b.v;})
  * 			(ALT {6 >= $_p}? '+' (= b e) {$v = $a.v + $b.v;})
  * 			(ALT {3 >= $_p}? '++') (ALT {2 >= $_p}? '--'))))))
  * </pre>
  */
 public void setAltASTPointers(LeftRecursiveRule r, RuleAST t) {
   //		System.out.println("RULE: "+t.toStringTree());
   BlockAST ruleBlk = (BlockAST) t.getFirstChildWithType(ANTLRParser.BLOCK);
   AltAST mainAlt = (AltAST) ruleBlk.getChild(0);
   BlockAST primaryBlk = (BlockAST) mainAlt.getChild(0);
   BlockAST opsBlk = (BlockAST) mainAlt.getChild(1).getChild(0); // (* BLOCK ...)
   for (int i = 0; i < r.recPrimaryAlts.size(); i++) {
     LeftRecursiveRuleAltInfo altInfo = r.recPrimaryAlts.get(i);
     altInfo.altAST = (AltAST) primaryBlk.getChild(i);
     altInfo.altAST.leftRecursiveAltInfo = altInfo;
     altInfo.originalAltAST.leftRecursiveAltInfo = altInfo;
     //			altInfo.originalAltAST.parent = altInfo.altAST.parent;
     //			System.out.println(altInfo.altAST.toStringTree());
   }
   for (int i = 0; i < r.recOpAlts.size(); i++) {
     LeftRecursiveRuleAltInfo altInfo = r.recOpAlts.getElement(i);
     altInfo.altAST = (AltAST) opsBlk.getChild(i);
     altInfo.altAST.leftRecursiveAltInfo = altInfo;
     altInfo.originalAltAST.leftRecursiveAltInfo = altInfo;
     //			altInfo.originalAltAST.parent = altInfo.altAST.parent;
     //			System.out.println(altInfo.altAST.toStringTree());
   }
 }