text stringlengths 0 234 |
|---|
package Rule_Counter_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Rule_Str, |
Element_Type => Long_Long_Natural, |
Hash => Ada.Strings.Hash, |
Equivalent_Keys => "=", |
"=" => "="); |
use Rule_Maps; |
use Rule_Counter_Maps; |
File : File_Type; |
Start_Time, End_Time : CPU_Time; |
Execution_Duration : Time_Span; |
File_Is_Empty : Boolean := True; |
Result : Long_Long_Natural := Long_Long_Natural'First; |
Rules : Rule_Maps.Map := Rule_Maps.Empty_Map; |
Counter : Rule_Counter_Maps.Map := Rule_Counter_Maps.Empty_Map; |
Polymer_Template : Unbounded_String; |
begin |
Get_File (File); |
Polymer_Template := To_Unbounded_String (Get_Line (File)); |
-- Get all rules |
begin |
while not End_Of_File (File) loop |
declare |
Str : constant String := Get_Line (File); |
begin |
if Str'Length = 0 then |
goto Continue_Next_Line; |
end if; |
declare |
Pattern : constant String := " -> "; |
Separator_Index : constant Integer := |
Ada.Strings.Fixed.Index (Source => Str (1 .. Str'Last), Pattern => Pattern); |
Left_Str : constant String := Str (1 .. Separator_Index - 1); |
Right_Str : constant String := Str (Separator_Index + Pattern'Length .. Str'Last); |
begin |
Rules.Include (Rule_Str (Left_Str), Right_Str (Right_Str'First)); |
Function Definition: procedure Main is |
Function Body: use Ada.Text_IO; |
use Utils; |
package Integer_Vectors is new Ada.Containers.Vectors (Natural, Integer); |
use Integer_Vectors; |
File : File_Type; |
Values : Vector := Empty_Vector; |
begin |
Get_File (File); |
-- Get all values |
while not End_Of_File (File) loop |
declare |
Value : Natural; |
begin |
Ada.Integer_Text_IO.Get (File, Value); |
Values.Append (Value); |
Function Definition: procedure Main is |
Function Body: use Ada.Text_IO; |
use Utils; |
use type Ada.Containers.Count_Type; |
package Integer_Vectors is new Ada.Containers.Vectors (Natural, Integer); |
use Integer_Vectors; |
File : File_Type; |
Values : Vector := Empty_Vector; |
begin |
Get_File (File); |
-- Get all values |
while not End_Of_File (File) loop |
declare |
Value : Natural; |
begin |
Ada.Integer_Text_IO.Get (File, Value); |
Values.Append (Value); |
Function Definition: procedure Main is |
Function Body: use Ada.Execution_Time, |
Ada.Real_Time, |
Ada.Text_IO; |
use Utils; |
Opening_Bracket : constant := -2; |
Closing_Bracket : constant := -1; |
subtype Snailfish_Values is Integer range Opening_Bracket .. Integer'Last; |
package Snailfish_Math_List is new Ada.Containers.Doubly_Linked_Lists (Element_Type => Snailfish_Values, |
"=" => "="); |
use Snailfish_Math_List; |
function "+" (Left, Right : List) return List; |
function "+" (Left, Right : List) return List is |
Result : List := Copy (Left); |
begin |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.