Skip to content

Commit

Permalink
Merge branch 'issue_1329' into 'master'
Browse files Browse the repository at this point in the history
Unparsing: add configuration for NullSubpDecl

Closes #1329

See merge request eng/libadalang/libadalang!1598
  • Loading branch information
joaopsazevedo committed Mar 28, 2024
2 parents 13c852a + 3a8613b commit 0e08273
Show file tree
Hide file tree
Showing 13 changed files with 2,651 additions and 0 deletions.
38 changes: 38 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2883,6 +2883,44 @@
]
}
},
"NullSubpDecl": {
"node": {
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_overriding"
},
{
"kind": "recurse_field",
"field": "f_subp_spec"
},
"line",
{
"kind": "text",
"text": "is"
},
{
"kind": "text",
"text": "null"
},
{
"kind": "recurse_field",
"field": "f_aspects"
},
{
"kind": "text",
"text": ";"
}
]
},
"fields": {
"f_aspects": [
"hardlineWithoutBreakParent",
"recurse"
]
}
},
"ObjectDecl": {
"node": {
"kind": "group",
Expand Down
835 changes: 835 additions & 0 deletions testsuite/tests/unparsing/null_subp_decl/long/doc-baseline.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions testsuite/tests/unparsing/null_subp_decl/long/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
procedure Foo
(AAAAAAAAAAAA : Bar;
BBBBBBBBBBBB : Baz;
CCCCCCCCCCCC : Qux;
DDDDDDDDDDDD : Corge) is null;
6 changes: 6 additions & 0 deletions testsuite/tests/unparsing/null_subp_decl/long/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
procedure Foo
(AAAAAAAAAAAA : Bar;
BBBBBBBBBBBB : Baz;
CCCCCCCCCCCC : Qux;
DDDDDDDDDDDD : Corge)
is null;
5 changes: 5 additions & 0 deletions testsuite/tests/unparsing/null_subp_decl/long/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
driver: unparser
rule: null_subp_decl
description: |
Test that a line break is added before the `is` keyword and that it has the
same indentation as the `function` keyword.
835 changes: 835 additions & 0 deletions testsuite/tests/unparsing/null_subp_decl/short/doc-baseline.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions testsuite/tests/unparsing/null_subp_decl/short/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
procedure Foo(A:Bar;B:Baz;C:Qux;D:Corge)is null;
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/null_subp_decl/short/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
procedure Foo (A : Bar; B : Baz; C : Qux; D : Corge) is null;
4 changes: 4 additions & 0 deletions testsuite/tests/unparsing/null_subp_decl/short/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: unparser
rule: null_subp_decl
description: |
Test that no line break are added.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
procedure Foo (A : Bar; B : Baz; C : Qux; D : Corge) is null with Garplyyyyyyy;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
procedure Foo (A : Bar; B : Baz; C : Qux; D : Corge) is null
with Garplyyyyyyy;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
driver: unparser
rule: null_subp_decl
description: |
Test that a line break is added before the `with` keyword and that it has the
same indentation as the `function` keyword.

0 comments on commit 0e08273

Please sign in to comment.