Class TParser (unit Parser9)

Inherits from

TComponent

far;

Constructors


constructor Create(AParent: TComponent);

functions with TWO arguments, e.


Functions

procedure AddFunctionOneParam(const AFunctionName: string; Func: TFuncPrototype);


procedure AddFunctionTwoParam(const AFunctionName: string; Func: TFuncPrototype);


destructor Destroy;


procedure FreeExpression;


function GetVariable(const VarName: string): Float;

check whether the variable contains any of the operators (DIV and MOD) this would confuse the parser.

function ParseExpression(const AnExpression: string): boolean;

TParser

class function RemoveBlanks(const s: string): string;

returns the string with the blanks inside removed

function SetVariable(VarName: string; Value: Float): PFloat;

The PFloat returned points to the place in memory where the variable actually sits; to speed up assignment you can use PFloat is declared P9UILD.

function CalcValue: Float;

this implies FExpression := AnExpression

procedure SetExpression(const AnExpression: string);


procedure SetVar(const VarName: string; Value: Float);

deletes all blanks in s

Properties

property A : Float

predefined variables - could be left out

property B : Float


property C : Float


property D : Float


property E : Float


property Expression : string

setting Expression automatically parses it - warning: exceptions may be raised

property T : Float


property Value : Float


property X : Float


property Y : Float


property LinkedOperationList : POperation


property ParserError : boolean


property Variable : Float


Events

event OnParserError : TParserExceptionEvent


Variables

FunctionOne : TStringList;

lists of available functions, see .

FunctionTwo : TStringList;

functions with ONE argument, e.

FA : Float;


FB : Float;


FC : Float;


FD : Float;


FE : Float;


FExpression : string;


FNumberOperators : integer;


FOnParserError : TParserExceptionEvent;


FParserError : boolean;


FStartOperationList : POperation;


FT : Float;


FVariables : TStringList;


FX : Float;


FY : Float;



Constructors


constructor Create(AParent: TComponent);

functions with TWO arguments, e.g. max(,)

while OperationLoop<>nil


Functions


procedure AddFunctionOneParam(const AFunctionName: string; Func: TFuncPrototype);


procedure AddFunctionTwoParam(const AFunctionName: string; Func: TFuncPrototype);


destructor Destroy;


procedure FreeExpression;


function GetVariable(const VarName: string): Float;

check whether the variable contains any of the operators (DIV and MOD) this would confuse the parser...


function ParseExpression(const AnExpression: string): boolean;

TParser


class function RemoveBlanks(const s: string): string;

returns the string with the blanks inside removed


function SetVariable(VarName: string; Value: Float): PFloat;

The PFloat returned points to the place in memory where the variable actually sits; to speed up assignment you can use PFloat is declared P9UILD.PAS


function CalcValue: Float;

this implies FExpression := AnExpression


procedure SetExpression(const AnExpression: string);


procedure SetVar(const VarName: string; Value: Float);

deletes all blanks in s


Properties


property A : Float

predefined variables - could be left out


property B : Float


property C : Float


property D : Float


property E : Float


property Expression : string

setting Expression automatically parses it - warning: exceptions may be raised


property T : Float


property Value : Float


property X : Float


property Y : Float


property LinkedOperationList : POperation


property ParserError : boolean


property Variable : Float


Events


event OnParserError : TParserExceptionEvent


Variables


FunctionOne : TStringList;

lists of available functions, see .Create for example use


FunctionTwo : TStringList;

functions with ONE argument, e.g. exp()


FA : Float;


FB : Float;


FC : Float;


FD : Float;


FE : Float;


FExpression : string;


FNumberOperators : integer;


FOnParserError : TParserExceptionEvent;


FParserError : boolean;


FStartOperationList : POperation;


FT : Float;


FVariables : TStringList;


FX : Float;


FY : Float;