unit dpglib.RuleSymbol; interface uses System.Classes, dpgrtl.types, dpglib.types, dpglib.GrammarSymbol; type TRuleSymbol = class( TGrammarSymbol, IRuleSymbol, IGrammarSymbol) protected fBlock : IRuleBlock; fDefined : boolean; fReferences : TInterfaceList; fAccess : AnsiString; fComment : AnsiString; // ---------------------------------------------------------------------- // IRuleSymbol // ---------------------------------------------------------------------- protected function GetBlock : IRuleBlock; function GetDefined : boolean; function GetReferences : TInterfaceList; function GetAccess : AnsiString; function GetComment : AnsiString; function GetReference(i: integer): IRuleRefElem; procedure SetBlock( pBlock : IRuleBlock); procedure SetDefined( pDefined : boolean); procedure SetAccess( pAccess : AnsiString); procedure SetComment( pComment : AnsiString); procedure AddReference( pRef: IRuleRefElem); function ReferenceCount: integer; // ---------------------------------------------------------------------- // Construction/destruction // ---------------------------------------------------------------------- public procedure AfterConstruction; override; procedure BeforeDestruction; override; end; implementation uses System.SysUtils; // @@@: Construction/destruction ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Construction/destruction // // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ================================================================================================ // After Construction // ================================================================================================ procedure TRuleSymbol.AfterConstruction; begin inherited; fReferences := TInterfaceList.Create; end; // ================================================================================================ // Before Destruction // ================================================================================================ procedure TRuleSymbol.BeforeDestruction; begin FreeAndNil( fReferences); inherited end; // @@@: IGrammarSymbol implementation +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // IGrammarSymbol implementation // // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // ================================================================================================ // Get Block // ================================================================================================ function TRuleSymbol.GetBlock: IRuleBlock; begin result := fBlock; end; // ================================================================================================ // Get Defined // ================================================================================================ function TRuleSymbol.GetDefined: boolean; begin result := fDefined; end; // ================================================================================================ // Get References // ================================================================================================ function TRuleSymbol.GetReferences: TInterfaceList; begin result := fReferences; end; // ================================================================================================ // Get Reference // ================================================================================================ function TRuleSymbol.GetReference(i: integer): IRuleRefElem; begin if (i>=0) and (i