text stringlengths 0 234 |
|---|
declare |
Type_Name : constant String := Substring (The_Type.all, ":", 1); |
begin |
IO.Put_Line (Spec_File, " procedure Visit_" & Type_Name & "_" & Base_Name & |
" (Self : in out Visitor; The_" & Base_Name & |
" : " & Type_Name & ") with"); |
IO.Put_Line (Spec_File, " Global => (Input => Exprs.State);"); |
IO.Put_Line (Body_File, " procedure Visit_" & Type_Name & "_" & Base_Name & |
" (Self : in out Visitor; The_" & Base_Name & |
" : " & Type_Name & ") is"); |
IO.Put_Line (Body_File, " begin"); |
IO.Put_Line (Body_File, " null;"); |
IO.Put_Line (Body_File, " end Visit_" & Type_Name & "_" & Base_Name & ";"); |
IO.New_Line (Body_File); |
Function Definition: procedure Scan_Token is |
Function Body: procedure Add_Token (Kind : Token_Kind) with |
Global => (input => (Start, Current, Source, Line), |
in_out => (Error_Reporter.State, SPARK.Text_IO.Standard_Error, Token_List)), |
Pre => Source'First <= Start and then Start < Current and then Current - 1 <= Source'Last; |
procedure Add_Token (Kind : Token_Kind; Lexeme : String) with |
Global => (input => (Line), |
in_out => (Error_Reporter.State, SPARK.Text_IO.Standard_Error, Token_List)); |
procedure Advance (C : out Character) with |
Global => (Input => Source, In_Out => Current), |
Pre => Current >= Source'First and then |
Current <= Source'Last and then |
Current < Integer'Last, |
Post => Current = Current'Old + 1; |
procedure Ignore with |
Global => (Input => Source, In_Out => Current), |
Pre => Current >= Source'First and then |
Current <= Source'Last and then |
Current < Integer'Last, |
Post => Current = Current'Old + 1; |
procedure Advance_If_Match (Expected : Character; Match : out Boolean) with |
Global => (in_out => Current, Input => Source), |
Pre => Source'First <= Current and then Source'Last < Integer'Last, |
Post => (if Match then |
(Current - 1 <= Source'Last and then Current = Current'Old + 1) |
else |
Current = Current'Old); |
function Peek return Character with |
Global => (Input => (Current, Source)), |
Pre => Current >= Source'First, |
Post => (if Peek'Result /= NUL then Current <= Source'Last); |
function Peek_Next return Character with |
Pre => Current >= Source'First and then Current < Integer'Last; |
procedure Scan_Identifier with |
Pre => Source'First <= Start and then Start < Current and then |
Current - 1 <= Source'Last and then Source'Last < Integer'Last, |
Post => Current >= Current'Old; |
procedure Scan_Number with |
Pre => Source'First <= Start and then Start < Current and then |
Current - 1 <= Source'Last and then Source'Last < Integer'Last, |
Post => Current >= Current'Old; |
procedure Scan_String with |
Global => (Input => (Source, Start), |
in_out => (Current, Line, Token_List, SPARK.Text_IO.Standard_Error, Error_Reporter.State)), |
Pre => Source'First <= Start and then Start < Current and then Source'Last < Integer'Last, |
Post => Current >= Current'Old; |
procedure Add_Token (Kind : Token_Kind) is |
begin |
Add_Token (Kind, Source (Start .. Current - 1)); |
end Add_Token; |
procedure Add_Token (Kind : Token_Kind; Lexeme : String) is |
use Tokens.Lists; |
begin |
if Length (Token_List) >= Token_List.Capacity then |
Error_Reporter.Error (Line_No => Line, |
Message => "Out of token capacity"); |
return; |
end if; |
Append (Container => Token_List, |
New_Item => Tokens.New_Token (Kind => Kind, |
Lexeme => Lexeme, |
Line => Line)); |
end Add_Token; |
procedure Advance (C : out Character) is |
begin |
Current := Current + 1; |
C := Source (Current - 1); |
end Advance; |
procedure Advance_If_Match (Expected : Character; Match : out Boolean) is |
begin |
if Is_At_End then |
Match := False; |
elsif Source (Current) /= Expected then |
Match := False; |
else |
Current := Current + 1; |
Match := True; |
end if; |
end Advance_If_Match; |
procedure Ignore is |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.