-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add and fix multiple unparsing configs
Add config for SelectStmt and fix related ones (TaskBody, AcceptStmtWithStmts and AcceptStmt). Fix CallStmt config so that a `f_name` is always followed by a whitespace or line. Fix concatenations inside association lists. Add config for SubtypeIndication. Improve IfExpr config. Add config for NullRecordAggregate. Fix f_type_expr indentation in ObjectDecl. Improve RaiseStmt config.
- Loading branch information
1 parent
5a4f88c
commit 9fcb3d8
Showing
27 changed files
with
836 additions
and
206 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Foo := | ||
(Baaaar with | ||
(Baaaar | ||
with | ||
Qux => Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, | ||
Baaaz => Bazzzzzzzz); |
11 changes: 11 additions & 0 deletions
11
testsuite/tests/unparsing/call_stmt/concatenation/input.ada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Add_Attribute | ||
(Package_Name => +"IDE", | ||
Attribute_Name => +"Connection_Tool", | ||
Description => | ||
"Executable used to interface with a " | ||
& "remote target when debugging. GNAT Studio currently supports " | ||
& "OpenOCD, st-util or pyOCD. You can leave this attribute empty " | ||
& "if you are using a custom tool spawned outside of GNAT Studio'.", | ||
Index_Type => PRA.No_Index, | ||
Value => Single, | ||
Value_Case_Sensitive => True); |
11 changes: 11 additions & 0 deletions
11
testsuite/tests/unparsing/call_stmt/concatenation/test.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Add_Attribute | ||
(Package_Name => +"IDE", | ||
Attribute_Name => +"Connection_Tool", | ||
Description => | ||
"Executable used to interface with a " | ||
& "remote target when debugging. GNAT Studio currently supports " | ||
& "OpenOCD, st-util or pyOCD. You can leave this attribute empty " | ||
& "if you are using a custom tool spawned outside of GNAT Studio'.", | ||
Index_Type => PRA.No_Index, | ||
Value => Single, | ||
Value_Case_Sensitive => True); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
driver: unparser | ||
rule: stmt | ||
description: | | ||
Test that multiple `ConcatOp`s inside `CallStmt` are correctly indented. |
5 changes: 5 additions & 0 deletions
5
testsuite/tests/unparsing/object_decl/long_multi_line_type_expr/input.ada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Foooo : | ||
constant Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar | ||
(Cooooooooooooooooooooooooooooorge) := | ||
Baaaaaaaaaaaaaaaaaaaaaaaaaz; | ||
|
4 changes: 4 additions & 0 deletions
4
testsuite/tests/unparsing/object_decl/long_multi_line_type_expr/test.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Foooo : | ||
constant Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar | ||
(Cooooooooooooooooooooooooooooorge) := | ||
Baaaaaaaaaaaaaaaaaaaaaaaaaz; |
7 changes: 7 additions & 0 deletions
7
testsuite/tests/unparsing/object_decl/long_multi_line_type_expr/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
driver: unparser | ||
rule: object_decl | ||
description: | | ||
Test that when `f_type_expr` is long, a line break and continuation line | ||
indentation is added after the `:`. | ||
Also test that if `f_type_expr` is multi line, its indentation is relative | ||
to where it starts. |
1 change: 1 addition & 0 deletions
1
testsuite/tests/unparsing/raise_expr/long_error_message_concatenation/input.ada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
raise Some_Exception with "AAAAAAAAAAAAAAAAAAAAAAAA" & "AAAAAAAAAAAAAAAAAAAAAAAA" & "AAAAAAAAAAAAAAAAAAAAAAAA" & "AAAAAAAAAAAAAAAAAAAAAAAA" |
6 changes: 6 additions & 0 deletions
6
testsuite/tests/unparsing/raise_expr/long_error_message_concatenation/test.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
raise Some_Exception | ||
with | ||
"AAAAAAAAAAAAAAAAAAAAAAAA" | ||
& "AAAAAAAAAAAAAAAAAAAAAAAA" | ||
& "AAAAAAAAAAAAAAAAAAAAAAAA" | ||
& "AAAAAAAAAAAAAAAAAAAAAAAA" |
7 changes: 7 additions & 0 deletions
7
testsuite/tests/unparsing/raise_expr/long_error_message_concatenation/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
driver: unparser | ||
rule: raise_expr | ||
description: | | ||
This test checks the formatting of a `RaiseExpr` that has a long | ||
`f_error_message` which consists of concatenations. | ||
It is expected `f_error_message` to be continuation line indented relative to | ||
`with`. |
6 changes: 6 additions & 0 deletions
6
testsuite/tests/unparsing/select_stmt/accept_and_guard_delay/input.ada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
select | ||
accept Driver_Awake_Signal; | ||
or | ||
delay 30.0 * Seconds; | ||
Stop_The_Train; | ||
end select; |
6 changes: 6 additions & 0 deletions
6
testsuite/tests/unparsing/select_stmt/accept_and_guard_delay/test.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
select | ||
accept Driver_Awake_Signal; | ||
or | ||
delay 30.0 * Seconds; | ||
Stop_The_Train; | ||
end select; |
7 changes: 7 additions & 0 deletions
7
testsuite/tests/unparsing/select_stmt/accept_and_guard_delay/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
driver: unparser | ||
rule: stmt | ||
description: | | ||
Test a `SelectStmt` node with a single element `f_guards` and single line | ||
`AcceptStmt`. | ||
It is expected that the `or` keyword is in its own line with the same | ||
indentation as the `select` keyword. |
24 changes: 24 additions & 0 deletions
24
testsuite/tests/unparsing/select_stmt/multi_line_accept_and_guard/input.ada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
select | ||
accept Start | ||
(Data_To_Monitor : Data_To_Monitor_Access; | ||
Directories : GNATCOLL.VFS.File_Array) | ||
do | ||
Data := Data_To_Monitor; | ||
|
||
Monitor := new LSP_Monitor; | ||
Monitor.The_Server := Data_To_Monitor.Server; | ||
|
||
Dirs := new File_Array (1 .. Directories'Length); | ||
Free_Index := 1; | ||
for Dir of Directories loop | ||
if Dir.Is_Directory then | ||
Dirs (Free_Index) := Dir; | ||
Free_Index := Free_Index + 1; | ||
end if; | ||
end loop; | ||
end Start; | ||
or | ||
accept Stop do | ||
Stop_Requested := True; | ||
end Stop; | ||
end select; |
24 changes: 24 additions & 0 deletions
24
testsuite/tests/unparsing/select_stmt/multi_line_accept_and_guard/test.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
select | ||
accept Start | ||
(Data_To_Monitor : Data_To_Monitor_Access; | ||
Directories : GNATCOLL.VFS.File_Array) | ||
do | ||
Data := Data_To_Monitor; | ||
|
||
Monitor := new LSP_Monitor; | ||
Monitor.The_Server := Data_To_Monitor.Server; | ||
|
||
Dirs := new File_Array (1 .. Directories'Length); | ||
Free_Index := 1; | ||
for Dir of Directories loop | ||
if Dir.Is_Directory then | ||
Dirs (Free_Index) := Dir; | ||
Free_Index := Free_Index + 1; | ||
end if; | ||
end loop; | ||
end Start; | ||
or | ||
accept Stop do | ||
Stop_Requested := True; | ||
end Stop; | ||
end select; |
7 changes: 7 additions & 0 deletions
7
testsuite/tests/unparsing/select_stmt/multi_line_accept_and_guard/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
driver: unparser | ||
rule: stmt | ||
description: | | ||
Test a `SelectStmt` node with a single element `f_guards` and multi line | ||
`AcceptStmt`. | ||
It is expected that the `or` keyword is in its own line with the same | ||
indentation as the `select` keyword. |
17 changes: 17 additions & 0 deletions
17
testsuite/tests/unparsing/select_stmt/multiple_guards/input.ada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
task body Server is | ||
Current_Work_Item : Work_Item; | ||
begin | ||
loop | ||
select | ||
accept Next_Work_Item (WI : in Work_Item) do | ||
Current_Work_Item := WI; | ||
end; | ||
Process_Work_Item (Current_Work_Item); | ||
or | ||
accept Shut_Down; | ||
exit; -- Premature shut down requested | ||
or | ||
terminate; -- Normal shutdown at end of scope | ||
end select; | ||
end loop; | ||
end Server; |
17 changes: 17 additions & 0 deletions
17
testsuite/tests/unparsing/select_stmt/multiple_guards/test.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
task body Server is | ||
Current_Work_Item : Work_Item; | ||
begin | ||
loop | ||
select | ||
accept Next_Work_Item (WI : in Work_Item) do | ||
Current_Work_Item := WI; | ||
end; | ||
Process_Work_Item (Current_Work_Item); | ||
or | ||
accept Shut_Down; | ||
exit; -- Premature shut down requested | ||
or | ||
terminate; -- Normal shutdown at end of scope | ||
end select; | ||
end loop; | ||
end Server; |
6 changes: 6 additions & 0 deletions
6
testsuite/tests/unparsing/select_stmt/multiple_guards/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
driver: unparser | ||
rule: task_body | ||
description: | | ||
Test a `SelectStmt` node with an `f_guards` of multiple guards. | ||
It is expected that the `or` keywords are on their own lines with the same | ||
indentation as the `select` keyword. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
procedure Spin (R : in out Resource) is | ||
begin | ||
loop | ||
select | ||
Controller.Request (Medium) (Some_Item); | ||
R.Seize; | ||
return; | ||
else | ||
null; -- busy waiting | ||
end select; | ||
end loop; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
procedure Spin (R : in out Resource) is | ||
begin | ||
loop | ||
select | ||
Controller.Request (Medium) (Some_Item); | ||
R.Seize; | ||
return; | ||
else | ||
null; -- busy waiting | ||
end select; | ||
end loop; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
driver: unparser | ||
rule: subp_body | ||
description: | | ||
Test a `SelectStmt` node with a non null `f_else_stmts`. | ||
It is expected that the `else` keyword is in its own line with the same | ||
indentation as the `select` keyword. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
separate(Parent) | ||
separate (Parent) | ||
procedure Inner is | ||
begin | ||
Foo; | ||
|
3 changes: 3 additions & 0 deletions
3
...s/unparsing/type_def/array_type_def/constrained_array/long_multiple_constraints/input.ada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type LCS_Array is | ||
array (Natural range 0 .. Old_Length, Natural range 0 .. New_Length, Natural range 0 .. New_Length) | ||
of Integer; |
5 changes: 5 additions & 0 deletions
5
...ts/unparsing/type_def/array_type_def/constrained_array/long_multiple_constraints/test.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type LCS_Array is | ||
array (Natural range 0 .. Old_Length, | ||
Natural range 0 .. New_Length, | ||
Natural range 0 .. New_Length) | ||
of Integer; |
6 changes: 6 additions & 0 deletions
6
...s/unparsing/type_def/array_type_def/constrained_array/long_multiple_constraints/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
driver: unparser | ||
rule: type_decl | ||
description: | | ||
This test checks the formatting of a constrained array that has multiple | ||
long constraints. It is expected the constraint list to be splitted in | ||
multiple lines. |