tcl.lang
Class Parser
java.lang.Object
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.
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 |
TCL_BRACKET_TERM
public static final int TCL_BRACKET_TERM
- See Also:
- Constant Field Values
Parser
public Parser()
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 parsenested
- 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 interpreterscript_array
- script to be loggedscript_index
- first character in script containing command; must be <=
cmdIndexcmdIndex
- first character in command that generated the errorlength
- number of bytes in command, or -1 to use all bytes up to first
null bytee
- 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.