Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

GuiComponents.scripting.DefaultInterpreter Class Reference

Inheritance diagram for GuiComponents.scripting.DefaultInterpreter:

Inheritance graph
[legend]
Collaboration diagram for GuiComponents.scripting.DefaultInterpreter:

Collaboration graph
[legend]
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)
JConsole getConsole ()
String toString ()
List 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.


Protected Attributes

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

Private Attributes

int nestLevel = 0
StringBuffer buffered = new StringBuffer()

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

Definition at line 28 of file DefaultInterpreter.java.


Member Function Documentation

List GuiComponents.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 GuiComponents.Console.NameCompletionListener.

Definition at line 185 of file DefaultInterpreter.java.

References GuiComponents.scripting.NameCompleter.completeName().

Here is the call graph for this function:

boolean GuiComponents.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 GuiComponents.scripting.BeanShellInterpreter.

Definition at line 68 of file DefaultInterpreter.java.

Referenced by GuiComponents.scripting.JythonInterpreter.exec(), and GuiComponents.scripting.DefaultInterpreter.exec().


The documentation for this class was generated from the following file:
Generated on Thu Jul 15 09:56:22 2004 for SCT DAQ/DCS Software - Java by doxygen 1.3.5