Search in sources :

Example 1 with ConstraintTerms

use of mb.nabl2.stratego.ConstraintTerms in project nabl by metaborg.

the class AnalysisPrimitive method call.

public Optional<? extends IStrategoTerm> call(IScopeGraphUnit unit, IStrategoTerm sterm, List<IStrategoTerm> sterms, ITermFactory factory) throws InterpreterException {
    final StrategoTerms strategoTerms = new StrategoTerms(factory);
    final List<ITerm> terms = sterms.stream().skip(1).map(strategoTerms::fromStratego).map(ConstraintTerms::specialize).collect(Collectors.toList());
    final ITerm term = ConstraintTerms.specialize(strategoTerms.fromStratego(sterm));
    Optional<? extends ITerm> result = call(unit, term, terms);
    return result.map(ConstraintTerms::explicate).map(strategoTerms::toStratego);
}
Also used : StrategoTerms(mb.nabl2.stratego.StrategoTerms) ITerm(mb.nabl2.terms.ITerm)

Example 2 with ConstraintTerms

use of mb.nabl2.stratego.ConstraintTerms in project nabl by metaborg.

the class ScopeGraphContextPrimitive method call.

public Optional<? extends IStrategoTerm> call(IScopeGraphContext<?> context, IStrategoTerm sterm, List<IStrategoTerm> sterms, ITermFactory factory) throws InterpreterException {
    StrategoTerms strategoTerms = new StrategoTerms(factory);
    ITerm term = ConstraintTerms.specialize(strategoTerms.fromStratego(sterm));
    List<ITerm> terms = sterms.stream().map(strategoTerms::fromStratego).map(ConstraintTerms::specialize).collect(Collectors.toList());
    Optional<? extends ITerm> result = call(context, term, terms);
    return result.map(ConstraintTerms::explicate).map(strategoTerms::toStratego);
}
Also used : StrategoTerms(mb.nabl2.stratego.StrategoTerms) ITerm(mb.nabl2.terms.ITerm)

Example 3 with ConstraintTerms

use of mb.nabl2.stratego.ConstraintTerms in project nabl by metaborg.

the class AnalysisNoTermPrimitive method call.

@Override
public Optional<? extends IStrategoTerm> call(IScopeGraphUnit unit, IStrategoTerm sterm, List<IStrategoTerm> sterms, ITermFactory factory) throws InterpreterException {
    StrategoTerms strategoTerms = new StrategoTerms(factory);
    Optional<? extends ITerm> result = call(unit);
    return result.map(ConstraintTerms::explicate).map(strategoTerms::toStratego);
}
Also used : StrategoTerms(mb.nabl2.stratego.StrategoTerms)

Aggregations

StrategoTerms (mb.nabl2.stratego.StrategoTerms)3 ITerm (mb.nabl2.terms.ITerm)2