code: private boolean checkTypeTree(Node node, int typeMask, int encloseMask, int anchorMask) {
          if ((node.getType2Bit() & typeMask) == 0) return true;
  
          boolean invalid = false;
  
          switch(node.getType()) {
          case NodeType.LIST:
          case NodeType.ALT:
              ListNode can = (ListNode)node;
              do {
                  invalid = checkTypeTree(can.value, typeMask, encloseMask, anchorMask);
              } while (!invalid && (can = can.tail) != null);
              break;
  
          case NodeType.QTFR:
              invalid = checkTypeTree(((QuantifierNode)node).target, typeMask, encloseMask, anchorMask);
              break;
  
          case NodeType.ENCLOSE:
              EncloseNode en = (EncloseNode)node;
              if ((en.type & encloseMask) == 0) return true;
              invalid = checkTypeTree(en.target, typeMask, encloseMask, anchorMask);
              break;
  
          case NodeType.ANCHOR:
              AnchorNode an = (AnchorNode)node;
              if ((an.type & anchorMask) == 0) return true;
  
              if (an.target != null) invalid = checkTypeTree(an.target, typeMask, encloseMask, anchorMask);
              break;
  
          default:
              break;
  
          } // switch
  
          return invalid;
      }
docs: true: invalid