|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 3420 (0xd5c)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
with Scanner, List, Printer, Bug;
package body Arguments is
type Node_Structure is
record
Rule : Natural range 0 .. 1;
Line : Natural;
end record;
procedure Parse (N : in out Node;
Keyword_List : in out Message.List;
Id_List : in out Message.List;
Symbol : in out Table.Symbol_Kind) is
Failed : Boolean := False;
use Scanner;
begin
N := new Node_Structure;
N.Line := Scanner.Get_Line_Number;
if Is_First (Scanner.Get_Token) then
N.Rule := 1;
Scanner.Next;
List.Parse (Keyword_List, Id_List, Symbol);
if not Failed and Scanner.Get_Token /= Scanner.T_Dot then
raise Bug.Missing_Point;
else
Scanner.Next;
end if;
end if;
end Parse;
procedure Unparse (N : in Node;
Keyword_List : in Message.List;
Id_List : in Message.List) is
Reverse_Keyword_List, Reverse_Id_List, Keywords, Id : Message.List;
A_Keyword, A_Id : Message.Tiny_String;
Nb_Keywords, Nb_Id : Integer;
begin
Scanner.Set_Line_Number (N.Line);
Printer.Write_Ln ("");
if N.Rule = 1 then
Printer.Write ("avec");
Keywords := Keyword_List;
Id := Id_List;
Nb_Keywords := Message.How_Many (Keywords);
Nb_Id := Message.How_Many (Id);
if Nb_Keywords > Nb_Id then
raise Bug.Too_Many_Keywords;
end if;
if Nb_Keywords > 0 and Nb_Id /= Nb_Keywords then
raise Bug.Not_Enough_Keywords;
end if;
Message.Init (Reverse_Keyword_List);
Message.Init (Reverse_Id_List);
for I in 1 .. Nb_Id loop
if Nb_Keywords > 0 then
A_Keyword := Message.Get (Keywords);
Reverse_Keyword_List :=
Message.Put (Reverse_Keyword_List, A_Keyword);
end if;
A_Id := Message.Get (Id);
Reverse_Id_List := Message.Put (Reverse_Id_List, A_Id);
if Nb_Keywords > 0 then
Message.Next (Keywords, A_Keyword);
end if;
Message.Next (Id, A_Id);
end loop;
Message.Init (Reverse_Keyword_List);
Message.Init (Reverse_Id_List);
for I in 1 .. Nb_Id loop
if Nb_Keywords > 0 then
A_Keyword := Message.Get (Reverse_Keyword_List);
Printer.Write_St (A_Keyword);
Printer.Write (":");
end if;
A_Id := Message.Get (Reverse_Id_List);
Printer.Write (A_Id);
if Nb_Keywords > 0 then
Message.Next (Reverse_Keyword_List, A_Keyword);
end if;
Message.Next (Reverse_Id_List, A_Id);
end loop;
Printer.Write_Ln (".");
end if;
end Unparse;
function Is_First (T : Scanner.Token) return Boolean is
begin
case T is
when Scanner.T_Avec =>
return (True);
when others =>
return (False);
end case;
end Is_First;
end Arguments;