Skip to content

Commit

Permalink
Merge branch 'mku/enum_rep_clause' into 'master'
Browse files Browse the repository at this point in the history
Add EnumRepClause config

Closes #1363

See merge request eng/libadalang/libadalang!1618
  • Loading branch information
CKMonika committed Apr 16, 2024
2 parents 60459a6 + 382c201 commit 0a3bc01
Show file tree
Hide file tree
Showing 17 changed files with 1,993 additions and 0 deletions.
43 changes: 43 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,49 @@
"line"
]
},
"EnumRepClause": {
"node": {
"kind": "group",
"document": [
{
"kind": "group",
"document": [
{
"kind": "text",
"text": "for"
},
{
"kind": "recurse_field",
"field": "f_type_name"
},
"whitespace",
{
"kind": "text",
"text": "use"
}
]
},
{
"kind": "group",
"document": {
"kind": "align",
"width": 2,
"contents": [
"line",
{
"kind": "recurse_field",
"field": "f_aggregate"
},
{
"kind": "text",
"text": ";"
}
]
}
}
]
}
},
"EnumTypeDef": {
"node": {
"kind": "group",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for VeeeeeeeeeeeeryLoooooooooooongTyyyyyyyyyyyyyyyyypeNaaaaaaaaaaaame use (Aaaaaaaaaaaa => 1, Bbbbbbbbbbb => 5, Ccccccccc => 10, Dddd => 1, E => 5, F => 10);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
for VeeeeeeeeeeeeryLoooooooooooongTyyyyyyyyyyyyyyyyypeNaaaaaaaaaaaame use
(Aaaaaaaaaaaa => 1,
Bbbbbbbbbbb => 5,
Ccccccccc => 10,
Dddd => 1,
E => 5,
F => 10);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description: |
This test checks the formatting of an enum representation
clause with long type name and long aggregate.
It is expected the declaration breaks after `use` keyword
and the aggregagte be broken, one element per new line,
and all these new lines be indented.
driver: unparser
rule: aspect_clause

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for T use (Aaaaaaaaaaaa => 1, Bbbbbbbbbbb => 5, Ccccccccc => 10, Dddd => 1, E => 5, F => 10);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
for T use
(Aaaaaaaaaaaa => 1,
Bbbbbbbbbbb => 5,
Ccccccccc => 10,
Dddd => 1,
E => 5,
F => 10);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description: |
This test checks the formatting of an enum representation
clause with long aggregate.
It is expected the declaration breaks after `use` keyword
the aggregate is broken, each line contains one element,
and all these new lines are indented.
driver: unparser
rule: aspect_clause
357 changes: 357 additions & 0 deletions testsuite/tests/unparsing/enum_rep_clause/long_type/doc-baseline.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for VeeeeeeeeeeeeeeeeeeryLoooooooooooongTyyyyyyyyyyyyyyyyyypeNaaaaaaaaaaaame use (A => 1, B => 5, C => 10);
2 changes: 2 additions & 0 deletions testsuite/tests/unparsing/enum_rep_clause/long_type/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
for VeeeeeeeeeeeeeeeeeeryLoooooooooooongTyyyyyyyyyyyyyyyyyypeNaaaaaaaaaaaame use
(A => 1, B => 5, C => 10);
8 changes: 8 additions & 0 deletions testsuite/tests/unparsing/enum_rep_clause/long_type/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
description: |
This test checks the formatting of an enum representation
clause with a long type name.
It is expected the declaration breaks after the `use` keyword
and the new line be indented.
driver: unparser
rule: aspect_clause
357 changes: 357 additions & 0 deletions testsuite/tests/unparsing/enum_rep_clause/short/doc-baseline.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions testsuite/tests/unparsing/enum_rep_clause/short/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for r use (A => 1, B => 5, C => 10);
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/enum_rep_clause/short/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for r use (A => 1, B => 5, C => 10);
7 changes: 7 additions & 0 deletions testsuite/tests/unparsing/enum_rep_clause/short/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: |
This test checks the formatting of an enum representation
clause.
It is expected the declaration stays on a single line.
driver: unparser
rule: aspect_clause

0 comments on commit 0a3bc01

Please sign in to comment.