Skip to content

Commit 7ca2ad5

Browse files
authored
Merge pull request #2919 from masatake/ada-expression-function
Ada: parse expression functions
2 parents fbb8c89 + 1c5b0a9 commit 7ca2ad5

File tree

12 files changed

+136
-6
lines changed

12 files changed

+136
-6
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
input.adb,158
3+
package body System.Val_Util isSystem.Val_Util/b4,69
4+
procedure Bad_Value (S : String) isBad_Value/p6,102
5+
procedure Not_Tagged isNot_Tagged/p11,236
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--- file: s-valuti.adb
2+
with System.Case_Util; use System.Case_Util;
3+
4+
package body System.Val_Util is
5+
6+
procedure Bad_Value (S : String) is
7+
begin
8+
raise Constraint_Error with "bad input for 'Value: """ & S & '"';
9+
end Bad_Value;
10+
11+
procedure Not_Tagged is
12+
begin
13+
null;
14+
end Not_Tagged;
15+
end System.Val_Util;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
input.adb,486
3+
procedure My_Package isMy_Package/p1,0
4+
package Generic_Integer_Images isGeneric_Integer_Images/s5,71
5+
function Digit_To_Character (X : Unsigned_Type) return Character;Digit_To_Character/f6,107
6+
type Unsigned_Type is range <>;Unsigned_Type4,35
7+
package body Generic_Integer_Images isGeneric_Integer_Images/b9,208
8+
function Digit_To_Character (X : Unsigned_Type) return Character isDigit_To_Character/f10,249
9+
type Signed_Address is rangeSigned_Address/t14,379
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
procedure My_Package is
2+
3+
generic
4+
type Unsigned_Type is range <>;
5+
package Generic_Integer_Images is
6+
function Digit_To_Character (X : Unsigned_Type) return Character;
7+
end Generic_Integer_Images;
8+
9+
package body Generic_Integer_Images is
10+
function Digit_To_Character (X : Unsigned_Type) return Character is
11+
(Character'Val (0));
12+
end Generic_Integer_Images;
13+
14+
type Signed_Address is range
15+
-2**(Standard'Address_Size - 1) .. 2**(Standard'Address_Size - 1) - 1;
16+
begin
17+
null;
18+
end My_Package;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--sort=no
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Test input.adb /^procedure Test is$/;" r
2+
My_Type input.adb /^ My_Type : Boolean := True;$/;" v subprogram:Test file:
3+
Tagged_Procedure input.adb /^ procedure Tagged_Procedure is$/;" r subprogram:Test file:
4+
Boolean_As_String input.adb /^ function Boolean_As_String return String is$/;" r subprogram:Tagged_Procedure file:
5+
Another_Boolean_As_String input.adb /^ function Another_Boolean_As_String return String is$/;" r subprogram:Tagged_Procedure file:
6+
p0 input.adb /^ procedure p0 is $/;" r subprogram:Tagged_Procedure file:
7+
Yet_Boolean_As_String input.adb /^ function Yet_Boolean_As_String return String is$/;" r subprogram:Tagged_Procedure file:
8+
p1 input.adb /^ procedure p1 is $/;" r subprogram:Tagged_Procedure file:
9+
Not_Tagged_Procedure input.adb /^ procedure Not_Tagged_Procedure is$/;" r subprogram:Test file:
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
with Ada.Text_IO;
2+
3+
procedure Test is
4+
5+
My_Type : Boolean := True;
6+
7+
procedure Tagged_Procedure is
8+
function Boolean_As_String return String is
9+
(case My_Type is
10+
when True => "True Value",
11+
when False => "False Value");
12+
13+
function Another_Boolean_As_String return String is
14+
(case My_Type is when True => "; function dummy0 return String is (",
15+
when False => "; function dummy1 return String is (");
16+
procedure p0 is
17+
begin
18+
Ada.Text_IO.put ("-0");
19+
end p0;
20+
function Yet_Boolean_As_String return String is
21+
(case My_Type is
22+
when True => "1",
23+
when False => "0");
24+
procedure p1 is
25+
begin
26+
Ada.Text_IO.put ("-1");
27+
end p1;
28+
begin
29+
null;
30+
end Tagged_Procedure;
31+
32+
procedure Not_Tagged_Procedure is
33+
begin
34+
null;
35+
end Not_Tagged_Procedure;
36+
begin
37+
null;
38+
end Test;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
input.ads,278
3+
package My_Package isMy_Package/s2,48
4+
package Conversions isConversions/s6,108
5+
function From_Big_Real (Arg : Integer) return Num;From_Big_Real/f7,133
6+
type Num is digits <>;Num5,81
7+
type Missing_Tag is recordMissing_Tag/t10,208
8+
Num : Integer;Num11,237
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- Taken from #2925 submitted by @koenmeersman
2+
package My_Package is
3+
4+
generic
5+
type Num is digits <>;
6+
package Conversions is
7+
function From_Big_Real (Arg : Integer) return Num;
8+
end Conversions;
9+
10+
type Missing_Tag is record
11+
Num : Integer;
12+
end record;
13+
14+
end My_Package;

0 commit comments

Comments
 (0)