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; }
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; }
@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)); }