Interface Translator

All Superinterfaces:
AliasedCommandProvider
All Known Implementing Classes:
NoopTranslator, TokenStreamTranslator

public interface Translator extends AliasedCommandProvider
The interface that supports GDA extended jython syntax. It allows dynamically adding special keyword into GDA at runtime and translate these keywords related syntax to corresponding Python syntax (for example functions/methods) before execution.

All classes should return the original string in the event of an error during the translation, so that the Jython may create a syntax error message.

  • Method Details

    • translate

      String translate(String originalCommand)
      Translate a command potentially containing GDA extended syntax into the Jython equivalent. Commands should be passed as one string rather than a line at a time as multiline constructs may need to be handled differently.
      Parameters:
      originalCommand - The full command as entered, possibly using extended syntax
      Returns:
      Pure Jython equivalent of originalCommand. If original command contains other syntax errors, a best effort is made to preserve the errors after translation rather than fixing them.
    • addAliasedCommand

      void addAliasedCommand(String commandName)
      Adds a new aliased command.
      Parameters:
      commandName -
    • addAliasedVarargCommand

      void addAliasedVarargCommand(String commandName)
      Adds a new variable argument aliased command.
      Parameters:
      commandName -
    • removeAlias

      void removeAlias(String command)
      Remove the given command from the held lists of aliases. This will remove the command from both vararg and non-vararg lists
      Parameters:
      command - to remove