From f4c738ce89a60d24371ffa3919f088a2392f8217 Mon Sep 17 00:00:00 2001 From: Monika Kurovszky Date: Fri, 12 Apr 2024 10:17:36 +0200 Subject: [PATCH] Add ComponentClause and RecordrepClause configs --- extensions/default_unparsing_config.json | 100 ++ .../record_rep_clause/long/doc-baseline.json | 995 ++++++++++++++++++ .../record_rep_clause/long/input.ada | 1 + .../unparsing/record_rep_clause/long/test.out | 9 + .../record_rep_clause/long/test.yaml | 10 + .../record_rep_clause/short/doc-baseline.json | 995 ++++++++++++++++++ .../record_rep_clause/short/input.ada | 1 + .../record_rep_clause/short/test.out | 9 + .../record_rep_clause/short/test.yaml | 10 + 9 files changed, 2130 insertions(+) create mode 100644 testsuite/tests/unparsing/record_rep_clause/long/doc-baseline.json create mode 100644 testsuite/tests/unparsing/record_rep_clause/long/input.ada create mode 100644 testsuite/tests/unparsing/record_rep_clause/long/test.out create mode 100644 testsuite/tests/unparsing/record_rep_clause/long/test.yaml create mode 100644 testsuite/tests/unparsing/record_rep_clause/short/doc-baseline.json create mode 100644 testsuite/tests/unparsing/record_rep_clause/short/input.ada create mode 100644 testsuite/tests/unparsing/record_rep_clause/short/test.out create mode 100644 testsuite/tests/unparsing/record_rep_clause/short/test.yaml diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 51ba10ef2..de6dede57 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -824,6 +824,33 @@ } } }, + "ComponentClause": { + "node": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_id" + }, + { + "kind": "text", + "text": "at" + }, + { + "kind": "recurse_field", + "field": "f_position" + }, + { + "kind": "recurse_field", + "field": "f_range" + }, + { + "kind": "text", + "text": ";" + } + ] + } + }, "ComponentDecl": { "node": { "kind": "group", @@ -4370,6 +4397,79 @@ ] } }, + "RecordRepClause": { + "node": { + "kind": "group", + "document": [ + { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "for" + }, + { + "kind": "recurse_field", + "field": "f_name" + }, + "whitespace", + { + "kind": "text", + "text": "use" + } + ] + }, + { + "kind": "align", + "width": 2, + "contents": [ + "hardline", + { + "kind": "text", + "text": "record" + }, + { + "kind": "recurse_field", + "field": "f_at_expr" + }, + { + "kind": "recurse_field", + "field": "f_components" + }, + "hardline", + { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "end" + }, + "whitespace", + { + "kind": "text", + "text": "record" + }, + { + "kind": "text", + "text": ";" + } + ] + } + ] + } + ] + }, + "fields": { + "f_components": { + "kind": "align", + "width": 2, + "contents": [ + "hardline", + "recurse" + ] + } + } + }, "ReturnStmt": { "node": { "kind": "align", diff --git a/testsuite/tests/unparsing/record_rep_clause/long/doc-baseline.json b/testsuite/tests/unparsing/record_rep_clause/long/doc-baseline.json new file mode 100644 index 000000000..0265b3941 --- /dev/null +++ b/testsuite/tests/unparsing/record_rep_clause/long/doc-baseline.json @@ -0,0 +1,995 @@ +{ + "id": 132, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 131, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 1, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "for VeeeeeeeeeeeeeeeeeeeeeeeeeeeeryLoooooooooooooooooooooooooooooooongRecordRepClause use" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 130, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 129, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 4, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 6, + "kind": "text", + "text": "record" + }, + { + "id": 122, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 121, + "kind": "list", + "list": [ + { + "id": 9, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 8, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 25, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 24, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "text", + "text": "L1 at 0" + }, + { + "id": 22, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 21, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 20, + "kind": "list", + "list": [ + { + "id": 11, + "kind": "text", + "text": " range " + }, + { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + { + "id": 12, + "kind": "text", + "text": "0" + }, + { + "id": 13, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 14, + "kind": "text", + "text": ".. " + }, + { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 15, + "kind": "text", + "text": "0" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 28, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 27, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "L2 at 0" + }, + { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + { + "id": 30, + "kind": "text", + "text": " range " + }, + { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + { + "id": 31, + "kind": "text", + "text": "1" + }, + { + "id": 32, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 33, + "kind": "text", + "text": ".. " + }, + { + "id": 35, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 34, + "kind": "text", + "text": "64" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 42, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 47, + "kind": "list", + "list": [ + { + "id": 45, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 63, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 62, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "text", + "text": "L3 at 12" + }, + { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + { + "id": 49, + "kind": "text", + "text": " range " + }, + { + "id": 57, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 56, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 55, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "text", + "text": "0" + }, + { + "id": 51, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 52, + "kind": "text", + "text": ".. " + }, + { + "id": 54, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 53, + "kind": "text", + "text": "31" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 61, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 66, + "kind": "list", + "list": [ + { + "id": 64, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 65, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 82, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 81, + "kind": "list", + "list": [ + { + "id": 67, + "kind": "text", + "text": "L4 at 16" + }, + { + "id": 79, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 78, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 77, + "kind": "list", + "list": [ + { + "id": 68, + "kind": "text", + "text": " range " + }, + { + "id": 76, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 69, + "kind": "text", + "text": "0" + }, + { + "id": 70, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 71, + "kind": "text", + "text": ".. " + }, + { + "id": 73, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 72, + "kind": "text", + "text": "0" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 80, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 85, + "kind": "list", + "list": [ + { + "id": 83, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 84, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 86, + "kind": "text", + "text": "L5 at 16" + }, + { + "id": 98, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 97, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 96, + "kind": "list", + "list": [ + { + "id": 87, + "kind": "text", + "text": " range " + }, + { + "id": 95, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "list", + "list": [ + { + "id": 88, + "kind": "text", + "text": "1" + }, + { + "id": 89, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 90, + "kind": "text", + "text": ".. " + }, + { + "id": 92, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 91, + "kind": "text", + "text": "13" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 99, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 104, + "kind": "list", + "list": [ + { + "id": 102, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 103, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 120, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 119, + "kind": "list", + "list": [ + { + "id": 105, + "kind": "text", + "text": "L6 at 18" + }, + { + "id": 117, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 116, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 115, + "kind": "list", + "list": [ + { + "id": 106, + "kind": "text", + "text": " range " + }, + { + "id": 114, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 113, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 112, + "kind": "list", + "list": [ + { + "id": 107, + "kind": "text", + "text": "0" + }, + { + "id": 108, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 109, + "kind": "text", + "text": ".. " + }, + { + "id": 111, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 110, + "kind": "text", + "text": "71" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 118, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 125, + "kind": "list", + "list": [ + { + "id": 123, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 124, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 128, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 127, + "kind": "list", + "list": [ + { + "id": 126, + "kind": "text", + "text": "end record;" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": true, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/record_rep_clause/long/input.ada b/testsuite/tests/unparsing/record_rep_clause/long/input.ada new file mode 100644 index 000000000..3e539aa5c --- /dev/null +++ b/testsuite/tests/unparsing/record_rep_clause/long/input.ada @@ -0,0 +1 @@ +for VeeeeeeeeeeeeeeeeeeeeeeeeeeeeryLoooooooooooooooooooooooooooooooongRecordRepClause use record L1 at 0 range 0 .. 0; L2 at 0 range 1 .. 64; L3 at 12 range 0 .. 31; L4 at 16 range 0 .. 0; L5 at 16 range 1 .. 13; L6 at 18 range 0 .. 71; end record; diff --git a/testsuite/tests/unparsing/record_rep_clause/long/test.out b/testsuite/tests/unparsing/record_rep_clause/long/test.out new file mode 100644 index 000000000..c15abb114 --- /dev/null +++ b/testsuite/tests/unparsing/record_rep_clause/long/test.out @@ -0,0 +1,9 @@ +for VeeeeeeeeeeeeeeeeeeeeeeeeeeeeryLoooooooooooooooooooooooooooooooongRecordRepClause use + record + L1 at 0 range 0 .. 0; + L2 at 0 range 1 .. 64; + L3 at 12 range 0 .. 31; + L4 at 16 range 0 .. 0; + L5 at 16 range 1 .. 13; + L6 at 18 range 0 .. 71; + end record; diff --git a/testsuite/tests/unparsing/record_rep_clause/long/test.yaml b/testsuite/tests/unparsing/record_rep_clause/long/test.yaml new file mode 100644 index 000000000..4b8b250c5 --- /dev/null +++ b/testsuite/tests/unparsing/record_rep_clause/long/test.yaml @@ -0,0 +1,10 @@ +description: | + This test checks the formatting of a record representation + clause. + It is expected the declaration breaks after `use` keyword; + the record part is indented, `record` and `end record`are + aligned and the component clauses are indented relative to + the `record` keyword and aligned. + +driver: unparser +rule: aspect_clause diff --git a/testsuite/tests/unparsing/record_rep_clause/short/doc-baseline.json b/testsuite/tests/unparsing/record_rep_clause/short/doc-baseline.json new file mode 100644 index 000000000..520768383 --- /dev/null +++ b/testsuite/tests/unparsing/record_rep_clause/short/doc-baseline.json @@ -0,0 +1,995 @@ +{ + "id": 132, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 131, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 1, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "for X2 use" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 130, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 129, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 4, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 6, + "kind": "text", + "text": "record" + }, + { + "id": 122, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 121, + "kind": "list", + "list": [ + { + "id": 9, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 8, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 25, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 24, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "text", + "text": "L1 at 0" + }, + { + "id": 22, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 21, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 20, + "kind": "list", + "list": [ + { + "id": 11, + "kind": "text", + "text": " range " + }, + { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + { + "id": 12, + "kind": "text", + "text": "0" + }, + { + "id": 13, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 14, + "kind": "text", + "text": ".. " + }, + { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 15, + "kind": "text", + "text": "0" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 23, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 28, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 27, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "L2 at 0" + }, + { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + { + "id": 30, + "kind": "text", + "text": " range " + }, + { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + { + "id": 31, + "kind": "text", + "text": "1" + }, + { + "id": 32, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 33, + "kind": "text", + "text": ".. " + }, + { + "id": 35, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 34, + "kind": "text", + "text": "64" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 42, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 47, + "kind": "list", + "list": [ + { + "id": 45, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 63, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 62, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "text", + "text": "L3 at 12" + }, + { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + { + "id": 49, + "kind": "text", + "text": " range " + }, + { + "id": 57, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 56, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 55, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "text", + "text": "0" + }, + { + "id": 51, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 52, + "kind": "text", + "text": ".. " + }, + { + "id": 54, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 53, + "kind": "text", + "text": "31" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 61, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 66, + "kind": "list", + "list": [ + { + "id": 64, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 65, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 82, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 81, + "kind": "list", + "list": [ + { + "id": 67, + "kind": "text", + "text": "L4 at 16" + }, + { + "id": 79, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 78, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 77, + "kind": "list", + "list": [ + { + "id": 68, + "kind": "text", + "text": " range " + }, + { + "id": 76, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 69, + "kind": "text", + "text": "0" + }, + { + "id": 70, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 71, + "kind": "text", + "text": ".. " + }, + { + "id": 73, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 72, + "kind": "text", + "text": "0" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 80, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 85, + "kind": "list", + "list": [ + { + "id": 83, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 84, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 86, + "kind": "text", + "text": "L5 at 16" + }, + { + "id": 98, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 97, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 96, + "kind": "list", + "list": [ + { + "id": 87, + "kind": "text", + "text": " range " + }, + { + "id": 95, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "list", + "list": [ + { + "id": 88, + "kind": "text", + "text": "1" + }, + { + "id": 89, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 90, + "kind": "text", + "text": ".. " + }, + { + "id": 92, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 91, + "kind": "text", + "text": "13" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 99, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 104, + "kind": "list", + "list": [ + { + "id": 102, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 103, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 120, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 119, + "kind": "list", + "list": [ + { + "id": 105, + "kind": "text", + "text": "L6 at 18" + }, + { + "id": 117, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 116, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 115, + "kind": "list", + "list": [ + { + "id": 106, + "kind": "text", + "text": " range " + }, + { + "id": 114, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 113, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 112, + "kind": "list", + "list": [ + { + "id": 107, + "kind": "text", + "text": "0" + }, + { + "id": 108, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 109, + "kind": "text", + "text": ".. " + }, + { + "id": 111, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 110, + "kind": "text", + "text": "71" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 118, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 125, + "kind": "list", + "list": [ + { + "id": 123, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 124, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 128, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 127, + "kind": "list", + "list": [ + { + "id": 126, + "kind": "text", + "text": "end record;" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": true, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/record_rep_clause/short/input.ada b/testsuite/tests/unparsing/record_rep_clause/short/input.ada new file mode 100644 index 000000000..b34845720 --- /dev/null +++ b/testsuite/tests/unparsing/record_rep_clause/short/input.ada @@ -0,0 +1 @@ +for X2 use record L1 at 0 range 0 .. 0; L2 at 0 range 1 .. 64; L3 at 12 range 0 .. 31; L4 at 16 range 0 .. 0; L5 at 16 range 1 .. 13; L6 at 18 range 0 .. 71; end record; diff --git a/testsuite/tests/unparsing/record_rep_clause/short/test.out b/testsuite/tests/unparsing/record_rep_clause/short/test.out new file mode 100644 index 000000000..e474bacc7 --- /dev/null +++ b/testsuite/tests/unparsing/record_rep_clause/short/test.out @@ -0,0 +1,9 @@ +for X2 use + record + L1 at 0 range 0 .. 0; + L2 at 0 range 1 .. 64; + L3 at 12 range 0 .. 31; + L4 at 16 range 0 .. 0; + L5 at 16 range 1 .. 13; + L6 at 18 range 0 .. 71; + end record; diff --git a/testsuite/tests/unparsing/record_rep_clause/short/test.yaml b/testsuite/tests/unparsing/record_rep_clause/short/test.yaml new file mode 100644 index 000000000..4b8b250c5 --- /dev/null +++ b/testsuite/tests/unparsing/record_rep_clause/short/test.yaml @@ -0,0 +1,10 @@ +description: | + This test checks the formatting of a record representation + clause. + It is expected the declaration breaks after `use` keyword; + the record part is indented, `record` and `end record`are + aligned and the component clauses are indented relative to + the `record` keyword and aligned. + +driver: unparser +rule: aspect_clause