How to integrate a new interpreter in JRosetta

ls://dev.artenum.com/projects/JRosetta/forum/How_to_integrate_a_new_interpreter_in_JRosetta

posted by Jourdain Sebastien at Jan 14, 2008 5:36 PM
Quote
public class FakeInputParsingManager implements InputParsingManager {

public FakeInputParsingManager() { }

public void append(String content) { // TODO Auto-generated method stub }

public int getCaretPosition() { // TODO Auto-generated method stub return 0; }

public String getCommandLine() { // TODO Auto-generated method stub return "Fake cmd line " + localId; }

public int getCompletionLevel() { // TODO Auto-generated method stub return 0; }

public int getNumberOfLines() { // TODO Auto-generated method stub return 0; }

public String getPartLevel(int level) { // TODO Auto-generated method stub return null; }

public Point getWindowCompletionLocation() { // TODO Auto-generated method stub return null; }

public boolean isBlockEditing() { // TODO Auto-generated method stub return false; }

public void reset() { // TODO Auto-generated method stub }

public void setInputCommandView(InputCommandView inputCommandView) { // TODO Auto-generated method stub }

public void writeCompletionPart(String completionResult) { // TODO Auto-generated method stub }

public void backspace() { // TODO Auto-generated method stub } }

posted by Jourdain Sebastien at Jan 14, 2008 5:35 PM
Quote
public class FakeGenericInterpreter  implements GenericInterpreter {

public Object eval(String script) throws ScriptException { // TODO Auto-generated method stub return null; }

public Object eval(Reader reader) throws ScriptException { // TODO Auto-generated method stub return null; }

public Object get(String key) { // TODO Auto-generated method stub return null; }

public Writer getErrorWriter() { // TODO Auto-generated method stub return null; }

public Reader getReader() { // TODO Auto-generated method stub return null; }

public Writer getWriter() { // TODO Auto-generated method stub return null; }

public void put(String key, Object value) { // TODO Auto-generated method stub }

public void setErrorWriter(Writer writer) { // TODO Auto-generated method stub }

public void setReader(Reader reader) { // TODO Auto-generated method stub }

public void setWriter(Writer writer) { // TODO Auto-generated method stub } }

posted by Jourdain Sebastien at Jan 14, 2008 5:23 PM
Quote
You can based your main file from the one available in the class com.artenum.rosetta.ui.Console

This main use a configuration file that specify :

  • all the class that should be used for each component part.
  • keymap shortcut
The class that need specific implementation are :
  • InputParsingManager: Manage the processing of the command line for the completion
  • GenericInterpreter: The adapter for the langage interpreter that you want. (Map the JRosetta API to Jython, beanshell interpreter...)
  • CompletionManager: To process the command line in order to build the completion window

posted by Jourdain Sebastien at Jan 14, 2008 5:09 PM
Quote
  • First of all create a new project in your preferred IDE (eclipse or netbean or someting else).
  • Add the 2 jars of JRosetta as thirdpart
  • Then you will need to create some files such as
    • a Main
    • An adapter for your interpreter
    • some other adapter.
Lets go deeper now…

Decorated version - Feeds - LibreSource