@Override public Term apply(TermCons tc) { if (tc.production().att().contains("bracket") || tc.production().klabel().get().name().equals("#SyntacticCast") || tc.production().klabel().get().name().equals("#InnerCast") || tc.production().klabel().get().name().equals("#OuterCast")) { return apply(tc.get(0)); } return super.apply(tc); } }
@Override public Term apply(TermCons tc) { if (tc.production().sort().name().equals("RuleContent")) { Term t = new PushTopAmbiguityUp2().apply(tc.get(0)); if (t instanceof Ambiguity) { Ambiguity old = (Ambiguity)t; Set<Term> newTerms = new HashSet<>(); for (Term child : old.items()) { Term newTerm = tc.with(0, child); newTerms.add(newTerm); } return Ambiguity.apply(newTerms); } } return super.apply(tc); }
@Override public Term apply(TermCons tc) { if (tc.production().klabel().isDefined() && tc.production().klabel().get().equals(KLabels.KREWRITE)) { Term t = tc.get(0); if (t instanceof Ambiguity) { Ambiguity old = (Ambiguity)t; Set<Term> newTerms = new HashSet<>(); for (Term child : old.items()) { Term newTerm = tc.with(0, child); newTerms.add(newTerm); } return Ambiguity.apply(newTerms); } } return super.apply(tc); } }
public Term apply(TermCons tc) { for (int i = 0, j = 0; i < tc.production().items().size(); i++) { if (tc.production().items().apply(i) instanceof NonTerminal) { if (tc.production().klabel().isDefined() && (tc.production().klabel().get().name().equals("#SyntacticCast") || tc.production().klabel().get().name().startsWith("#SemanticCastTo") || tc.production().klabel().get().name().equals("#InnerCast")) || (isFunctionRule(tc) && j == 0)) { Term t = tc.get(0); new CollectUndeclaredVariables2(getSortOfCast(tc)).apply(t); j++; } else { Term t = tc.get(j); new CollectUndeclaredVariables2(((NonTerminal) tc.production().items().apply(i)).sort()).apply(t); j++; } } } return super.apply(tc); }