home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / zkuste / Delphi / navody / tt / objvm.exe / UNITS / NodeStack.pas < prev    next >
Pascal/Delphi Source File  |  1998-03-10  |  778b  |  36 lines

  1. {Stack of parse tree nodes}
  2. unit NodeStack;
  3.  
  4. interface
  5. uses
  6.      PrseTree,Classes;
  7. type TNodeStack=class
  8.      protected
  9.        fBody:TList;
  10.      public
  11.        constructor Create;
  12.        destructor  Destroy;override;
  13.        procedure Push(a:PNode);
  14.        function  Pop:PNode;
  15.      end;
  16. implementation
  17. constructor TNodeStack.Create;
  18.             begin
  19.               fBody:=TList.Create;
  20.             end;
  21. destructor  TNodeStack.Destroy;
  22.             begin
  23.               fBody.Free;
  24.             end;
  25. procedure   TNodeStack.Push;
  26.             begin
  27.               fBody.Add(a);
  28.             end;
  29. function    TNodeStack.Pop;
  30.             begin
  31.               Result:=fBody[fBody.Count-1];
  32.               fBody.Delete(fBody.Count-1);
  33.             end;
  34.  
  35. end.
  36.