IStrategoCommon

public interface IStrategoCommon

Methods

builderInputTerm

IStrategoTerm builderInputTerm(IStrategoTerm ast, FileObject resource, FileObject location)

Creates an input term for a builder.

Parameters:
  • ast – Term to use as the AST.
  • resource – Location of the input resource.
  • location – Location of the input context.
Returns:

A 5-tuple input term (selected, position, ast, path, project-path).

invoke

IStrategoTerm invoke(ILanguageComponent component, IContext context, IStrategoTerm input, String strategy)

Invokes a Stratego strategy in given component.

Parameters:
  • component – Component to invoke the strategy in.
  • context – Context to initialize the runtime with.
  • input – Input term
  • strategy – Name of the strategy to call.
Throws:
Returns:

Resulting term, or null if the strategy failed.

invoke

IStrategoTerm invoke(ILanguageImpl impl, IContext context, IStrategoTerm input, String strategy)

Invokes a Stratego strategy in components of given language implementation. Returns the first result that succeeds.

Parameters:
  • impl – Language implementation to invoke the strategy in.
  • context – Context to initialize the runtime with.
  • input – Input term
  • strategy – Name of the strategy to call.
Throws:
Returns:

Resulting term, or null if the strategy failed.

invoke

IStrategoTerm invoke(ILanguageImpl impl, FileObject location, IStrategoTerm input, String strategy)

Invokes a Stratego strategy in components of given language implementation. Returns the first result that succeeds.

Parameters:
  • impl – Language implementation to invoke the strategy in.
  • location – Location to initialize the Stratego runtime with.
  • input – Input term
  • strategy – Name of the strategy to call.
Throws:
Returns:

Resulting term, or null if the strategy failed.

invoke

IStrategoTerm invoke(HybridInterpreter runtime, IStrategoTerm input, String strategy)

Invokes a Strategy strategy in given runtime.

Parameters:
  • runtime – Stratego runtime to invoke the strategy in.
  • input – Input term
  • strategy – Name of the strategy to call.
Throws:
Returns:

Resulting term, or null if the strategy failed.

locationTerm

IStrategoString locationTerm(FileObject location)

Converts a location into a Stratego string.

Parameters:
  • localLocation – Location to convert.
Returns:

Stratego string with location.

prettyPrint

IStrategoString prettyPrint(IStrategoTerm term)

Pretty prints an ATerm.

Parameters:
  • term – ATerm to pretty print.
Returns:

Pretty printed ATerm as a Stratego string.

resourceTerm

IStrategoString resourceTerm(FileObject resource, FileObject location)

Converts a resource relative to a location into a Stratego string.

Parameters:
  • localResource – Resource to convert.
  • localLocation – Location to convert relative to.
Returns:

Stratego string with resource.

toString

String toString(IStrategoTerm term)

Turns given term into a string. If the term is a string, return the string. Otherwise, return a pretty-printed term.

Parameters:
  • term – Term to convert to a string.
Returns:

Result as a string.