Skip to content

Commit

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

Closes #1361

See merge request eng/libadalang/libadalang!1616
  • Loading branch information
CKMonika committed Apr 15, 2024
2 parents fd27030 + 92e6f45 commit eb20151
Show file tree
Hide file tree
Showing 9 changed files with 184 additions and 0 deletions.
49 changes: 49 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4036,6 +4036,55 @@
}
}
},
"ProtectedBodyStub": {
"node": {
"kind": "group",
"document": [
{
"kind": "group",
"document": [
{
"kind": "text",
"text": "protected"
},
"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"
]
}
},
"ProtectedDef": {
"node": {
"kind": "group",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"id": 7,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 4,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 3,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "protected body veeeeeerrrrrrrrrrrrrrrrrrrrrrrry_loooooooooooooooooonnnnnnnng_name"
},
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 2,
"kind": "text",
"text": "is separate"
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 5,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
4 changes: 4 additions & 0 deletions testsuite/tests/unparsing/protected_body_stub/long/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
protected body veeeeeerrrrrrrrrrrrrrrrrrrrrrrry_loooooooooooooooooonnnnnnnng_name is separate;



2 changes: 2 additions & 0 deletions testsuite/tests/unparsing/protected_body_stub/long/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
protected body veeeeeerrrrrrrrrrrrrrrrrrrrrrrry_loooooooooooooooooonnnnnnnng_name
is separate;
7 changes: 7 additions & 0 deletions testsuite/tests/unparsing/protected_body_stub/long/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: |
This test checks the formatting of protected body stub.
It is expected the declaration breaks before `is`
keyword and `protected` and `is` keywords be aligned.
driver: unparser
rule: protected_body_stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"id": 7,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 4,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 3,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "protected body PB"
},
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 2,
"kind": "text",
"text": "is separate"
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 5,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
protected body PB is separate;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
protected body PB is separate;
6 changes: 6 additions & 0 deletions testsuite/tests/unparsing/protected_body_stub/short/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: |
This test checks the formatting of protected body stub.
It is expected the declaration stays on a single line.
driver: unparser
rule: protected_body_stub

0 comments on commit eb20151

Please sign in to comment.