tomp.xtcl
Class XTCompiler

java.lang.Object
  extended bytomp.xtcl.XTCompiler

public class XTCompiler
extends java.lang.Object

Reads the commands from the underlying CommandLineReader, within a Context and produces a Command (usually a Sequence)


Constructor Summary
XTCompiler(Context c)
          Creates a new instance of XTCompiler working within a Context
XTCompiler(XTCompiler parent)
          Creates a new child XTCompiler
 
Method Summary
 Command compile(CommandLineReader clr)
          Compiles commands from a CommandLineReader into a command Sequence
 Command compile(java.io.File f)
          Compiles commands from a String
 Command compile(java.lang.String s)
          Compiles commands from a String
 Command compile(java.lang.String[] cl, CommandLineReader clr)
          The main compile method.
protected  Command compile(java.lang.String cl, CommandLineReader clr)
          Compiles commands from a String followed by a CommandLineReader into a command Sequence
 int compileAndExecute(java.lang.String s)
          Compiles and executes commands from a String
 int execute(Command command)
          Executes a command in the current context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XTCompiler

public XTCompiler(Context c)
Creates a new instance of XTCompiler working within a Context

Parameters:
c - Context in which the XTCompiler works

XTCompiler

public XTCompiler(XTCompiler parent)
Creates a new child XTCompiler

Method Detail

execute

public int execute(Command command)
            throws java.lang.Exception
Executes a command in the current context

Parameters:
command - to be executed
Returns:
return code from execution
Throws:
java.lang.Exception

compile

public Command compile(java.io.File f)
                throws java.lang.Exception
Compiles commands from a String

Throws:
java.lang.Exception

compile

public Command compile(java.lang.String s)
                throws java.lang.Exception
Compiles commands from a String

Parameters:
s - String - the source from which it compiles
Throws:
java.lang.Exception

compileAndExecute

public int compileAndExecute(java.lang.String s)
                      throws java.lang.Exception
Compiles and executes commands from a String

Parameters:
s - String - the source from which it compiles
Throws:
java.lang.Exception

compile

public Command compile(CommandLineReader clr)
                throws java.lang.Exception
Compiles commands from a CommandLineReader into a command Sequence

Parameters:
clr - CommandLineReader - the source for compilation
Throws:
java.lang.Exception

compile

protected Command compile(java.lang.String cl,
                          CommandLineReader clr)
                   throws java.lang.Exception
Compiles commands from a String followed by a CommandLineReader into a command Sequence

Parameters:
cl - String - will be tokenized and passed further to compile(String[], CommandLineReader)
clr - CommandLineReader - the sources for compilation first the String, then the CLR
Throws:
java.lang.Exception

compile

public Command compile(java.lang.String[] cl,
                       CommandLineReader clr)
                throws java.lang.Exception
The main compile method.
Compiles commands from a String[] followed by a CommandLineReader into a command Sequence

Parameters:
cl - String[] - array with one input line parsed into tokens
clr - CommandLineReader - the sources for compilation first the String[], then the CLR
Throws:
java.lang.Exception