Пример #1
0
 @Override
 public String visit(ISymbol e) throws IVisitor.VisitorException {
   // Symbols do not necessarily have sorts - e.g. if they are function names
   ISort sort = typemap.get(e);
   if (!isFormula && sort != null && sort.isBool()) {
     throw new VisitorException(
         "Use of boolean in a term position is not yet implemented in the Simplify adapter",
         e.pos()); // FIXME - booleans as terms
   }
   // Simplify does not allow tab, newline, cr in identifiers;
   // these are allowed by SMTLIB.
   // Note that neither simplify nor SMTLIB allows \ or |
   // All other printable characters are allowed in both.
   String oldName = e.value();
   String newName = fcnNames.get(oldName);
   if (newName != null) {
     // There is a direct translation of a pre-defined SMT-LIB name
     // into a simplify equivalent - use it.
   } else {
     // Use the ? character as an escape
     newName =
         oldName.replace("?", "??").replace("\n", "?n").replace("\r", "?r").replace("\t", "?t");
     if (reservedWords.contains(newName)) {
       newName = newName + "?!";
     }
     newName = "|" + newName + "|";
   }
   return newName;
 }