Skip to content

Commit

Permalink
Merge branch 'mku/allocator' into 'master'
Browse files Browse the repository at this point in the history
Add Allocator and QualExpr config

Closes #1365

See merge request eng/libadalang/libadalang!1620
  • Loading branch information
CKMonika committed Apr 17, 2024
2 parents 17f47c4 + 90193a6 commit 2d1eeec
Show file tree
Hide file tree
Showing 21 changed files with 802 additions and 0 deletions.
47 changes: 47 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,27 @@
}
}
},
"Allocator": {
"node": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "new"
},
"whitespace",
{
"kind": "recurse_field",
"field": "f_subpool"
},
"whitespace",
{
"kind": "recurse_field",
"field": "f_type_or_expr"
}
]
}
},
"AlternativesList": {
"sep": [
"line",
Expand Down Expand Up @@ -4297,6 +4318,32 @@
}
}
},
"QualExpr": {
"node": {
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_prefix"
},
{
"kind": "text",
"text": "'"
},
{
"kind": "align",
"width": 2,
"contents": [
"softline",
{
"kind": "recurse_field",
"field": "f_suffix"
}
]
}
]
}
},
"RangeSpec": {
"node": {
"kind": "align",
Expand Down
101 changes: 101 additions & 0 deletions testsuite/tests/unparsing/allocator/doc-baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"id": 12,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 11,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "new (Pool) "
},
{
"id": 10,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 9,
"kind": "list",
"list": [
{
"id": 1,
"kind": "text",
"text": "Integer'"
},
{
"id": 8,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 7,
"kind": "list",
"list": [
{
"id": 2,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": true,
"hard": false
}
},
{
"id": 6,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 1
},
"alignContents": {
"id": 5,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 4,
"kind": "list",
"list": [
{
"id": 3,
"kind": "text",
"text": "(12)"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
]
}
}
}
]
},
"break": false,
"expandedStates": null
}
}
]
},
"break": false,
"expandedStates": null
}
}
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/allocator/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
new (Pool) Integer'(12)
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/allocator/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
new (Pool) Integer'(12)
6 changes: 6 additions & 0 deletions testsuite/tests/unparsing/allocator/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: |
This test checks the formatting of an allocator.
It is expected the declaration stays on a single line.
driver: unparser
rule: allocator
80 changes: 80 additions & 0 deletions testsuite/tests/unparsing/qual_expr/expr_1/doc-baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"id": 9,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 8,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "Integer'"
},
{
"id": 7,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 6,
"kind": "list",
"list": [
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": true,
"hard": false
}
},
{
"id": 5,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 1
},
"alignContents": {
"id": 4,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 3,
"kind": "list",
"list": [
{
"id": 2,
"kind": "text",
"text": "(12)"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
]
}
}
}
]
},
"break": false,
"expandedStates": null
}
}
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/qual_expr/expr_1/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Integer'(12)
1 change: 1 addition & 0 deletions testsuite/tests/unparsing/qual_expr/expr_1/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Integer'(12)
6 changes: 6 additions & 0 deletions testsuite/tests/unparsing/qual_expr/expr_1/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: |
This test checks the formatting of a qualified expression.
It is expected the declaration stays on a single line.
driver: unparser
rule: expr
Loading

0 comments on commit 2d1eeec

Please sign in to comment.