public class UnreachableCodeWorker.Helper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(package private) java.util.HashMap |
varPool
Information about known variables
|
| Constructor and Description |
|---|
Helper() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addKnownVarValue(java.lang.String variable,
java.lang.String value)
Add a variable to the pool of known variables.
|
private java.util.List |
getKnownValues(java.lang.String var)
Get list of known values of the variable for the expression
evaluator.
|
long |
tryEval(Aast node)
Try to evaluate the expression defined by the passed AST node.
|
boolean |
tryEvalCase(java.lang.String var,
java.lang.String value)
Try to evaluate CASE-WHEN-THEN statement expression which compares
a
VAR_CHAR to a STRING. |
private long |
tryEvalNode(AnnotatedAst node)
Expression evaluation worker.
|
public boolean addKnownVarValue(java.lang.String variable,
java.lang.String value)
At this time, all variables must be of type VAR_CHAR and the values must be the Java version of the Progress STRING.
variable - Variable name. Must not be null.value - New variable value. Must not be null.true if operation was successful.public long tryEval(Aast node)
At present only the following expressions are recognized:
node - Expression root node.RES_UNKNOWN if the expression cannot be
evaluated, RES_TRUE if the result is
true and RES_FALSE if the result
is false.public boolean tryEvalCase(java.lang.String var,
java.lang.String value)
VAR_CHAR to a STRING.var - CASE statement variable name of type VAR_CHAR.value - THEN statement value of type STRING.true if variable contains specified value.private java.util.List getKnownValues(java.lang.String var)
var - Variable name (will be automatically translated to lower
case).null if no
such variable defined.private long tryEvalNode(AnnotatedAst node)
node - Expression root node.RES_UNKNOWN if the expression cannot be
evaluated, RES_TRUE if the result is
true and RES_FALSE if the result
is false.