Skip to content

Commit

Permalink
Merge branch 'issue_1330' into 'master'
Browse files Browse the repository at this point in the history
Unparsing: add configurations for PackageBodyStub, SubpBodyStub and Subunit

Closes #1330

See merge request eng/libadalang/libadalang!1595
  • Loading branch information
joaopsazevedo committed Mar 27, 2024
2 parents d9c1234 + b2d883f commit 24507f6
Show file tree
Hide file tree
Showing 25 changed files with 3,371 additions and 0 deletions.
115 changes: 115 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2980,6 +2980,55 @@
]
}
},
"PackageBodyStub": {
"node": {
"kind": "group",
"document": [
{
"kind": "group",
"document": [
{
"kind": "text",
"text": "package"
},
"whitespace",
{
"kind": "text",
"text": "body"
},
"whitespace",
{
"kind": "recurse_field",
"field": "f_name"
},
"line",
{
"kind": "text",
"text": "is"
},
{
"kind": "text",
"text": "separate"
}
]
},
{
"kind": "recurse_field",
"field": "f_aspects"
},
{
"kind": "text",
"text": ";"
}
]
},
"fields": {
"f_aspects": [
"hardlineWithoutBreakParent",
"recurse"
]
}
},
"PackageDecl": {
"node": [
{
Expand Down Expand Up @@ -3755,6 +3804,44 @@
]
}
},
"SubpBodyStub": {
"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": "separate"
},
{
"kind": "recurse_field",
"field": "f_aspects"
},
{
"kind": "text",
"text": ";"
}
]
},
"fields": {
"f_aspects": [
"hardlineWithoutBreakParent",
"recurse"
]
}
},
"SubpDecl": {
"node": {
"kind": "group",
Expand Down Expand Up @@ -3848,6 +3935,34 @@
}
}
},
"Subunit": {
"node": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "separate"
},
{
"kind": "text",
"text": "("
},
{
"kind": "recurse_field",
"field": "f_name"
},
{
"kind": "text",
"text": ")"
},
"hardlineWithoutBreakParent",
{
"kind": "recurse_field",
"field": "f_body"
}
]
}
},
"TypeAccessDef": {
"node": {
"kind": "group",
Expand Down
202 changes: 202 additions & 0 deletions testsuite/tests/unparsing/package_body_stub/long/doc-baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
{
"id": 25,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 24,
"kind": "list",
"list": [
{
"id": 13,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 12,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "package body "
},
{
"id": 9,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "innerRoot"
},
"alignContents": {
"id": 8,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 7,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 1,
"kind": "text",
"text": "Foooooooooooooo"
},
{
"id": 2,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": true,
"hard": false
}
},
{
"id": 3,
"kind": "text",
"text": ".Baaaaaaaaaaaaaar"
},
{
"id": 4,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": true,
"hard": false
}
},
{
"id": 5,
"kind": "text",
"text": ".Quuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuux"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
}
},
{
"id": 10,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 11,
"kind": "text",
"text": "is separate"
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 14,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": true
}
},
{
"id": 22,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 21,
"kind": "list",
"list": [
{
"id": 15,
"kind": "text",
"text": "with"
},
{
"id": 20,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 19,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 18,
"kind": "list",
"list": [
{
"id": 16,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 17,
"kind": "text",
"text": "Garply"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 23,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/package_body_stub/long/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package body Foooooooooooooo.Baaaaaaaaaaaaaar.Quuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuux is separate with Garply;
5 changes: 5 additions & 0 deletions testsuite/tests/unparsing/package_body_stub/long/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package body Foooooooooooooo
.Baaaaaaaaaaaaaar
.Quuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuux
is separate
with Garply;
4 changes: 4 additions & 0 deletions testsuite/tests/unparsing/package_body_stub/long/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: unparser
rule: package_body_stub
descrition: |
Test that "is separate" and `f_aspects` are in its own lines.
Loading

0 comments on commit 24507f6

Please sign in to comment.