Description | Hierarchy | Fields | Methods | Properties |
type TExpression = class(TCustomValue)
TExpression
is the compiled version of an Expression generated by the TRbwParser.Compile method.
It can be evaluated by using the Evaluate method and the result can then be read using the BooleanResult method, DoubleResult method, IntegerResult method, or StringResult method. The correct one to read can be determined from the ResultType property.
Every instance of TExpression
is owned by the instance of TRbwParser that compiled it.
![]() |
FSpecialImplementorList: TSpecialImplementorList; |
![]() |
FOptionalArguments: integer; |
![]() |
FunctionAddr: Pointer; |
![]() |
VariablesForFunction: array of Pointer; |
![]() |
FAllowConversionToConstant: boolean; |
![]() |
FTag: integer; |
![]() |
StringVariableIndicies: array of integer; |
![]() |
StringVariableCount: integer; |
![]() |
FVariablesUsed: TStringList; |
![]() |
FTopLevel: boolean; |
![]() |
FPrototype: string; |
![]() |
FNotifier: TNotifierComponent; |
![]() |
ShouldEvaluate: boolean; |
![]() |
Data: array of TVariables; |
![]() |
constructor Create(const VariableName: string; const DataType: TRbwDataType; const CanConvertToConstant: boolean; SpecialImplementorList: TSpecialImplementorList); overload; |
![]() |
constructor Create(const FunctionRecord: TFunctionRecord; SpecialImplementorList: TSpecialImplementorList); overload; |
![]() |
constructor Create(const VariableName: string; const DataType: TRbwDataType; SpecialImplementorList: TSpecialImplementorList); overload; |
![]() |
procedure Initalize(const FunctionAddress: Pointer; const DataTypes: array of TRbwDataType; const OptionalArguments: integer); |
![]() |
function GetVariables(const Index: integer): TConstant; |
![]() |
procedure SetVariables(const Index: integer; const Value: TConstant); |
![]() |
function ConvertToConstant: TConstant; |
![]() |
procedure ResetDataLength(const Count: integer); |
![]() |
procedure SetAllowConversionToConstant(const Value: boolean); inline; |
![]() |
function DecompileByType(DecompileType: TDecompileType): string; |
![]() |
procedure FillVariables; |
![]() |
procedure SetResultFromFunction; |
![]() |
function GetVariablesUsed: TStringList; virtual; |
![]() |
procedure MakeDiagram(List: TStringList; Level: integer); override; |
![]() |
constructor Create(const FunctionClass: TFunctionClass; SpecialImplementorList: TSpecialImplementorList); overload; virtual; |
![]() |
function Decompile: string; override; |
![]() |
function DecompileDisplay: string; override; |
![]() |
destructor Destroy; override; |
![]() |
procedure Evaluate; virtual; |
![]() |
class function New(const FunctionClass: TFunctionClass; SpecialImplementorList: TSpecialImplementorList): TExpression; virtual; |
![]() |
function UsesVariable(const Variable: TCustomVariable): boolean; virtual; |
![]() |
procedure Diagram(List: TStringList); |
![]() |
function UsesFunction(FunctionName: string): boolean; |
![]() |
property AllowConversionToConstant: boolean read FAllowConversionToConstant
write SetAllowConversionToConstant; |
![]() |
property Variables[constIndex:integer]: TConstant read GetVariables
write SetVariables; |
![]() |
property Tag: integer read FTag write FTag; |
![]() |
property VariablesUsed: TStringList read GetVariablesUsed; |
![]() |
property Notifier: TNotifierComponent read FNotifier; |
![]() |
FSpecialImplementorList: TSpecialImplementorList; |
![]() |
FOptionalArguments: integer; |
|
![]() |
FunctionAddr: Pointer; |
|
![]() |
VariablesForFunction: array of Pointer; |
|
![]() |
FAllowConversionToConstant: boolean; |
![]() |
FTag: integer; |
See Tag |
![]() |
StringVariableIndicies: array of integer; |
StringVariableIndicies indicates which members of VariablesForFunction refer to strings. |
![]() |
StringVariableCount: integer; |
StringVariableCount is the number of strings in VariablesForFunction. |
![]() |
FVariablesUsed: TStringList; |
FVariablesUsed is used to hold the result of VariablesUsed. |
![]() |
FTopLevel: boolean; |
FTopLevel is used in Decompile to determine whether or not to include parenthesis around the outermost item. |
![]() |
FPrototype: string; |
See also
|
![]() |
FNotifier: TNotifierComponent; |
|
![]() |
ShouldEvaluate: boolean; |
|
![]() |
Data: array of TVariables; |
|
![]() |
constructor Create(const VariableName: string; const DataType: TRbwDataType; const CanConvertToConstant: boolean; SpecialImplementorList: TSpecialImplementorList); overload; |
Create a TExpression. |
![]() |
constructor Create(const FunctionRecord: TFunctionRecord; SpecialImplementorList: TSpecialImplementorList); overload; |
Create a TExpression. |
![]() |
constructor Create(const VariableName: string; const DataType: TRbwDataType; SpecialImplementorList: TSpecialImplementorList); overload; |
Create a TExpression. |
![]() |
procedure Initalize(const FunctionAddress: Pointer; const DataTypes: array of TRbwDataType; const OptionalArguments: integer); |
Initializes certain variables. Called by Create. |
![]() |
function GetVariables(const Index: integer): TConstant; |
See Variables. |
![]() |
procedure SetVariables(const Index: integer; const Value: TConstant); |
See Variables. |
![]() |
function ConvertToConstant: TConstant; |
if the expression can be represented as a constant value, ConvertToConstant returns a TConstant that represents that value. Otherwise, it returns nil. |
![]() |
procedure ResetDataLength(const Count: integer); |
If optional arguments are used, ResetDataLength is used to resets the length of arrays to the correct length. |
![]() |
procedure SetAllowConversionToConstant(const Value: boolean); inline; |
![]() |
function DecompileByType(DecompileType: TDecompileType): string; |
![]() |
procedure FillVariables; |
|
![]() |
procedure SetResultFromFunction; |
![]() |
function GetVariablesUsed: TStringList; virtual; |
See VariablesUsed. |
![]() |
procedure MakeDiagram(List: TStringList; Level: integer); override; |
|
![]() |
constructor Create(const FunctionClass: TFunctionClass; SpecialImplementorList: TSpecialImplementorList); overload; virtual; |
|
![]() |
function Decompile: string; override; |
|
![]() |
function DecompileDisplay: string; override; |
![]() |
destructor Destroy; override; |
|
![]() |
procedure Evaluate; virtual; |
Example: procedure TForm1.Button1Click(Sender: TObject); begin RbwParser1.Compile(Edit1.Text); RbwParser1.CurrentExpression.Evaluate; case RbwParser1.CurrentExpression.ResultType of rdtDouble: begin Label1.Caption := 'result: ' + FloatToStr(RbwParser1.CurrentExpression.DoubleResult); end; rdtInteger: begin Label1.Caption := 'result: ' + IntToStr(RbwParser1.CurrentExpression.IntegerResult); end; rdtBoolean: begin if RbwParser1.CurrentExpression.BooleanResult then begin Label1.Caption := 'result: ' + 'True'; end else begin Label1.Caption := 'result: ' + 'False'; end; end; rdtString: begin Label1.Caption := 'result: ' + RbwParser1.CurrentExpression.StringResult; end; else Assert(False); end; end; |
![]() |
class function New(const FunctionClass: TFunctionClass; SpecialImplementorList: TSpecialImplementorList): TExpression; virtual; |
|
![]() |
function UsesVariable(const Variable: TCustomVariable): boolean; virtual; |
|
![]() |
procedure Diagram(List: TStringList); |
|
![]() |
function UsesFunction(FunctionName: string): boolean; |
![]() |
property AllowConversionToConstant: boolean read FAllowConversionToConstant
write SetAllowConversionToConstant; |
Normally Pi is an example of a function for which
|
![]() |
property Variables[constIndex:integer]: TConstant read GetVariables
write SetVariables; |
|
![]() |
property Tag: integer read FTag write FTag; |
|
![]() |
property VariablesUsed: TStringList read GetVariablesUsed; |
|
![]() |
property Notifier: TNotifierComponent read FNotifier; |
|