Package gda.jython.translator
Interface Translator
- All Superinterfaces:
AliasedCommandProvider
- All Known Implementing Classes:
NoopTranslator,TokenStreamTranslator
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 Summary
Modifier and TypeMethodDescriptionvoidaddAliasedCommand(String commandName) Adds a new aliased command.voidaddAliasedVarargCommand(String commandName) Adds a new variable argument aliased command.voidremoveAlias(String command) Remove the given command from the held lists of aliases.Translate a command potentially containing GDA extended syntax into the Jython equivalent.Methods inherited from interface gda.jython.AliasedCommandProvider
getAliasedCommands, getAliasedVarargCommands, hasAlias
-
Method Details
-
translate
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
Adds a new aliased command.- Parameters:
commandName-
-
addAliasedVarargCommand
Adds a new variable argument aliased command.- Parameters:
commandName-
-
removeAlias
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
-