unit dpgrtl.astPair; interface uses dpgrtl.astBase; type TASTPair = class public Root : TAST; Child : TAST; public procedure AdvanceChildToEnd; function Clone: TASTPair; function ToString: string; override; end; implementation { TASTPair } // ================================================================================================ // Advance Child To End // ================================================================================================ procedure TASTPair.AdvanceChildToEnd; begin if Assigned(Child) then while Assigned( Child.NextSibling) do Child := Child.NextSibling end; // ================================================================================================ // Clone // ================================================================================================ function TASTPair.Clone: TASTPair; begin result := TASTPair.Create; result.Root := Root; result.Child := Child; end; // ================================================================================================ // As String // ================================================================================================ function TASTPair.ToString: string; var r: string; c: string; begin if Assigned(Root) then r := Root.ToString else r := 'nil'; if Assigned(Child) then c := Child.ToString else c := 'nil'; result := '[' + r + ',' + c + ']' end; end.