Main Page   Packages   Class Hierarchy   Compound List   Compound Members   Related Pages  

scripting.DefaultInterpreter Class Reference

Inheritance diagram for scripting.DefaultInterpreter:

Console.NameCompletionListener scripting.BeanShellInterpreter scripting.JavaScriptInterpreter scripting.JythonInterpreter List of all members.

Public Member Functions

 DefaultInterpreter (JConsole console, BSFEngine engine)
 Creates a new instance of DefaultInterpreter.

 DefaultInterpreter (JConsole console, BSFEngine engine, NameCompleter name)
String toString ()
void completeName (String curCmd)
 Invoked when we need to complete a name.

void exec (String s, String source, int row, int column)
 Executes the string.

void exec (String s)
void actionPerformed (ActionEvent e)
 Invoked when an action occurs.


Protected Member Functions

boolean printObject (Object val)
 Should be overridden to return false when executing a line that returns void.

boolean startBlock (String line)
 Returns true if this line starts a block.

boolean endBlock (String line)
 Return true if this line ends a block.

boolean continueLine (String line)
 Default behaviour is to see if line ends with a line continuation character.

int nestLevel ()
void incIndent ()
 Prints an indent - helpful for the user when typing in blocks.

void decIndent ()
void setIndent (int level)
void printStartMaterial ()
 Prints the initial blurb you see Sub-classes should override to tell the user how to get the help text at least.

void printHelp ()
 Prints some help for the user.

void consoleCommand (String command)
 Executes a console command The string should include the initial char.

void loadFile (String file)
 Load the contents of file and execute them.

String completeInline (String part, List l)

Protected Attributes

JConsole console
BSFEngine engine
NameCompleter completer
String defaultPath
String consoleCommandString = "."
char endCommandChar = '\n'
char lineContinueChar = '\\'
char blockStartChar = '{'
char blockEndChar = '}'

Detailed Description

Author:
Matthew Palmer
This class is the top level interface to the BSF It has a console and does some standard things like reading from the streams For various reasons, specific languages may want a modified version of this class, they should sub-class it.

It would use the GUIConsole interface from bsh except the interface doesn't have half the methods of JConsole! So we just use JConsole directly for now. This is less likely to need sub-classing, but you never know!

Most of what this class does is sit in a loop trying to read from the console input stream. It also provides some useful functions that it processes rather than passing them to the underlying scripting engine


Member Function Documentation

void scripting.DefaultInterpreter.completeName String    curCmd
 

Invoked when we need to complete a name.

Do some minimal filtering and pass it onto the NameCompleter objects.

Implements Console.NameCompletionListener.

boolean scripting.DefaultInterpreter.printObject Object    val [protected]
 

Should be overridden to return false when executing a line that returns void.

Note, should always return false if the return value is null

Reimplemented in scripting.BeanShellInterpreter, and scripting.JavaScriptInterpreter.


The documentation for this class was generated from the following file:
Generated on Mon Dec 15 19:38:44 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3