private Block addBlock(Method method, Statement stat) throws InvalidSpecCompileException {
    String label = stat.getStatementLabel();

    for (BlockParseInfo blockInfo: BlockParseInfo.values()) {
      if (!label.equals(blockInfo.toString())) continue;

      checkIsValidSuccessor(method, blockInfo, stat.getLineNumber(), stat.getColumnNumber());
      Block block = blockInfo.addNewBlock(method);
      String description = getDescription(stat);
      if (description == null)
        block.getAst().add(stat);
      else
        block.getDescriptions().add(description);

      return block;
    }

    throw new InvalidSpecCompileException(stat, "Unrecognized block label: " + label);
  }
Given the abstract syntax tree of a Groovy class representing a Spock
specification, builds an object model of the specification.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/compiler/SpecParser.java