|
|
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: 5337 (0x14d9)
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 Subprogram_Or_Renames (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 a nested subprogram or a subprogram renames. =
-- If we are parsing a nested subprogram, then we will recurse =
-- on Get_Compilailation_Unit. If a subprogram renames =
-- is found, then we will get significant tokens until the =
-- semicolon is found. If there is a parameter list, then this =
-- must be skipped over. Any errors detected will cause the =
-- exception Build_Syntax_Error to be raised. =
-- Grammar : =
-- <Subprogram_Or_Renames> = =
-- 'PROCEDURE' * [<Left_Right_Paren>] 'RENAMES' * ';' | =
-- 'FUNCTION' * [<Left_Right_Paren>] 'RENAMES' * ';' | =
-- <Subprogram> =
-- =
-- Written by GER with help from b2 and JM =
-- May 1985 EVB Software Engineering Inc. =
--==============================================================
Current_Token : Token_Package.Token;
-- The current token read from the source file
Nested_Unit : Compilation_Unit.Ada_Compilation_Unit;
-- A compilation unit that is nested
Peek_Token : Token_Package.Token;
-- A future token to be used later
begin
-- Subprogram_Or_Renames
-- Set the peek token back to the beginning
Token_Package.Set_Peek_Back;
-- Repeatly peek ahead at significant tokens until
-- either a semi-colon, "IS", or "RENAMES". If a Left
-- paren is found, then search for a right paren
Search_For_Renames_Or_Subprogram:
loop
Peek_Next_Significant_Token (Significant_Token => Peek_Token);
if Token_Package.Value_Of (Peek_Token) =
Token_Package.Left_Parenthesis_Token then
Peek_Left_Right_Paren;
end if;
exit Search_For_Renames_Or_Subprogram when
Token_Package.Value_Of (Peek_Token) =
Token_Package.Semicolon_Token or
Token_Package.Value_Of (Peek_Token) = Token_Package.Is_Token or
Token_Package.Value_Of (Peek_Token) =
Token_Package.Renames_Token or
Token_Package.Class_Of (Peek_Token) = Token_Package.End_Of_File;
end loop Search_For_Renames_Or_Subprogram;
case Token_Package.Value_Of (Peek_Token) is
when Token_Package.Semicolon_Token | Token_Package.Is_Token =>
-- Get all the comments, blank lines, and new lines
Add_On_Insignificant_Tokens (Current_Unit => Current_Unit);
-- A nested subprogram has been found, so recurse
Get_Compilation_Unit (Current_Unit => Nested_Unit);
Compilation_Unit.Add_Compilation_Units
(Added_Unit => Nested_Unit, Unit_To_Add_To => Current_Unit);
when Token_Package.Renames_Token =>
-- Set the peek back so we can parse a subprogram parameter
Token_Package.Set_Peek_Back;
-- Just a subprogram renames, so finnish this statement
-- This loop does not follow the grammer because we know
-- that this is a renames. All we need to do is just get
-- tokens until we find the semicolon at the end (skipping
-- over parameters of course).
Find_The_Semicolon:
loop
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);
else
-- Not a left parenthesis
Get_Next_Significant_Token
(Significant_Token => Current_Token,
Current_Unit => Current_Unit);
if Token_Package.Class_Of (Current_Token) =
Token_Package.End_Of_File then
raise Build_Syntax_Error;
else
-- Not the end of file yet
Compilation_Unit.Add_Token_To_Compilation_Unit
(Token_To_Add => Current_Token,
Unit_To_Add_To => Current_Unit);
end if;
end if;
exit Find_The_Semicolon when
Token_Package.Value_Of (Current_Token) =
Token_Package.Semicolon_Token;
end loop Find_The_Semicolon;
when others =>
raise Build_Syntax_Error;
end case;
end Subprogram_Or_Renames;