Exemplo n.º 1
0
  /**
   * Loads a theory into the given symbol table.
   *
   * @param theoryName the theory to load
   * @param symTable the symbol table into which to put the theory
   * @return null if OK, otherwise an error as a IResponse
   */
  public /* @Nullable */ IResponse loadTheory(String theoryName, SymbolTable symTable) {
    ITheory th = null;
    try {
      th = findTheory(theoryName, smtConfig.logicPath);
    } catch (SMTLIBException e) {
      return e.errorResponse;
    }

    // The second element should be the name of the logic, if specified
    if (theoryName != null && !theoryName.equals(th.theoryName().value())) {
      return smtConfig.responseFactory.error(
          "Definition of logic "
              + theoryName
              + " is mal-formed (internal name does not match file name): "
              + th.theoryName().value(),
          th.theoryName().pos());
    }

    if (smtConfig.verbose != 0) {
      smtConfig.log.logDiag("#Installing theory " + theoryName);
    }

    /* @Nullable */ IResponse response = loadTheory(th, symTable);
    if (response == null) {
      if (theoryName.equals("ArraysEx")) symTable.arrayTheorySet = true;
      if (theoryName.equals("Fixed_Size_BitVectors")) symTable.bitVectorTheorySet = true;
      if (theoryName.equals("Reals_Ints")) symTable.realsIntsTheorySet = true;
    }
    return response;
  }