public boolean isAnyVar() { return var.value().equals(ResolveAnonVar.ANON_VAR.name()); } }
private Optional<KLabel> klabelFromTerm(Term labelTerm) { if (labelTerm instanceof Constant) { Constant labelCon = (Constant) labelTerm; if (labelCon.production().sort().equals(Sorts.KLabel())) { String labelVal = labelCon.value(); if (labelVal.charAt(0) == '`') { return Optional.of(KLabel(labelVal.substring(1, labelVal.length() - 1))); } else { return Optional.of(KLabel(labelVal)); } } } return Optional.empty(); }
public Either<java.util.Set<ParseFailedException>, Term> apply(Constant c) { if (c.production().sort().equals(Sorts.KVariable())) { Sort declared = decl.get(getVarKey(c)); if (declared != null && !(declared.equals(Sorts.K()) && subsorts.lessThanEq(sort, Sorts.KList()))) { // if the declared/inferred sort is K, make sure it can fit in the context (ex. is not a KLabel) if ((!strictSortEquality && !subsorts.lessThanEq(declared, sort)) || (strictSortEquality && !declared.equals(sort))) { String msg = "Unexpected sort " + declared + " for term " + c.value() + ". Expected " + sort + "."; KException kex = new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, msg, c.source().orElse(null), c.location().orElse(null)); return Left.apply(Sets.newHashSet(new VariableTypeClashException(kex))); } return wrapTermWithCast(c, declared); } } return Right.apply(c); }
Constant c = (Constant) term; color(indenter, c.production(), 0, colorize); indenter.append(c.value()); resetColor(indenter, c.production(), colorize); } else if (term instanceof TermCons) {