Skip to content

Commit

Permalink
Add configuration for Aggregate and AggregateAssoc
Browse files Browse the repository at this point in the history
  • Loading branch information
joaopsazevedo authored and CKMonika committed Mar 22, 2024
1 parent 8ec2ba0 commit 11a38be
Show file tree
Hide file tree
Showing 17 changed files with 1,002 additions and 0 deletions.
79 changes: 79 additions & 0 deletions extensions/default_unparsing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,85 @@
"hardline"
]
},
"Aggregate": {
"node": {
"kind": "group",
"document": [
{
"kind": "text",
"text": "("
},
{
"kind": "align",
"width": 1,
"contents": [
{
"kind": "recurse_field",
"field": "f_ancestor_expr"
},
{
"kind": "innerRoot",
"contents": {
"kind": "recurse_field",
"field": "f_assocs"
}
}
]
},
{
"kind": "text",
"text": ")"
}
]
},
"fields": {
"f_ancestor_expr": {
"kind": "align",
"width": 2,
"contents": [
"recurse",
{
"kind": "text",
"text": "with"
},
"line"
]
}
}
},
"AggregateAssoc": {
"node": {
"kind": "group",
"document": [
{
"kind": "recurse_field",
"field": "f_designators"
},
{
"kind": "innerRoot",
"contents": {
"kind": "recurse_field",
"field": "f_r_expr"
}
}
]
},
"fields": {
"f_designators": {
"kind": "align",
"width": 2,
"contents": [
"recurse",
"whitespace",
{
"kind": "text",
"text": "=>"
},
"line"
]
}
}
},
"AlternativesList": {
"sep": [
"line",
Expand Down
279 changes: 279 additions & 0 deletions testsuite/tests/unparsing/aggregate/long_complete/doc-baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
{
"id": 35,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 34,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 33,
"kind": "list",
"list": [
{
"id": 0,
"kind": "text",
"text": "Foo :="
},
{
"id": 1,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 31,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 30,
"kind": "list",
"list": [
{
"id": 2,
"kind": "text",
"text": "("
},
{
"id": 28,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 1
},
"alignContents": {
"id": 27,
"kind": "list",
"list": [
{
"id": 6,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 5,
"kind": "list",
"list": [
{
"id": 3,
"kind": "text",
"text": "Baaaar with"
},
{
"id": 4,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
}
]
}
}
},
{
"id": 26,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "innerRoot"
},
"alignContents": {
"id": 25,
"kind": "list",
"list": [
{
"id": 14,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 13,
"kind": "list",
"list": [
{
"id": 10,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 9,
"kind": "list",
"list": [
{
"id": 7,
"kind": "text",
"text": "Qux =>"
},
{
"id": 8,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
}
]
}
}
},
{
"id": 12,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "innerRoot"
},
"alignContents": {
"id": 11,
"kind": "text",
"text": "Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 15,
"kind": "text",
"text": ","
},
{
"id": 16,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
},
{
"id": 24,
"kind": "command",
"command": {
"command": "group",
"id": 0,
"groupContents": {
"id": 23,
"kind": "list",
"list": [
{
"id": 20,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "width",
"n": 2
},
"alignContents": {
"id": 19,
"kind": "list",
"list": [
{
"id": 17,
"kind": "text",
"text": "Baaaz =>"
},
{
"id": 18,
"kind": "command",
"command": {
"command": "line",
"literal": false,
"soft": false,
"hard": false
}
}
]
}
}
},
{
"id": 22,
"kind": "command",
"command": {
"command": "align",
"alignData": {
"kind": "innerRoot"
},
"alignContents": {
"id": 21,
"kind": "text",
"text": "Bazzzzzzzz"
}
}
}
]
},
"break": false,
"expandedStates": null
}
}
]
}
}
}
]
}
}
},
{
"id": 29,
"kind": "text",
"text": ")"
}
]
},
"break": false,
"expandedStates": null
}
},
{
"id": 32,
"kind": "text",
"text": ";"
}
]
},
"break": false,
"expandedStates": null
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Foo := (Baaaar with Qux => Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, Baaaz => Bazzzzzzzz);
4 changes: 4 additions & 0 deletions testsuite/tests/unparsing/aggregate/long_complete/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Foo :=
(Baaaar with
Qux => Baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
Baaaz => Bazzzzzzzz);
4 changes: 4 additions & 0 deletions testsuite/tests/unparsing/aggregate/long_complete/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: unparser
rule: stmt
description: |
Test that no line breaks are added.
Loading

0 comments on commit 11a38be

Please sign in to comment.