diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 83a521465..256fd56a0 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -2049,6 +2049,33 @@ } } }, + "TypeAccessDef": { + "node": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_has_not_null" + }, + { + "kind": "text", + "text": "access" + }, + { + "kind": "recurse_field", + "field": "f_has_all" + }, + { + "kind": "recurse_field", + "field": "f_has_constant" + }, + { + "kind": "recurse_field", + "field": "f_subtype_indication" + } + ] + } + }, "UnconstrainedArrayIndices": { "node": { "kind": "align", diff --git a/testsuite/tests/unparsing/access_type_def/access_all/doc-baseline.json b/testsuite/tests/unparsing/access_type_def/access_all/doc-baseline.json new file mode 100644 index 000000000..8f6c39088 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/access_all/doc-baseline.json @@ -0,0 +1,138 @@ +{ + "id": 17, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 16, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "type Aaaaaaaa" + }, + { + "id": 2, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 1, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 4, + "kind": "text", + "text": "is" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 14, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 13, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 12, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 11, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 9, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "text", + "text": "access all Bbbbbbbbbbbbbbb" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 15, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/access_type_def/access_all/input.ada b/testsuite/tests/unparsing/access_type_def/access_all/input.ada new file mode 100644 index 000000000..505219796 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/access_all/input.ada @@ -0,0 +1 @@ +type Aaaaaaaa is access all Bbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/access_all/test.out b/testsuite/tests/unparsing/access_type_def/access_all/test.out new file mode 100644 index 000000000..505219796 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/access_all/test.out @@ -0,0 +1 @@ +type Aaaaaaaa is access all Bbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/access_all/test.yaml b/testsuite/tests/unparsing/access_type_def/access_all/test.yaml new file mode 100644 index 000000000..8c148ee4e --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/access_all/test.yaml @@ -0,0 +1,7 @@ +description: | + This test checks the formatting of a simple access all + type declaration. + It is expected the declaration stays on a single line. + +driver: unparser +rule: type_decl diff --git a/testsuite/tests/unparsing/access_type_def/long_subtype_indication/doc-baseline.json b/testsuite/tests/unparsing/access_type_def/long_subtype_indication/doc-baseline.json new file mode 100644 index 000000000..ff45dd6f1 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/long_subtype_indication/doc-baseline.json @@ -0,0 +1,138 @@ +{ + "id": 17, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 16, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "type Aaaaaaaa" + }, + { + "id": 2, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 1, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 4, + "kind": "text", + "text": "is" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 14, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 13, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 12, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 11, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 9, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "text", + "text": "access BBBBBBBBBBBbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 15, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/access_type_def/long_subtype_indication/input.ada b/testsuite/tests/unparsing/access_type_def/long_subtype_indication/input.ada new file mode 100644 index 000000000..5b4039939 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/long_subtype_indication/input.ada @@ -0,0 +1 @@ +type Aaaaaaaa is access BBBBBBBBBBBbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/long_subtype_indication/test.out b/testsuite/tests/unparsing/access_type_def/long_subtype_indication/test.out new file mode 100644 index 000000000..00eceb746 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/long_subtype_indication/test.out @@ -0,0 +1,2 @@ +type Aaaaaaaa is + access BBBBBBBBBBBbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/long_subtype_indication/test.yaml b/testsuite/tests/unparsing/access_type_def/long_subtype_indication/test.yaml new file mode 100644 index 000000000..9e7675bf5 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/long_subtype_indication/test.yaml @@ -0,0 +1,8 @@ +description: | + This test checks the formatting of a simple access type declaration + having a long subtype indication. + It is expected the declaration be splitted after `is` keyword and + the new line be indented with a line continuation indentation. + +driver: unparser +rule: type_decl diff --git a/testsuite/tests/unparsing/access_type_def/long_type_name/doc-baseline.json b/testsuite/tests/unparsing/access_type_def/long_type_name/doc-baseline.json new file mode 100644 index 000000000..55116413e --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/long_type_name/doc-baseline.json @@ -0,0 +1,138 @@ +{ + "id": 17, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 16, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "type Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + { + "id": 2, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 1, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 4, + "kind": "text", + "text": "is" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 14, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 13, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 12, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 11, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 9, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "text", + "text": "access Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 15, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/access_type_def/long_type_name/input.ada b/testsuite/tests/unparsing/access_type_def/long_type_name/input.ada new file mode 100644 index 000000000..ad75d12b8 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/long_type_name/input.ada @@ -0,0 +1 @@ +type Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa is access Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/long_type_name/test.out b/testsuite/tests/unparsing/access_type_def/long_type_name/test.out new file mode 100644 index 000000000..052aefcfb --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/long_type_name/test.out @@ -0,0 +1,2 @@ +type Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa is + access Bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/long_type_name/test.yaml b/testsuite/tests/unparsing/access_type_def/long_type_name/test.yaml new file mode 100644 index 000000000..3d695ad8d --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/long_type_name/test.yaml @@ -0,0 +1,8 @@ +description: | + This test checks the formatting of a simple access type declaration + having a long type name. + It is expected the declaration be splitted after `is` keyword and + the new line be indented with a line continuation indentation. + +driver: unparser +rule: type_decl diff --git a/testsuite/tests/unparsing/access_type_def/not_null_access/doc-baseline.json b/testsuite/tests/unparsing/access_type_def/not_null_access/doc-baseline.json new file mode 100644 index 000000000..ed2a6ad6f --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/not_null_access/doc-baseline.json @@ -0,0 +1,138 @@ +{ + "id": 17, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 16, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "type Aaaaaaaa" + }, + { + "id": 2, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 1, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 4, + "kind": "text", + "text": "is" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 14, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 13, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 12, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 11, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 9, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "text", + "text": "not null access Bbbbbbbbbbbbbbb" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 15, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/access_type_def/not_null_access/input.ada b/testsuite/tests/unparsing/access_type_def/not_null_access/input.ada new file mode 100644 index 000000000..400264707 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/not_null_access/input.ada @@ -0,0 +1 @@ +type Aaaaaaaa is not null access Bbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/not_null_access/test.out b/testsuite/tests/unparsing/access_type_def/not_null_access/test.out new file mode 100644 index 000000000..400264707 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/not_null_access/test.out @@ -0,0 +1 @@ +type Aaaaaaaa is not null access Bbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/not_null_access/test.yaml b/testsuite/tests/unparsing/access_type_def/not_null_access/test.yaml new file mode 100644 index 000000000..3cb9fa84b --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/not_null_access/test.yaml @@ -0,0 +1,7 @@ +description: | + This test checks the formatting of a simple not null access + type declaration. + It is expected the declaration stays on a single line. + +driver: unparser +rule: type_decl diff --git a/testsuite/tests/unparsing/access_type_def/simple_access/doc-baseline.json b/testsuite/tests/unparsing/access_type_def/simple_access/doc-baseline.json new file mode 100644 index 000000000..375d63e0d --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/simple_access/doc-baseline.json @@ -0,0 +1,138 @@ +{ + "id": 17, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 16, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "type Aaaaaaaa" + }, + { + "id": 2, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 1, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 4, + "kind": "text", + "text": "is" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 14, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 13, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 12, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 11, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 9, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "text", + "text": "access Bbbbbbbbbbbbbbb" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 15, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/access_type_def/simple_access/input.ada b/testsuite/tests/unparsing/access_type_def/simple_access/input.ada new file mode 100644 index 000000000..25742ae77 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/simple_access/input.ada @@ -0,0 +1 @@ +type Aaaaaaaa is access Bbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/simple_access/test.out b/testsuite/tests/unparsing/access_type_def/simple_access/test.out new file mode 100644 index 000000000..25742ae77 --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/simple_access/test.out @@ -0,0 +1 @@ +type Aaaaaaaa is access Bbbbbbbbbbbbbbb; diff --git a/testsuite/tests/unparsing/access_type_def/simple_access/test.yaml b/testsuite/tests/unparsing/access_type_def/simple_access/test.yaml new file mode 100644 index 000000000..6cfdc23bd --- /dev/null +++ b/testsuite/tests/unparsing/access_type_def/simple_access/test.yaml @@ -0,0 +1,6 @@ +description: | + This test checks the formatting of a simple access type declaration. + It is expected the declaration stays on a single line. + +driver: unparser +rule: type_decl