| java.lang.Object tcl.lang.Expression
Expression | class Expression (Code) | | This class handles Tcl expressions.
|
Method Summary | |
static void | DivideByZero(Interp interp) | static void | DomainError(Interp interp) | static void | DoubleTooLarge(Interp interp) | static void | DoubleTooSmall(Interp interp) | static void | EmptyStringOperandError(Interp interp, int operator) | static void | ExprParseObject(Interp interp, TclObject obj, ExprValue value) Given a TclObject, such as the result of a command or
variable evaluation, fill in a ExprValue with the
parsed result. | static void | ExprParseString(Interp interp, TclObject obj, ExprValue value) TclParseNumber -> ExprParseString
Given a TclObject that contains a String to be parsed (from
a command or variable subst), fill in an ExprValue based on
the string's numeric value. | static void | IllegalType(Interp interp, int badType, int operator) | static void | IntegerTooLarge(Interp interp) | void | SyntaxError(Interp interp) | static void | checkDoubleRange(Interp interp, double d) | static void | checkIntegerRange(Interp interp, double d) | static void | evalBinaryOperator(Interp interp, int operator, ExprValue value, ExprValue value2) | boolean | evalBoolean(Interp interp, String string) Evaluate an Tcl expression.
Parameters: interp - the context in which to evaluate the expression. Parameters: string - expression to evaluate. exception: TclException - for malformed expressions. | void | evalMathFunction(Interp interp, String funcName, ExprValue[] values, boolean releaseValues, ExprValue result) This procedure will lookup and invoke a math function
given the name of the function and an array of ExprValue
arguments. | void | evalMathFunction(Interp interp, String funcName, MathFunction mathFunc, ExprValue[] values, boolean releaseValues, ExprValue result) This procedure implements a math function invocation. | void | evalSetResult(Interp interp, String string) Evaluate a Tcl expression and set the interp result to the value.
Parameters: interp - the context in which to evaluate the expression. Parameters: string - expression to evaluate. | static void | evalUnaryOperator(Interp interp, int operator, ExprValue value) | static String | getBooleanToken(String tok) | final ExprValue | grabExprValue() | static boolean | looksLikeInt(String s, int len, int i, boolean whole) This procedure decides whether the leading characters of a
string look like an integer or something else (such as a
floating-point number or string). | ExprValue | mathFunction(Interp interp) Parses a math function from an expression string, carry out the
function, and return the value computed.
Parameters: interp - current interpreter. | void | registerMathFunction(String name, MathFunction mathFunc) This procedure will register a math function by
adding it to the table of available math functions. | final void | releaseExprValue(ExprValue val) |
BIT_AND | final static int BIT_AND(Code) | | |
BIT_NOT | final static int BIT_NOT(Code) | | |
BIT_OR | final static int BIT_OR(Code) | | |
BIT_XOR | final static int BIT_XOR(Code) | | |
CLOSE_PAREN | final static int CLOSE_PAREN(Code) | | |
COLON | final static int COLON(Code) | | |
COMMA | final static int COMMA(Code) | | |
DIVIDE | final static int DIVIDE(Code) | | |
EQUAL | final static int EQUAL(Code) | | |
GREATER | final static int GREATER(Code) | | |
LEFT_SHIFT | final static int LEFT_SHIFT(Code) | | |
LESS | final static int LESS(Code) | | |
MINUS | final static int MINUS(Code) | | |
MULT | final static int MULT(Code) | | |
OPEN_PAREN | final static int OPEN_PAREN(Code) | | |
PLUS | final static int PLUS(Code) | | |
QUESTY | final static int QUESTY(Code) | | |
RIGHT_SHIFT | final static int RIGHT_SHIFT(Code) | | |
STREQ | final static int STREQ(Code) | | |
STRNEQ | final static int STRNEQ(Code) | | |
UNARY_MINUS | final static int UNARY_MINUS(Code) | | |
UNARY_PLUS | final static int UNARY_PLUS(Code) | | |
UNKNOWN | final static int UNKNOWN(Code) | | |
VALUE | final static int VALUE(Code) | | |
m_token | int m_token(Code) | | Type of the last token to be parsed from the expression.
Corresponds to the characters just before expr.
|
precTable | static int precTable(Code) | | |
Expression | Expression()(Code) | | Constructor.
|
ExprParseObject | static void ExprParseObject(Interp interp, TclObject obj, ExprValue value) throws TclException(Code) | | Given a TclObject, such as the result of a command or
variable evaluation, fill in a ExprValue with the
parsed result. If the TclObject already has an
internal rep that is a numeric type, then no need to
parse from the string rep. If the string rep is parsed
into a numeric type, then update the internal rep
of the object to the parsed value.
|
ExprParseString | static void ExprParseString(Interp interp, TclObject obj, ExprValue value)(Code) | | TclParseNumber -> ExprParseString
Given a TclObject that contains a String to be parsed (from
a command or variable subst), fill in an ExprValue based on
the string's numeric value. The value may be a floating-point,
an integer, or a string. If the string value is converted to
a numeric value, then update the internal rep of the TclObject.
Parameters: interp - the context in which to evaluate the expression. Parameters: obj - the TclObject containing the string to parse. Parameters: value - the ExprValue object to save the parsed value in. |
evalBoolean | boolean evalBoolean(Interp interp, String string) throws TclException(Code) | | Evaluate an Tcl expression.
Parameters: interp - the context in which to evaluate the expression. Parameters: string - expression to evaluate. exception: TclException - for malformed expressions. the value of the expression in boolean. |
evalMathFunction | void evalMathFunction(Interp interp, String funcName, ExprValue[] values, boolean releaseValues, ExprValue result) throws TclException(Code) | | This procedure will lookup and invoke a math function
given the name of the function and an array of ExprValue
arguments. Each ExprValue is released before the function
exits. This method is intended to be used by other modules
that may need to invoke a math function at runtime. It is
assumed that the caller has checked the number of arguments,
the type of the arguments will be adjusted before invocation
if needed.
The values argument can be null when there are no args to pass.
The releaseValues argument should be true when the ExprValue
objecys in the array should be released.
|
evalMathFunction | void evalMathFunction(Interp interp, String funcName, MathFunction mathFunc, ExprValue[] values, boolean releaseValues, ExprValue result) throws TclException(Code) | | This procedure implements a math function invocation.
See the comments for the function above, note that
this method is used when the math function pointer
has already been resolved.
The values argument can be null when there are no args to pass.
The releaseValues argument should be true when the ExprValue
objecys in the array should be released.
|
evalSetResult | void evalSetResult(Interp interp, String string) throws TclException(Code) | | Evaluate a Tcl expression and set the interp result to the value.
Parameters: interp - the context in which to evaluate the expression. Parameters: string - expression to evaluate. the value of the expression. exception: TclException - for malformed expressions. |
looksLikeInt | static boolean looksLikeInt(String s, int len, int i, boolean whole)(Code) | | This procedure decides whether the leading characters of a
string look like an integer or something else (such as a
floating-point number or string). If the whole flag is
true then the entire string must look like an integer.
a boolean value indicating if the string looks like an integer. |
mathFunction | ExprValue mathFunction(Interp interp) throws TclException(Code) | | Parses a math function from an expression string, carry out the
function, and return the value computed.
Parameters: interp - current interpreter. the value computed by the math function. exception: TclException - if any error happens. |
registerMathFunction | void registerMathFunction(String name, MathFunction mathFunc)(Code) | | This procedure will register a math function by
adding it to the table of available math functions.
This methods is used when regression testing the
expr command.
|
|
|