Esempio n. 1
0
 public static Term wrap(Term t, String label, Ellipses ellipses) {
   Cell cell = new Cell(t.getLocation(), t.getFilename());
   cell.setLabel(label);
   cell.setEllipses(ellipses);
   cell.setContents(t);
   return cell;
 }
Esempio n. 2
0
 public static Term defaultTerm(Term v, org.kframework.kil.loader.Context context) {
   String sort = v.getSort();
   KSort ksort = KSort.getKSort(sort).mainSort();
   if (ksort.isDefaultable()) return new Empty(ksort.toString());
   GlobalSettings.kem.register(
       new KException(
           ExceptionType.WARNING,
           KExceptionGroup.COMPILER,
           "Don't know the default value for term " + v.toString() + ". Assuming .K",
           v.getFilename(),
           v.getLocation()));
   return KSequence.EMPTY;
 }
Esempio n. 3
0
 @Override
 public void visit(TermCons node) {
   if (!node.getCons().equals(MetaK.Constants.freshCons)) {
     super.visit(node);
     return;
   }
   if (!inCondition) {
     GlobalSettings.kem.register(
         new KException(
             KException.ExceptionType.ERROR,
             KException.KExceptionGroup.COMPILER,
             "Fresh can only be used in conditions.",
             getName(),
             node.getFilename(),
             node.getLocation()));
   }
   final Term term = node.getContents().get(0);
   if (!(term instanceof Variable)) {
     GlobalSettings.kem.register(
         new KException(
             KException.ExceptionType.ERROR,
             KException.KExceptionGroup.COMPILER,
             "Fresh can only be applied to variables, but was applied to\n\t\t" + term,
             getName(),
             term.getFilename(),
             term.getLocation()));
   }
   Variable v = (Variable) term;
   if (left.containsKey(v)) {
     for (Variable v1 : left.keySet()) {
       if (v1.equals(v)) {
         GlobalSettings.kem.register(
             new KException(
                 KException.ExceptionType.ERROR,
                 KException.KExceptionGroup.COMPILER,
                 "Fresh variable \"" + v1 + "\" is bound in the rule pattern.",
                 getName(),
                 v1.getFilename(),
                 v1.getLocation()));
       }
     }
   }
   left.put(v, new Integer(1));
 }
Esempio n. 4
0
File: KApp.java Progetto: kszr/k
 /**
  * Constructs a {@link KApp} object representing the application of the specified KLabel to the
  * specified KList.
  *
  * @param label the KLabel which is applied to the given KList. A non-null instance of {@link
  *     KLabel}, {@link Variable} of sort KLabel or {@link Ambiguity}.
  * @param child the KList which the given KLabel is applied to. A non-null instance of {@link
  *     KList}, {@link Variable} of sort KList, or {@link Ambiguity}.
  */
 public KApp(Term label, Term child) {
   super(label.getLocation(), label.getSource(), Sort.KITEM);
   setLabel(label);
   setChild(child);
 }