blob: b79f3a5b6010948273f4a90cf37aa23d1e2a4e8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
-- Model IED Simulator
-- COL Gene Ressler, 1 December 2007
with Ada.Text_IO;
with Ada.Characters.Latin_1;
use Ada.Characters.Latin_1;
with Ada.Strings.Fixed;
use Ada.Strings.Fixed;
with Ada.Strings;
with Ada.Strings.Bounded;
with Binary_Search;
with Ada.Containers.Generic_Array_Sort;
package body Scanner is
Constant_123 : constant Character := Character'Val (16#00#);
MAX_KEYWORD_LENGTH_C : constant Natural := 24;
New_Constant : constant New_Type
:= 2;
KEYWORDS_C : constant Keyword_Array_T :=
(To_BS("description"),
To_BS("with"));
procedure Blah;
procedure blah is
begin
Declaration:
declare
Joe : Type_Type := Random;
begin
Do_Something;
end Declaration;
Loop_ID:
loop
Loop_Do;
exit when 1=2;
end loop Loop_ID;
if True or else False then
Do_This();
elsif not False and then True then
Do_That;
else
Panic;
end if;
end blah;
function "*" (Left, Right : in Integer) return Integer is
begin
<<Goto_Label>>
goto Goto_Label;
return Left + Right;
end "*";
function Function_Specification
(Param_1 : in Blah;
Param2, param3 : in access Blah_Type := 0)
return It_Type;
package Rename_Check renames Ada.Text_IO;
type New_Float is delta 0.001 digits 12;
package Package_Inst is new Ada.Strings.Bounded.Generic_Bounded_Length
(Max => MAX_KEYWORD_LENGTH_C);
type Array_Decl12 is array (Positive range <>) of SB.Bounded_String;
type Array_Decl3 is array (New_Type range Thing_1 .. Thing_2) of SB.Bounded_String;
type Boring_Type is
(Start,
End_Error);
subtype Sub_Type_check is Character range '0' .. '9';
Initialized_Array : constant Transistion_Array_T :=
(Start =>
(Letter_Lower | Letter_Upper => Saw_Alpha,
' ' | HT | CR | LF => Start,
others => Begin_Error),
End_Error => (others => Start)
);
type Recorder is record
Advance : Boolean;
Return_Token : Token_T;
end record;
for Recorder use 8;
type Null_Record is null record;
type Discriminated_Record (Size : Natural) is
record
A : String (1 .. Size);
end record;
pragma Unchecked_Union (Union);
pragma Convention (C, Union);
type Person is tagged
record
Name : String (1 .. 10);
Gender : Gender_Type;
end record;
type Programmer is new Person with
record
Skilled_In : Language_List;
Favorite_Langauge : Python_Type;
end record;
type Programmer is new Person
and Printable
with
record
Skilled_In : Language_List;
Blah : aliased Integer;
end record;
---------------------
-- Scan_Next_Token --
---------------------
task Cyclic_Buffer_Task_Type is
entry Insert (An_Item : in Item);
entry Remove (An_Item : out Item);
end Cyclic_Buffer_Task_Type;
task body Cyclic_Buffer_Task_Type is
Q_Size : constant := 100;
subtype Q_Range is Positive range 1 .. Q_Size;
Length : Natural range 0 .. Q_Size := 0;
Head, Tail : Q_Range := 1;
Data : array (Q_Range) of Item;
begin
loop
select
when Length < Q_Size =>
accept Insert (An_Item : in Item) do
Data(Tail) := An_Item;
end Insert;
Tail := Tail mod Q_Size + 1;
Length := Length + 1;
or
when Length > 0 =>
accept Remove (An_Item : out Item) do
An_Item := Data(Head);
end Remove;
Head := Head mod Q_Size + 1;
Length := Length - 1;
end select;
end loop;
end Cyclic_Buffer_Task_Type;
procedure Scan_Next_Token
(S : in String;
Start_Index : out Positive;
End_Index : in out Natural; -- Tricky comment
Line_Number : in out Positive;
Token : out Token_T);
procedure Scan_Next_Token
(S : in String;
Start_Index : out Positive;
End_Index : in out Natural; -- Another comment
Line_Number : in out Positive;
Token : out Token_T)
is
begin
Scanner_Loop:
loop
if New_State = End_Error then
exit Scanner_Loop;
end if;
if State = Start and New_State /= Start then
Start_Index := Peek_Index;
end if;
end loop Scanner_Loop;
end Scan_Next_Token;
procedure Advance is
begin
Peek_Index := Peek_Index + 1;
end Advance;
-- Eliminate the leading space that Ada puts in front of positive
-- integer images.
function Image(N : in Integer) return String is
S : String := Integer'Image(N);
begin
if S(1) = ' ' then
return S(2 .. S'Last);
end if;
return S;
end Image;
end Scanner;
|