|
|
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: 5318 (0x14c6)
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 (Compilation_Unit.Produce_Metrics)
procedure If_Statement (Current_Compilation_Unit : in out Ada_Compilation_Unit;
Program_Unit : in Program_Unit_State_Machine;
Halstead : in Halstead_State_Machine;
Loc : in Loc_State_Machine;
Mccabe : in Mccabe_State_Machine) is
--====================================================================
-- IF_Statement ::=
-- "IF" Expression "THEN"
-- Sequence_Of_Statements
-- { "ELSIF" Sequence_Of_Statements }
-- [ "ELSE" Sequence_Of_Statements ]
-- "END" "IF" ";"
--====================================================================
Current_Token : Token_Package.Token;
begin
-- IF_Statement
Get_Next_Token (Out_Token => Current_Token,
From => Current_Compilation_Unit,
Current_Loc => Loc);
if "/=" (Token_Package.Value_Of (Current_Token),
Token_Package.If_Token) then
raise Syntax_Error;
end if;
-- increment McCabe PI
Mccabe.Change_Pi;
-- until "THEN" is found
Expression (Current_Compilation_Unit => Current_Compilation_Unit,
Program_Unit => Program_Unit,
Halstead => Halstead,
Loc => Loc,
Mccabe => Mccabe,
Terminate_Tokens =>
Set_Of_Tokens'(1 => Token_Package.Then_Token));
Get_Next_Token (Out_Token => Current_Token,
From => Current_Compilation_Unit,
Current_Loc => Loc);
if "/=" (Token_Package.Value_Of (Current_Token),
Token_Package.Then_Token) then
raise Syntax_Error;
end if;
Sequence_Of_Statements
(Current_Compilation_Unit => Current_Compilation_Unit,
Program_Unit => Program_Unit,
Halstead => Halstead,
Loc => Loc,
Mccabe => Mccabe);
Process_Elsifs:
while Token_Package.Value_Of (Peek (From => Current_Compilation_Unit)) =
Token_Package.Elsif_Token loop
Get_Next_Token (Out_Token => Current_Token,
From => Current_Compilation_Unit,
Current_Loc => Loc);
-- increment Halstead ELSIF_THEN operator count
Halstead.Store_Operator
((Kind => Halstead_Operator.Elsif_Then_Halstead));
-- increment McCabe PI
Mccabe.Change_Pi;
-- until "THEN" is found
Expression (Current_Compilation_Unit => Current_Compilation_Unit,
Program_Unit => Program_Unit,
Halstead => Halstead,
Loc => Loc,
Mccabe => Mccabe,
Terminate_Tokens =>
Set_Of_Tokens'(1 => Token_Package.Then_Token));
Get_Next_Token (Out_Token => Current_Token,
From => Current_Compilation_Unit,
Current_Loc => Loc);
if "/=" (Token_Package.Value_Of (Current_Token),
Token_Package.Then_Token) then
raise Syntax_Error;
end if;
Sequence_Of_Statements
(Current_Compilation_Unit => Current_Compilation_Unit,
Program_Unit => Program_Unit,
Halstead => Halstead,
Loc => Loc,
Mccabe => Mccabe);
end loop Process_Elsifs;
Get_Next_Token (Out_Token => Current_Token,
From => Current_Compilation_Unit,
Current_Loc => Loc);
if Token_Package.Value_Of (Current_Token) = Token_Package.Else_Token then
-- increment Halstead ELSE operator count
Halstead.Store_Operator ((Kind => Halstead_Operator.Else_Halstead));
Sequence_Of_Statements
(Current_Compilation_Unit => Current_Compilation_Unit,
Program_Unit => Program_Unit,
Halstead => Halstead,
Loc => Loc,
Mccabe => Mccabe);
Get_Next_Token (Out_Token => Current_Token,
From => Current_Compilation_Unit,
Current_Loc => Loc);
end if;
if "/=" (Token_Package.Value_Of (Current_Token),
Token_Package.End_Token) then
raise Syntax_Error;
end if;
Get_Next_Token (Out_Token => Current_Token,
From => Current_Compilation_Unit,
Current_Loc => Loc);
if "/=" (Token_Package.Value_Of (Current_Token),
Token_Package.If_Token) then
raise Syntax_Error;
end if;
-- increment Halstead IF_THEN_END_IF operator count
Halstead.Store_Operator ((Kind =>
Halstead_Operator.If_Then_End_If_Halstead));
Get_Next_Token (Out_Token => Current_Token,
From => Current_Compilation_Unit,
Current_Loc => Loc);
if "/=" (Token_Package.Value_Of (Current_Token),
Token_Package.Semicolon_Token) then
raise Syntax_Error;
end if;
-- increment Halstead SEMICOLON operator count
Halstead.Store_Operator ((Kind => Halstead_Operator.Semicolon_Halstead));
end If_Statement;