tcl.lang
Class Parser

java.lang.Object
  extended by tcl.lang.Parser

public class Parser
extends Object

This class contains methods that parse Tcl scripts. They do so in a general-purpose fashion that can be used for many different purposes, including compilation, direct execution, code analysis, etc. This class also includes a few additional procedures such as evalObjv, eval, and eval2, which allow scripts to be evaluated directly, without compiling.


Field Summary
static int TCL_BRACKET_TERM
           
 
Constructor Summary
Parser()
           
 
Method Summary
static TclObject[] grabObjv(Interp interp, int size)
           
static boolean isParseableScript(String script, boolean nested)
          Test whether a script can be parsed, without actually doing any execution
static void logCommandInfo(Interp interp, char[] script_array, int script_index, int cmdIndex, int length, TclException e)
          This procedure is invoked after an error occurs in an interpreter.
static ParseResult parseVar(Interp interp, String string)
           
static void releaseObjv(Interp interp, TclObject[] objv, int size)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TCL_BRACKET_TERM

public static final int TCL_BRACKET_TERM
See Also:
Constant Field Values
Constructor Detail

Parser

public Parser()
Method Detail

isParseableScript

public static boolean isParseableScript(String script,
                                        boolean nested)
Test whether a script can be parsed, without actually doing any execution

Parameters:
script - script to parse
nested - script is nested; should consider bracket as close
Returns:
true if script has no parsing errors; false otherwise

logCommandInfo

public static void logCommandInfo(Interp interp,
                                  char[] script_array,
                                  int script_index,
                                  int cmdIndex,
                                  int length,
                                  TclException e)
This procedure is invoked after an error occurs in an interpreter. It adds information to the "errorInfo" variable to describe the command that was being executed when the error occurred. Side effects: Information about the command is added to errorInfo and the line number stored internally in the interpreter is set. If this is the first call to this procedure or interp.addErrorInfo since an error occurred, then old information in errorInfo is deleted.

Parameters:
interp - current interpreter
script_array - script to be logged
script_index - first character in script containing command; must be <= cmdIndex
cmdIndex - first character in command that generated the error
length - number of bytes in command, or -1 to use all bytes up to first null byte
e - exception caused by the script evaluation

parseVar

public static ParseResult parseVar(Interp interp,
                                   String string)
                            throws TclException
Throws:
TclException

grabObjv

public static TclObject[] grabObjv(Interp interp,
                                   int size)

releaseObjv

public static void releaseObjv(Interp interp,
                               TclObject[] objv,
                               int size)


Copyright © 2015. All rights reserved.