public final class CalcSymbol extends Object
CalcParser
(FormCalc scripting engine).
Each CalcSymbol have but two properties: a type, and depending on the type, a value. and a storage type. Some types of CalcSymbols have extra values.
This is the implementation of the fundamental class of objects manipulated by FormCalc parser and interpreter. Objects of this class populate both the data symbol table, and the builtin symbol table, the runtime stack, and constitute the operands of some instructions, as well as the final result of every FormCalc parser/interpreter operation.
@author Paul Imerson, Mike P. Tardif
Modifier and Type | Field and Description |
---|---|
static int |
TypeAccessor |
static int |
TypeBuiltin |
static int |
TypeDouble |
static int |
TypeError
|
static int |
TypeFunction |
static int |
TypeNull |
static int |
TypeParameter |
static int |
TypeReference |
static int |
TypeReturn |
static int |
TypeString |
static int |
TypeVariable |
Constructor and Description |
---|
CalcSymbol()
Instantiates a CalcSymbol of type
TypeNull.
|
CalcSymbol(CalcSymbol oSym)
Instantiates a CalcSymbol as a copy of the given CalcSymbol.
|
CalcSymbol(double dVal)
Instantiates a CalcSymbol of type
TypeDouble
if the value of the given double is finite, and of type
TypeError
if the value of the given double is not finite.
|
CalcSymbol(int nVal)
Instantiates a CalcSymbol of type
TypeDouble.
|
CalcSymbol(Method func)
Instantiates a CalcSymbol of type
TypeBuiltin.
|
CalcSymbol(Obj oObj,
String sName)
Instantiates a CalcSymbol of type
TypeReference.
|
CalcSymbol(String sVal)
Instantiates a CalcSymbol of type
TypeString.
|
CalcSymbol(String sVal,
boolean bIsError,
int nErrorLine,
int nErrorResId)
Instantiates a CalcSymbol of type
TypeString
if the given boolean isError is false, and a CalcSymbol
of type * TypeError
is the given boolean is true.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object)
Compares the given CalcSymbol for equality.
|
String |
getErrorValue(IntegerHolder oErrorLine,
IntegerHolder oErrorCode)
Gets this TypeError's error value.
|
int |
getIdxValue()
Gets this TypeParameter's stack index.
|
String |
getName()
Gets this object's name.
|
double |
getNumericValue()
Gets this TypeDouble's numeric value.
|
Obj |
getObjValue()
Gets this TypeReference's object handle.
|
String |
getStringValue()
Gets this TypeString's string value.
|
int |
getType()
Gets this object's type.
|
int |
hashCode()
Returns a hash code value for the object.
|
public static final int TypeError
typedef enum TypeEnum {
TypeError = 0,
TypeNull,
TypeString,
TypeDouble,
TypeBuiltin,
TypeVariable,
TypeReference,
TypeParameter,
TypeFunction,
TypeAccessor,
TypeReturn
} int;
Enumeration of all possible CalcSymbol types.
Most are internal to the FormCalc scripting engine.
Applications would only deal with types:
public static final int TypeNull
public static final int TypeString
public static final int TypeDouble
public static final int TypeBuiltin
public static final int TypeVariable
public static final int TypeReference
public static final int TypeParameter
public static final int TypeFunction
public static final int TypeAccessor
public static final int TypeReturn
public CalcSymbol()
public CalcSymbol(int nVal)
nVal
- the numeric value of the CalcSymbol.public CalcSymbol(double dVal)
dVal
- the double value of the CalcSymbol.public CalcSymbol(String sVal, boolean bIsError, int nErrorLine, int nErrorResId)
sVal
- the string value of the CalcSymbol if
the given boolean isError is false, and the error value of
the CalcSymbol if the given boolean is true.bIsError
- a boolean indicating if the instantiated
CalcSymbol is to be of type TypeError, or
of type TypeString. The defaults is for the CalcSymbol
to be of type TypeString.nErrorLine
- if bIsError is true, this contains the associated
line number in the context of syntax errors (not run-time errors).
if the value of the given boolean is false, and an error-valued
CalcSymbol if the value of the given boolean is true.nErrorResId
- - if bIsError is TRUE, this contains the associated resource ID
of the error.public CalcSymbol(String sVal)
sVal
- the string value of the CalcSymbol.public CalcSymbol(Method func)
func
- the builtin function.public CalcSymbol(Obj oObj, String sName)
oObj
- the object handle.sName
- optionally, the object name.public CalcSymbol(CalcSymbol oSym)
oSym
- the CalcSymbol to copy.public boolean equals(Object object)
public int hashCode()
public String getName()
public int getType()
public Obj getObjValue()
public int getIdxValue()
public String getStringValue()
public double getNumericValue()
public String getErrorValue(IntegerHolder oErrorLine, IntegerHolder oErrorCode)
oErrorLine
- if non-null, populated with the line
number of the error, in the context of syntax errors
(not run-time errors).oErrorCode
- - if non-NULL, populated with the error
code of the error, in the context of syntax errors
(not run-time errors).Copyright © 2010 - 2020 Adobe. All Rights Reserved