a few lines of useless code

This commit is contained in:
hyung-hwan 2021-12-11 15:57:06 +00:00
parent a5d83f52bb
commit 3f9d6d9e59
3 changed files with 23 additions and 8 deletions

View File

@ -632,6 +632,12 @@ ada.text_io.put_line (">>>>>>>>>>> UNBALANCED INCLUSION CONTEXT..." & C.Prs.Top'
procedure Initialize (C: in out Compiler) is procedure Initialize (C: in out Compiler) is
begin begin
Push_Parse_State (C, PS_START); Push_Parse_State (C, PS_START);
declare
X: H3.Trees.Tree;
begin
H3.Trees.New_Node (X);
end;
end Initialize; end Initialize;
procedure Finalize (C: in out Compiler) is procedure Finalize (C: in out Compiler) is

View File

@ -1,13 +1,20 @@
with Ada.Unchecked_Deallocation; with Ada.Unchecked_Deallocation;
with ada.text_io;
package body H3.Trees is package body H3.Trees is
procedure New_Node (Tr: in out Tree; Code: Node_Code) is procedure New_Node (Tr: in out Tree) is
N: Node_Pointer; N: Node_Pointer;
begin begin
N := new Node(Code); --N := new Node'(Code => NODE_VOID, Next => null );
N := new Node;
N.all := (Code => NODE_VOID, Next => Null);
N.Next := Tr.Top; N.Next := Tr.Top;
Tr.Top := N; Tr.Top := N;
ada.text_io.put_line ("new node...");
end New_Node; end New_Node;
procedure Free_Node (Tr: in out Tree; N: in out Node) is procedure Free_Node (Tr: in out Tree; N: in out Node) is
@ -20,12 +27,12 @@ package body H3.Trees is
-- ------------------------------------------------------------------ -- ------------------------------------------------------------------
overriding procedure Initialize (C: in out Tree) is overriding procedure Initialize (Tr: in out Tree) is
begin begin
null; null;
end Initialize; end Initialize;
overriding procedure Finalize (C: in out Tree) is overriding procedure Finalize (Tr: in out Tree) is
begin begin
null; null;
end Finalize; end Finalize;

View File

@ -38,8 +38,6 @@ package H3.Trees is
end case; end case;
end record; end record;
-- parse tree -- parse tree
type Tree is new Ada.Finalization.Limited_Controlled with record type Tree is new Ada.Finalization.Limited_Controlled with record
--Next_Node: System_Index := System_Index'First; --Next_Node: System_Index := System_Index'First;
@ -47,6 +45,10 @@ package H3.Trees is
Top: Node_Pointer := null; Top: Node_Pointer := null;
end record; end record;
overriding procedure Initialize (C: in out Tree); -- ------------------------------------------------------------------
overriding procedure Finalize (C: in out Tree); procedure New_Node (Tr: in out Tree);
overriding procedure Initialize (Tr: in out Tree);
overriding procedure Finalize (Tr: in out Tree);
end H3.Trees; end H3.Trees;