Declaration¶
Source position: fpexprpars.pp line 726
type
TFPExpressionParser = class(TComponent)
public
constructor Create;
destructor Destroy;
function IdentifierByName : TFPExprIdentifierDef;
procedure Clear;
procedure EvaluateExpression;
procedure ExtractIdentifierNames(const aExpression: AnsiString;
aList: TStringList); overload;
procedure ExtractIdentifierNames(const aExpression: AnsiString;
aCallback: TIdentifierEvent); overload;
function ExtractNode : Boolean;
function Evaluate : TFPExpressionResult;
function ResultType : TResultType;
function HasAggregate : Boolean;
procedure InitAggregate;
procedure UpdateAggregate;
property AsFloat: TExprFloat; {r}
property AsCurrency: Currency; {r}
property AsInteger: Int64; {r}
property AsString: AnsiString; {r}
property AsBoolean: Boolean; {r}
property AsDateTime: TDateTime; {r}
published
property Expression: Ansistring; {rw}
property Identifiers: TFPExprIdentifierDefs; {rw}
property BuiltIns: TBuiltInCategories; {rw}
end;
Inheritance¶
Description¶
This is the main expression parser class that provides comprehensive functionality for parsing and evaluating mathematical expressions.
The parser handles the complete expression evaluation pipeline from tokenization through parsing to evaluation, supporting complex expressions with proper operator precedence, parentheses, function calls, and variable references.
Key features include built-in mathematical functions, string operations, date/time handling, boolean logic, comparison operations, and extensibility through custom functions and variables.
Properties¶
| Member | Visibility | Description |
|---|---|---|
| AsBoolean read only | public | Expression result as boolean value |
| AsCurrency read only | public | Expression result as currency value |
| AsDateTime read only | public | Expression result as date/time value |
| AsFloat read only | public | Expression result as floating point value |
| AsInteger read only | public | Expression result as integer value |
| AsString read only | public | Expression result as string value |
| BuiltIns | published | Manager for built-in functions and constants |
| Expression | published | Expression string to be evaluated |
| Identifiers | published | Collection of identifiers and their values |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| Clear | public | Clear the current expression |
| Create | public | Create expression parser instance |
| Destroy | public | Destroy expression parser and free resources |
| Evaluate | public | Evaluate the current expression |
| EvaluateExpression | public | Evaluate the expression and return result |
| ExtractIdentifierNames | public | |
| ExtractNode | public | Extract expression node from result |
| HasAggregate | public | Check if expression contains aggregates |
| IdentifierByName | public | Get identifier definition by name |
| InitAggregate | public | Initialize aggregate calculation |
| ResultType | public | Get the result type of the expression |
| UpdateAggregate | public | Update aggregate calculation with value |
See also¶
| Name | Description |
|---|---|
| TExprBuiltInManager | Class for managing built-in functions and variables in expressions |