@Test
 public void testParsable() throws Exception {
   final BParser parser = new BParser(machine.getName());
   Start start = parser.parseFile(machine, false);
   start.apply(new PositionTester());
   assertNotNull(start);
 }
  /**
   * See class description. First {@link AAssignSubstitution} nodes are checked, then the other
   * nodes.
   *
   * <p>An {@link CheckException} is thrown if there are {@link AAssignSubstitution} or {@link
   * AOperationCallSubstitution} nodes with illegal elements in the LHS. Otherwise the other
   * relevant nodes are checked for illegal entries in their identifier lists.
   *
   * <p>In both cases the erroneous nodes are collected, so that only one exception is thrown for
   * the {@link AAssignSubstitution} and {@link AOperationCallSubstitution} nodes respectively one
   * for all other nodes.
   *
   * @param rootNode
   * @throws CheckException : Erroneous {@link AAssignSubstitution} and {@link
   *     AOperationCallSubstitution} nodes are collected in one exception and all other nodes in
   *     another one.
   */
  public void runChecks(final Start rootNode) throws CheckException {
    nonIdentifiers.clear();

    /*
     * First check all assignment nodes if the LHS only contains identifiers
     * or functions.
     */
    final AssignCheck assignCheck = new AssignCheck();
    rootNode.apply(assignCheck);

    final Set<Node> assignErrorNodes = assignCheck.nonIdentifiers;
    if (assignErrorNodes.size() > 0) {
      throw new CheckException(
          "Identifier or function expected",
          assignErrorNodes.toArray(new Node[assignErrorNodes.size()]));
    }

    /*
     * Then check other constructs which can only contain identifiers at
     * special places.
     */
    rootNode.apply(this);

    if (nonIdentifiers.size() > 0) {
      // at least one error was found
      throw new CheckException(
          "Identifier expected", nonIdentifiers.toArray(new Node[nonIdentifiers.size()]));
    }
  }
 private String getTreeAsStringOrg(final String testMachine) throws BCompoundException {
   final BParser parser = new BParser("testcase");
   final Start startNode = parser.parse(testMachine, false);
   final Ast2String ast2String = new Ast2String();
   startNode.apply(ast2String);
   final String string = ast2String.toString();
   return string;
 }
 private String getTreeAsString(final String testMachine)
     throws BCompoundException, LexerException, IOException {
   final BParser parser = new BParser("testcase");
   Start ast = parser.eparse(testMachine, new Definitions());
   final Ast2String ast2String = new Ast2String();
   ast.apply(ast2String);
   final String string = ast2String.toString();
   return string;
 }