public static Rule transformFunction(Function<K, K> f, Rule r) { return Rule.apply(f.apply(r.body()), f.apply(r.requires()), f.apply(r.ensures()), r.att()); }
public static Rule transform(Function1<K, K> f, Rule r) { return Rule.apply(f.apply(r.body()), f.apply(r.requires()), f.apply(r.ensures()), r.att()); }
private static Sentence markRegularRules(Definition d, ConfigurationInfoFromModule configInfo, Sentence s, String att) { if (s instanceof org.kframework.definition.Rule) { org.kframework.definition.Rule r = (org.kframework.definition.Rule) s; if (r.body() instanceof KApply) { KLabel klabel = ((KApply) r.body()).klabel(); if (d.mainModule().sortFor().contains(klabel) //is false for rules in specification modules not part of semantics && d.mainModule().sortFor().apply(klabel).equals(configInfo.topCell())) { return Rule.apply(r.body(), r.requires(), r.ensures(), r.att().add(att)); } } } return s; }
public Sentence apply(Sentence s) { if (s instanceof Rule) { Rule r = (Rule) s; boolean has_THIS_CONFIGURATION = new ExistsK() { @Override public Boolean apply(KVariable v) { return v.name().equals(KLabels.THIS_CONFIGURATION); } }.apply(r.body()); boolean has_RESTORE_CONFIGURATION = new ExistsK() { @Override public Boolean apply(KApply k) { return k.klabel().name().equals("#RESTORE_CONFIGURATION") || super.apply(k); } }.apply(r.body()); Att newAtt = has_THIS_CONFIGURATION ? r.att().add(Att.refers_THIS_CONFIGURATION()) : r.att(); newAtt = has_RESTORE_CONFIGURATION ? newAtt.add(Att.refers_RESTORE_CONFIGURATION()) : newAtt; return Rule.apply(r.body(), r.requires(), r.ensures(), newAtt); } else return s; } }