code: private void extractRules(RuleSource ruleSource, Collection<?> blocks, RuleSetBuilder builder) throws RuleException {
          for (Object element : blocks) {
              if (element instanceof AbstractBlock) {
                  AbstractBlock block = (AbstractBlock) element;
                  if (EXECUTABLE_RULE_TYPES.contains(block.getRole())) {
                      extractExecutableRule(ruleSource, block, builder);
                  } else if (GROUP.equals(block.getRole())) {
                      extractGroup(ruleSource, block, builder);
                  }
                  extractRules(ruleSource, block.getBlocks(), builder);
              } else if (element instanceof Collection<?>) {
                  extractRules(ruleSource, (Collection<?>) element, builder);
              }
          }
      }
docs: Find all content parts representing source code listings with a role that
  represents a rule.
  
  
  @param ruleSource
  The rule source.
  @param blocks
  The content parts of the document.
  @param builder
  The {@link RuleSetBuilder}.