Tuple2<Either<Set<ParseFailedException>, Term>, Set<ParseFailedException>> candidate = null; for (Term t : amb.items()) { candidate = this.apply(t); K next = new TreeNodesToKORE(Outer::parseSort, strict).apply(new RemoveBracketVisitor().apply(candidate._1().right().get())); if (last != null) { new KException(ExceptionType.WARNING, KExceptionGroup.INNER_PARSER, msg, amb.items().iterator().next().source().get(), amb.items().iterator().next().location().get())); Tuple2<Either<Set<ParseFailedException>, Term>, Set<ParseFailedException>> rez = this.apply(amb.items().iterator().next()); return new Tuple2<>(Right.apply(rez._1().right().get()), Sets.union(Sets.newHashSet(w), rez._2()));
public static Term disambiguateForUnparse(Module mod, Term ambiguity) { Term rez3 = new PushTopAmbiguityUp().apply(ambiguity); Either<Set<ParseFailedException>, Term> rez = new ApplyTypeCheckVisitor(mod.subsorts()).apply(rez3); Tuple2<Either<Set<ParseFailedException>, Term>, Set<ParseFailedException>> rez2; if (rez.isLeft()) { rez2 = new AmbFilter(false).apply(rez3); return rez2._1().right().get(); } rez2 = new VariableTypeInferenceFilter(mod.subsorts(), mod.definedSorts(), mod.productionsFor(), false, false).apply(rez.right().get()); if (rez2._1().isLeft()) { rez2 = new AmbFilter(false).apply(rez.right().get()); return rez2._1().right().get(); } rez3 = new PushAmbiguitiesDownAndPreferAvoid(mod.overloads()).apply(rez2._1().right().get()); rez2 = new AmbFilter(false).apply(rez3); return rez2._1().right().get(); } }
return new Tuple2<>(rez, warn); rez3 = new PushAmbiguitiesDownAndPreferAvoid(disambModule.overloads()).apply(rez.right().get()); rez2 = new AmbFilter(strict && inferSortChecks).apply(rez3); warn = Sets.union(rez2._2(), warn); rez2 = new AddEmptyLists(disambModule).apply(rez2._1().right().get());