Skip to content

Commit

Permalink
Merge branch 'mku/anonymous_type' into 'master'
Browse files Browse the repository at this point in the history
Unparsing: Add AnonymousType and AnonymousTypeDecl configs

Closes #1355

See merge request eng/libadalang/libadalang!1611
  • Loading branch information
joaopsazevedo committed Apr 9, 2024
2 parents ad015e3 + f639d9e commit 622b5fd
Show file tree
Hide file tree
Showing 27 changed files with 2,113 additions and 1,191 deletions.
71 changes: 53 additions & 18 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"kind": "text",
"text": "accept"
},
"whitespace",
"whitespace",
{
"kind": "recurse_field",
"field": "f_body_decl"
Expand All @@ -30,7 +30,7 @@
},
"AcceptStmtBody": {
"node": [
{
{
"kind": "recurse_field",
"field": "f_name"
}
Expand All @@ -44,7 +44,7 @@
"kind": "text",
"text": "accept"
},
"whitespace",
"whitespace",
{
"kind": "recurse_field",
"field": "f_body_decl"
Expand All @@ -66,12 +66,12 @@
"kind": "recurse_field",
"field": "f_stmts"
},
"hardlineWithoutBreakParent",
"hardlineWithoutBreakParent",
{
"kind": "text",
"text": "end"
},
"whitespace",
"whitespace",
{
"kind": "recurse_field",
"field": "f_end_name"
Expand Down Expand Up @@ -198,6 +198,41 @@
"whitespace"
]
},
"AnonymousTypeDecl": {
"node": {
"kind": "group",
"document": [
{
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_name"
},
{
"kind": "recurse_field",
"field": "f_discriminants"
}
]
},
{
"kind": "align",
"width": 2,
"contents": [
{
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_type_def"
}
]
}
]
}
]
}
},
"AspectAssoc": {
"node": {
"kind": "group",
Expand Down Expand Up @@ -1464,11 +1499,11 @@
{
"kind": "text",
"text": "entry"
},
},
{
"kind": "recurse_field",
"field": "f_entry_name"
},
},
{
"kind": "recurse_field",
"field": "f_family_type"
Expand Down Expand Up @@ -1502,7 +1537,7 @@
}
]
}
],
],
"f_entry_params": {
"kind": "ifEmpty",
"then": "recurse",
Expand Down Expand Up @@ -4137,14 +4172,14 @@
{
"kind": "recurse_field",
"field": "f_task_type"
},
},
{
"kind": "text",
"text": ";"
}
]
}
},
},
"SingleTaskTypeDecl": {
"node": {
"kind": "group",
Expand All @@ -4169,7 +4204,7 @@
{
"kind": "recurse_field",
"field": "f_definition"
}
}
]
},
"fields": {
Expand Down Expand Up @@ -4420,12 +4455,12 @@
"kind": "text",
"text": "task"
},
"whitespace",
"whitespace",
{
"kind": "text",
"text": "body"
},
"whitespace",
"whitespace",
{
"kind": "recurse_field",
"field": "f_name"
Expand Down Expand Up @@ -4481,15 +4516,15 @@
"hardlineWithoutBreakParent"
]
}
},
},
"TaskDef": {
"node": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "is"
},
},
{
"kind": "recurse_field",
"field": "f_interfaces"
Expand Down Expand Up @@ -4551,7 +4586,7 @@
"contents": "recurse"
}
]
}
}
}
},
"TaskTypeDecl": {
Expand Down Expand Up @@ -4611,7 +4646,7 @@
"contents": [
"hardlineWithoutBreakParent",
"recurse"
]
]
}
}
}
Expand Down Expand Up @@ -4946,4 +4981,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"id": 8,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 7,
"kind": "list",
"list": [
{
"id": 1,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 0,
"kind": "list",
"list": [
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 6,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 5,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 4,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 3,
"kind": "list",
"list": [
{
"id": 2,
"kind": "text",
"text": "access all Bbbbbbbbbbbbbbb"
}
]
},
"break": false,
"expandedStates": null
}
},
"break": false,
"expandedStates": null
}
}
}
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
access all Bbbbbbbbbbbbbbb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
access all Bbbbbbbbbbbbbbb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: |
This test checks the formatting of a simple anonymous
access all type declaration.
It is expected the declaration stays on a single line.
driver: unparser
rule: anonymous_type_decl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"id": 8,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 7,
"kind": "list",
"list": [
{
"id": 1,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 0,
"kind": "list",
"list": [
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 6,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 5,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 4,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 3,
"kind": "list",
"list": [
{
"id": 2,
"kind": "text",
"text": "not null access Bbbbbbbbbbbbbbb"
}
]
},
"break": false,
"expandedStates": null
}
},
"break": false,
"expandedStates": null
}
}
}
}
]
},
"break": false,
"expandedStates": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
not null access Bbbbbbbbbbbbbbb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
not null access Bbbbbbbbbbbbbbb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description: |
This test checks the formatting of a simple not null
anonymous access type declaration.
It is expected the declaration stays on a single line.
driver: unparser
rule: anonymous_type_decl
Loading

0 comments on commit 622b5fd

Please sign in to comment.