|
|
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: 2956 (0xb8c)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
with Lex;
with Object;
with Error_Broadcaster;
with Statements;
with Arguments;
with Bloc_Class;
with String_Utilities;
with Bounded_String;
with Unparser;
package body Bloc is
type Node_Structure is
record
Rule : Natural range 0 .. 1 := 0;
Arg : Arguments.Node := Arguments.Empty_Node;
State : Statements.Node := Statements.Empty_Node;
end record;
procedure Open (N : in out Node) is
begin
Bloc_Class.Set (N);
end Open;
procedure Parse (N : in out Node; Error : out Boolean) is
Failed : Boolean := False;
begin
N := new Node_Structure;
if Lex.Token'Pos (Lex.Get_Token) = Lex.Token'Pos (Lex.Open_Bracket) then
Open (N);
N.Rule := 1;
Lex.Next_Token;
Arguments.Parse (N.Arg, Failed);
if not Failed then
Statements.Parse (N.State, Failed);
if not Failed then
if Lex.Token'Pos (Lex.Get_Token) =
Lex.Token'Pos (Lex.Close_Bracket) then
Bloc_Class.Close;
Lex.Next_Token;
else
raise Error_Broadcaster.Brackect_Is_Missing;
end if;
end if;
end if;
end if;
Error := Failed;
end Parse;
procedure Unparse (N : in out Node) is
begin
case N.Rule is
when 0 =>
null;
when 1 =>
Unparser.Put_Line ("");
Unparser.Set_Col (4);
Unparser.Put ("{");
Unparser.Put_Line ("");
Arguments.Unparse (N.Arg);
Unparser.Put ("");
Statements.Unparse (N.State);
Unparser.Unset_Col (4);
Unparser.Put ("}");
end case;
end Unparse;
function Is_First (T : Lex.Token) return Boolean is
begin
return (Lex.Token'Pos (T) = Lex.Token'Pos (Lex.Open_Bracket));
end Is_First;
procedure Interpret (N : Node;
The_Argument : in out Object.Parameters.List;
Result : in out Object.Reference) is
begin
case N.Rule is
when 0 =>
Result := Statements.Interpret (N.State, Result);
when 1 =>
Arguments.Set (N.Arg, The_Argument);
Result := Statements.Interpret (N.State, Result);
end case;
end Interpret;
function Interpret (N : Node; The_Argument : Object.Message)
return Object.Reference is
begin
if String_Utilities.Equal
("valeur", Bounded_String.Image (The_Argument), True) then
return (Statements.Interpret (N.State));
else
raise Error_Broadcaster.Unknown_Unary_Message;
end if;
end Interpret;
end Bloc;