Tea Java Runtime API
Version 3.1.0

com.pdmfc.tea.compiler
Class SCompiler

java.lang.Object
  |
  +--com.pdmfc.tea.compiler.SCompiler

public class SCompiler
extends java.lang.Object

Parses a Tea script and produces bytecode, that can be executed later. The bytecode is stored inside a SCode object.

Objects of this class should not be used from inside of more then one thread at a time.


Constructor Summary
SCompiler()
           
 
Method Summary
 SCode compile(byte[] script)
          Compiles the Tea script stored in the script byte array.
 SCode compile(byte[] script, int offset, int length)
          Compiles the Tea script stored in the script byte array.
 SCode compile(java.io.InputStream input)
          Compiles the Tea script read from the an InputStream.
 SCode compile(java.io.InputStream input, java.lang.String fileName)
          Compiles the Tea script read from the an InputStream.
 SCode compile(java.lang.String fileName)
          Compiles the Tea script read from the file fileName and builds an SCode object representing the compiled code.
static java.lang.String unescape(java.lang.String s)
          Takes a Tea string literal and builds the string represented by that literal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SCompiler

public SCompiler()
Method Detail

compile

public SCode compile(java.lang.String fileName)
              throws SCompileException
Compiles the Tea script read from the file fileName and builds an SCode object representing the compiled code.
Parameters:
fileName - The name of the file containing the Tea script.
Returns:
A SCode object containing the bytecode that can be executed later.
Throws:
SCompileException - Thrown in the following cases:
  • The file could not be opened for reading.
  • There were problems while reading the file.
  • The Tea script had syntax errors.

compile

public SCode compile(java.io.InputStream input,
                     java.lang.String fileName)
              throws SCompileException
Compiles the Tea script read from the an InputStream.
Parameters:
input - Reference to an InputStream where a script will be read from.
Returns:
A SCode object containing the bytecode that can be executed later.
Throws:
SCompileException - Thrown if a syntax error was found during compilation or there were problems reading from the InputStream.

compile

public SCode compile(java.io.InputStream input)
              throws SCompileException
Compiles the Tea script read from the an InputStream.
Parameters:
input - Reference to an InputStream where a script will be read from.
Returns:
A SCode object containing the bytecode that can be executed later.
Throws:
SCompileException - Thrown if a syntax error was found during compilation.

compile

public SCode compile(byte[] script,
                     int offset,
                     int length)
              throws SCompileException
Compiles the Tea script stored in the script byte array.
Parameters:
script - A Tea script.
Returns:
A SCode object containing the bytecode that can be executed later.
Throws:
SCompileException - Thrown if a syntax error was found during compilation.

compile

public SCode compile(byte[] script)
              throws SCompileException
Compiles the Tea script stored in the script byte array.
Parameters:
script - A Tea script.
Returns:
A SCode object containing the bytecode that can be executed later.
Throws:
SCompileException - Thrown if a syntax error was found during compilation.

unescape

public static java.lang.String unescape(java.lang.String s)
Takes a Tea string literal and builds the string represented by that literal.
Parameters:
s - The Tea string literal to unescape.
Returns:
The unescaped string.

Tea Java Runtime API
Version 3.1.0

© 2002 PDM&FC, All Rights Reserved.