Interface DSLScriptContextProvider


@NonNullByDefault public interface DSLScriptContextProvider
Interface of a provider that can provide Xbase-relevant object structures for a purely string based script. This is required to support DSL rules, which can have a context (variables) per file that is shared among multiple rules.
Author:
Kai Kreuzer - Initial contribution
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Identifier for scripts that are created from a DSL rule file
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable org.eclipse.xtext.xbase.interpreter.IEvaluationContext
    getContext(String contextName)
    Returns the evaluation context, i.e.
    @Nullable org.eclipse.xtext.xbase.XExpression
    getParsedScript(String contextName, String ruleIndex)
    Returns the XExpression, which is the readily parsed script.
  • Field Details

    • CONTEXT_IDENTIFIER

      static final String CONTEXT_IDENTIFIER
      Identifier for scripts that are created from a DSL rule file
      See Also:
  • Method Details

    • getContext

      @Nullable org.eclipse.xtext.xbase.interpreter.IEvaluationContext getContext(String contextName)
      Returns the evaluation context, i.e. the current state of the variables of the rule file.
      Parameters:
      contextName - the filename of the rule file in question
      Returns:
      the evaluation context
    • getParsedScript

      @Nullable org.eclipse.xtext.xbase.XExpression getParsedScript(String contextName, String ruleIndex)
      Returns the XExpression, which is the readily parsed script. As it might refer to variables from the rule file scope, this script cannot be parsed independently.
      Parameters:
      contextName - the filename of the rule file in question
      ruleIndex - the index of the rule within the file
      Returns:
      the parsed script