|
|
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: 4323 (0x10e3)
Types: TextFile
Names: »B«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
separate (Find_Unit.Build_Ada_Compilation_Unit)
procedure Statement (Current_Unit : in out
Compilation_Unit.Ada_Compilation_Unit) is
--==============================================================
-- This procedure builds the next part of the grammar for an =
-- Ada compilation unit. Based on the next token, we will =
-- complete different productions. At present, we are parsing =
-- either an accept statement or a nested block statement. If =
-- we are parsing a nested block statement, then we will =
-- recurse on Get_Compilation_unit. If we are parsing an =
-- accept statement, then we will look for either a =
-- semicolon or a 'do'. When we find these we will invoke the =
-- subprogram Accept_Tail to find the end of the accept =
-- statement. If we find a syntax error, then we will raise =
-- the exception Build_Syntax_Error. =
-- The grammar : =
-- <Statement> = =
-- 'ACCEPT' <id> [<Left_Right_Paren>] =
-- [<Left_Right_Paren>] <Accept_Tail> | =
-- <Block_Statement> =
-- =
-- written by GER with help from b2 and JM =
-- May 1985 at EVB Software Engineering =
--==============================================================
Accept_Tail_Found : Boolean := False;
-- Set to true when the end of accept has been found
Current_Token : Token_Package.Token;
-- Holds the current token
Peek_Token : Token_Package.Token;
-- This will token will be looked later
Nested_Unit : Compilation_Unit.Ada_Compilation_Unit;
begin
-- Statement
-- Set the peek token back since we have already peeked before
Token_Package.Set_Peek_Back;
-- Parse either an accept statement or a nested block
-- statement
Peek_Next_Significant_Token (Significant_Token => Peek_Token);
if Token_Package.Value_Of (Peek_Token) = Token_Package.Accept_Token then
-- Parse the accept statement
Get_Next_Significant_Token (Significant_Token => Current_Token,
Current_Unit => Current_Unit);
Compilation_Unit.Add_Token_To_Compilation_Unit
(Token_To_Add => Current_Token, Unit_To_Add_To => Current_Unit);
-- Get the accept statement identifier
Get_Next_Significant_Token (Significant_Token => Current_Token,
Current_Unit => Current_Unit);
if Token_Package.Class_Of (Current_Token) =
Token_Package.Identifier then
Compilation_Unit.Add_Token_To_Compilation_Unit
(Token_To_Add => Current_Token, Unit_To_Add_To => Current_Unit);
else
raise Build_Syntax_Error;
end if;
Peek_Next_Significant_Token (Significant_Token => Peek_Token);
case Token_Package.Value_Of (Peek_Token) is
when Token_Package.Do_Token | Token_Package.Semicolon_Token =>
null; -- Let the accept tail do the rest
when Token_Package.Left_Parenthesis_Token =>
Left_Right_Paren (Current_Unit => Current_Unit);
Peek_Next_Significant_Token (Significant_Token => Peek_Token);
if Token_Package.Value_Of (Peek_Token) =
Token_Package.Left_Parenthesis_Token then
Left_Right_Paren (Current_Unit => Current_Unit);
end if;
when others =>
raise Build_Syntax_Error;
end case;
Accept_Tail (Current_Unit => Current_Unit);
else
-- Must be a nested block statement. Recurse
-- Add on any insignicant tokens before recursing
-- (Comments, blank lines, and new lines)
Add_On_Insignificant_Tokens (Current_Unit => Current_Unit);
Get_Compilation_Unit (Current_Unit => Nested_Unit);
Compilation_Unit.Add_Compilation_Units
(Added_Unit => Nested_Unit, Unit_To_Add_To => Current_Unit);
end if;
end Statement;