|
|
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: 3671 (0xe57)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
with Error_Broadcaster;
with Text_Io;
with Lex;
with Bounded_String;
with Object;
with Expression;
with More_Statements;
with Unparser;
package body Statements is
type Node_Structure is
record
Rule : Natural range 0 .. 2 := 0;
Expr : Expression.Node := Expression.Empty_Node;
More : More_Statements.Node := More_Statements.Empty_Node;
end record;
procedure Parse (N : in out Node; Error : out Boolean) is
Failed : Boolean := False;
begin
N := new Node_Structure;
if Expression.Is_First (Lex.Get_Token) then
N.Rule := 1;
Expression.Parse (N.Expr, Failed);
if not Failed then
More_Statements.Parse (N.More, Failed);
end if;
else
case Lex.Get_Token is
when Lex.Renvoyer =>
N.Rule := 2;
Lex.Next_Token;
Expression.Parse (N.Expr, Failed);
when Lex.L_End | Lex.Close_Bracket =>
null;
when others =>
raise Error_Broadcaster.Expression_Is_Missing;
end case;
end if;
Error := Failed;
exception
when Error_Broadcaster.Expression_Is_Missing =>
Error_Broadcaster.Expression_Missing (Lex.Get_Line);
Error_Broadcaster.Unexpectedtoken (Lex.Get_Line);
while Lex.Token'Pos (Lex.Get_Token) /= Lex.Token'Pos (Lex.Dot) loop
Text_Io.Put (Bounded_String.Image (Lex.Get_Value));
Lex.Next_Token;
end loop;
Text_Io.Put_Line ("");
More_Statements.Parse (N.More, Failed);
Failed := True;
Error := Failed;
when Error_Broadcaster.Brackect_Is_Missing =>
Error_Broadcaster.Brackect_Missing (Lex.Get_Line);
Failed := True;
Error := Failed;
when Error_Broadcaster.Parenthesis_Is_Missing =>
Error_Broadcaster.Parenthesis_Missing (Lex.Get_Line);
Failed := True;
Error := Failed;
when Error_Broadcaster.Unexpected_Token =>
Error_Broadcaster.Unexpectedtoken (Lex.Get_Line);
Failed := True;
Error := Failed;
when Error_Broadcaster.Identifier_Is_Missing =>
Error_Broadcaster.Identifier_Missing (Lex.Get_Line);
Failed := True;
Error := Failed;
when Error_Broadcaster.Dot_Is_Missing =>
Error_Broadcaster.Dot_Missing (Lex.Get_Line);
Failed := True;
Error := Failed;
end Parse;
procedure Unparse (N : in out Node) is
begin
case N.Rule is
when 0 =>
null;
when 1 =>
Expression.Unparse (N.Expr);
Unparser.Put ("");
More_Statements.Unparse (N.More);
when 2 =>
Unparser.Put ("renvoyer");
Expression.Unparse (N.Expr);
end case;
end Unparse;
function Interpret (N : Node;
Inherited : Object.Reference := Object.Void_Reference)
return Object.Reference is
Result : Object.Reference;
begin
case N.Rule is
when 0 =>
Result := Inherited;
when 1 =>
Result := Expression.Interpret (N.Expr);
Result := More_Statements.Interpret (N.More, Result);
when 2 =>
Result := Expression.Interpret (N.Expr);
end case;
return Result;
end Interpret;
end Statements;