diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 15aae7c79..eed395864 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -1021,6 +1021,88 @@ ] } }, + "EntryBody": { + "node": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "entry" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_entry_name" + }, + { + "kind": "recurse_field", + "field": "f_index_spec" + }, + { + "kind": "recurse_field", + "field": "f_params" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + }, + "whitespace", + { + "kind": "text", + "text": "when" + }, + { + "kind": "recurse_field", + "field": "f_barrier" + }, + "hardlineWithoutBreakParent", + { + "kind": "text", + "text": "is" + }, + { + "kind": "recurse_field", + "field": "f_decls" + }, + { + "kind": "text", + "text": "begin" + }, + { + "kind": "recurse_field", + "field": "f_stmts" + }, + "hardlineWithoutBreakParent", + { + "kind": "text", + "text": "end" + }, + { + "kind": "recurse_field", + "field": "f_end_name" + }, + { + "kind": "text", + "text": ";" + } + ] + }, + "fields": { + "f_aspects": [ + "hardline", + "recurse" + ], + "f_decls": [ + { + "kind": "indent", + "contents": [ + "recurse" + ] + }, + "hardlineWithoutBreakParent" + ] + } + }, "EnumLiteralDeclList": { "sep": [ "recurse", @@ -2905,6 +2987,70 @@ "hardline" ] }, + "ProtectedBody": { + "node": [ + { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "protected" + }, + "whitespace", + { + "kind": "text", + "text": "body" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_name" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + }, + "line", + { + "kind": "text", + "text": "is" + } + ] + }, + { + "kind": "indent", + "contents": [ + { + "kind": "recurse_field", + "field": "f_decls" + } + ] + }, + "hardline", + { + "kind": "text", + "text": "end" + }, + { + "kind": "recurse_field", + "field": "f_end_name" + }, + { + "kind": "text", + "text": ";" + } + ], + "fields": { + "f_aspects": { + "kind": "align", + "width": 2, + "contents": [ + "hardline", + "recurse" + ] + } + } + }, "ProtectedDef": { "node": { "kind": "group", @@ -3140,6 +3286,63 @@ "field": "f_range" } }, + "SingleProtectedDecl": { + "node": { + "kind": "group", + "document": [ + { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "protected" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_name" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + }, + "line", + { + "kind": "text", + "text": "is" + } + ] + }, + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_interfaces" + } + ] + }, + { + "kind": "recurse_field", + "field": "f_definition" + }, + { + "kind": "text", + "text": ";" + } + ] + }, + "fields": { + "f_aspects": { + "kind": "align", + "width": 2, + "contents": [ + "hardline", + "recurse" + ] + } + } + }, "StmtList": { "sep": [ "recurse", diff --git a/testsuite/tests/unparsing/protected_body/simple_body/doc-baseline.json b/testsuite/tests/unparsing/protected_body/simple_body/doc-baseline.json new file mode 100644 index 000000000..242840464 --- /dev/null +++ b/testsuite/tests/unparsing/protected_body/simple_body/doc-baseline.json @@ -0,0 +1,1429 @@ +{ + "id": 182, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "protected body Shared_Array" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 2, + "kind": "text", + "text": "is" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 177, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 176, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 175, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 6, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 80, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 79, + "kind": "list", + "list": [ + { + "id": 45, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "text", + "text": "function Component" + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 41, + "kind": "list", + "list": [ + { + "id": 9, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 34, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 33, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "text", + "text": "(" + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 30, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 29, + "kind": "list", + "list": [ + { + "id": 21, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 20, + "kind": "list", + "list": [ + { + "id": 12, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 11, + "kind": "text", + "text": "N" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 13, + "kind": "text", + "text": " :" + }, + { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 18, + "kind": "list", + "list": [ + { + "id": 14, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 17, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 16, + "kind": "list", + "list": [ + { + "id": 15, + "kind": "text", + "text": "in Index" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 28, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 24, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 23, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 22, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 27, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 32, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 40, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 39, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 38, + "kind": "list", + "list": [ + { + "id": 36, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 37, + "kind": "text", + "text": "return Item" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 47, + "kind": "text", + "text": "is" + }, + { + "id": 49, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 48, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 51, + "kind": "text", + "text": "begin" + }, + { + "id": 76, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 75, + "kind": "list", + "list": [ + { + "id": 74, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 73, + "kind": "list", + "list": [ + { + "id": 54, + "kind": "list", + "list": [ + { + "id": 52, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 72, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 71, + "kind": "command", + "command": { + "command": "fill", + "parts": { + "id": 70, + "kind": "list", + "list": [ + { + "id": 55, + "kind": "text", + "text": "return" + }, + { + "id": 56, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 67, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "text", + "text": "Table" + }, + { + "id": 58, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 59, + "kind": "text", + "text": "(" + }, + { + "id": 63, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 62, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 61, + "kind": "list", + "list": [ + { + "id": 60, + "kind": "text", + "text": "N" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "text", + "text": ")" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + }, + { + "id": 69, + "kind": "text", + "text": ";" + } + ] + } + } + } + } + } + ] + } + } + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 78, + "kind": "text", + "text": "end Component;" + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 83, + "kind": "list", + "list": [ + { + "id": 81, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 82, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 174, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 173, + "kind": "list", + "list": [ + { + "id": 139, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 138, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 137, + "kind": "list", + "list": [ + { + "id": 84, + "kind": "text", + "text": "procedure Set_Component" + }, + { + "id": 136, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 135, + "kind": "list", + "list": [ + { + "id": 85, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 134, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 133, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 132, + "kind": "list", + "list": [ + { + "id": 86, + "kind": "text", + "text": "(" + }, + { + "id": 130, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 129, + "kind": "list", + "list": [ + { + "id": 106, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 105, + "kind": "list", + "list": [ + { + "id": 97, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 96, + "kind": "list", + "list": [ + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "text", + "text": "N" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 89, + "kind": "text", + "text": " :" + }, + { + "id": 95, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 94, + "kind": "list", + "list": [ + { + "id": 90, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 93, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 91, + "kind": "text", + "text": "in Index" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 104, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 100, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 99, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 98, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 103, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 102, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 101, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 107, + "kind": "text", + "text": ";" + }, + { + "id": 108, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 128, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 127, + "kind": "list", + "list": [ + { + "id": 119, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 118, + "kind": "list", + "list": [ + { + "id": 110, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 109, + "kind": "text", + "text": "E" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 111, + "kind": "text", + "text": " :" + }, + { + "id": 117, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 116, + "kind": "list", + "list": [ + { + "id": 112, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 115, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 114, + "kind": "list", + "list": [ + { + "id": 113, + "kind": "text", + "text": "in Item" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 126, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 122, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 121, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 120, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 125, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 124, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 123, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 131, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 140, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 141, + "kind": "text", + "text": "is" + }, + { + "id": 143, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 142, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 144, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 145, + "kind": "text", + "text": "begin" + }, + { + "id": 170, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 169, + "kind": "list", + "list": [ + { + "id": 168, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 167, + "kind": "list", + "list": [ + { + "id": 148, + "kind": "list", + "list": [ + { + "id": 146, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 147, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 166, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 165, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 164, + "kind": "list", + "list": [ + { + "id": 160, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 159, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 158, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 157, + "kind": "list", + "list": [ + { + "id": 149, + "kind": "text", + "text": "Table" + }, + { + "id": 150, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 151, + "kind": "text", + "text": "(" + }, + { + "id": 155, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 154, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 153, + "kind": "list", + "list": [ + { + "id": 152, + "kind": "text", + "text": "N" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 156, + "kind": "text", + "text": ")" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + }, + { + "id": 161, + "kind": "text", + "text": " :=" + }, + { + "id": 162, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 163, + "kind": "text", + "text": "E;" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + } + } + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 171, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 172, + "kind": "text", + "text": "end Set_Component;" + } + ] + }, + "break": true, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + } + } + }, + { + "id": 180, + "kind": "list", + "list": [ + { + "id": 178, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 179, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 181, + "kind": "text", + "text": "end Shared_Array;" + } + ] +} diff --git a/testsuite/tests/unparsing/protected_body/simple_body/input.ada b/testsuite/tests/unparsing/protected_body/simple_body/input.ada new file mode 100644 index 000000000..923b934ec --- /dev/null +++ b/testsuite/tests/unparsing/protected_body/simple_body/input.ada @@ -0,0 +1,11 @@ +protected body Shared_Array is + function Component(N : in Index) return Item is + begin + return Table(N); + end Component; + + procedure Set_Component(N : in Index; E : in Item) is + begin + Table(N) := E; + end Set_Component; +end Shared_Array; diff --git a/testsuite/tests/unparsing/protected_body/simple_body/test.out b/testsuite/tests/unparsing/protected_body/simple_body/test.out new file mode 100644 index 000000000..7887a5184 --- /dev/null +++ b/testsuite/tests/unparsing/protected_body/simple_body/test.out @@ -0,0 +1,12 @@ +protected body Shared_Array is + function Component (N : in Index) return Item + is + begin + return Table (N); + end Component; + procedure Set_Component (N : in Index; E : in Item) + is + begin + Table (N) := E; + end Set_Component; +end Shared_Array; diff --git a/testsuite/tests/unparsing/protected_body/simple_body/test.yaml b/testsuite/tests/unparsing/protected_body/simple_body/test.yaml new file mode 100644 index 000000000..69db831a2 --- /dev/null +++ b/testsuite/tests/unparsing/protected_body/simple_body/test.yaml @@ -0,0 +1,6 @@ +description: | + This test checks the formatting of a protected type body. + It is expected that the body declarations be indented. + +driver: unparser +rule: protected_body diff --git a/testsuite/tests/unparsing/protected_body/with_entry/doc-baseline.json b/testsuite/tests/unparsing/protected_body/with_entry/doc-baseline.json new file mode 100644 index 000000000..bd5d3b4e5 --- /dev/null +++ b/testsuite/tests/unparsing/protected_body/with_entry/doc-baseline.json @@ -0,0 +1,538 @@ +{ + "id": 71, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "protected body Resource" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 2, + "kind": "text", + "text": "is" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 65, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 64, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 6, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "text", + "text": "entry Seize when not Busy" + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 10, + "kind": "text", + "text": "is" + }, + { + "id": 12, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 11, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 13, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 14, + "kind": "text", + "text": "begin" + }, + { + "id": 27, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 26, + "kind": "list", + "list": [ + { + "id": 25, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 24, + "kind": "list", + "list": [ + { + "id": 17, + "kind": "list", + "list": [ + { + "id": 15, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 16, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 23, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 18, + "kind": "text", + "text": "Busy :=" + }, + { + "id": 19, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 20, + "kind": "text", + "text": "True;" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + } + } + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 29, + "kind": "text", + "text": "end Seize;" + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 34, + "kind": "list", + "list": [ + { + "id": 32, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 63, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 62, + "kind": "list", + "list": [ + { + "id": 40, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 39, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 38, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "text", + "text": "procedure Release" + }, + { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 41, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 42, + "kind": "text", + "text": "is" + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 43, + "kind": "list", + "list": [ + ] + } + } + }, + { + "id": 45, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 46, + "kind": "text", + "text": "begin" + }, + { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 49, + "kind": "list", + "list": [ + { + "id": 47, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 48, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 53, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "text", + "text": "Busy :=" + }, + { + "id": 51, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 52, + "kind": "text", + "text": "False;" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + } + } + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 60, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 61, + "kind": "text", + "text": "end Release;" + } + ] + }, + "break": true, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + } + } + }, + { + "id": 69, + "kind": "list", + "list": [ + { + "id": 67, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 70, + "kind": "text", + "text": "end Resource;" + } + ] +} diff --git a/testsuite/tests/unparsing/protected_body/with_entry/input.ada b/testsuite/tests/unparsing/protected_body/with_entry/input.ada new file mode 100644 index 000000000..7bbfbb26c --- /dev/null +++ b/testsuite/tests/unparsing/protected_body/with_entry/input.ada @@ -0,0 +1,11 @@ +protected body Resource is + entry Seize when not Busy is + begin + Busy := True; + end Seize; + + procedure Release is + begin + Busy := False; + end Release; +end Resource; diff --git a/testsuite/tests/unparsing/protected_body/with_entry/test.out b/testsuite/tests/unparsing/protected_body/with_entry/test.out new file mode 100644 index 000000000..c3edd625b --- /dev/null +++ b/testsuite/tests/unparsing/protected_body/with_entry/test.out @@ -0,0 +1,12 @@ +protected body Resource is + entry Seize when not Busy + is + begin + Busy := True; + end Seize; + procedure Release + is + begin + Busy := False; + end Release; +end Resource; diff --git a/testsuite/tests/unparsing/protected_body/with_entry/test.yaml b/testsuite/tests/unparsing/protected_body/with_entry/test.yaml new file mode 100644 index 000000000..69db831a2 --- /dev/null +++ b/testsuite/tests/unparsing/protected_body/with_entry/test.yaml @@ -0,0 +1,6 @@ +description: | + This test checks the formatting of a protected type body. + It is expected that the body declarations be indented. + +driver: unparser +rule: protected_body diff --git a/testsuite/tests/unparsing/single_protected_decl/doc-baseline.json b/testsuite/tests/unparsing/single_protected_decl/doc-baseline.json new file mode 100644 index 000000000..af9805d72 --- /dev/null +++ b/testsuite/tests/unparsing/single_protected_decl/doc-baseline.json @@ -0,0 +1,1334 @@ +{ + "id": 169, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 168, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "protected Shared_Array" + }, + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 2, + "kind": "text", + "text": "is" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 6, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 5, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 166, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 165, + "kind": "list", + "list": [ + { + "id": 119, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 118, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 117, + "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": 52, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 51, + "kind": "list", + "list": [ + { + "id": 49, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 48, + "kind": "list", + "list": [ + { + "id": 47, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 46, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 45, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "text", + "text": "function Component" + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 11, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 35, + "kind": "list", + "list": [ + { + "id": 12, + "kind": "text", + "text": "(" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 32, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 31, + "kind": "list", + "list": [ + { + "id": 23, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 22, + "kind": "list", + "list": [ + { + "id": 14, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 13, + "kind": "text", + "text": "N" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 15, + "kind": "text", + "text": " :" + }, + { + "id": 21, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 20, + "kind": "list", + "list": [ + { + "id": 16, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 19, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 18, + "kind": "list", + "list": [ + { + "id": 17, + "kind": "text", + "text": "in Index" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 30, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 26, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 25, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 24, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 29, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 28, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 27, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 34, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 41, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 40, + "kind": "list", + "list": [ + { + "id": 38, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 39, + "kind": "text", + "text": "return Item" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 50, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 55, + "kind": "list", + "list": [ + { + "id": 53, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 54, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 116, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 115, + "kind": "list", + "list": [ + { + "id": 113, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 112, + "kind": "list", + "list": [ + { + "id": 111, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 110, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 109, + "kind": "list", + "list": [ + { + "id": 56, + "kind": "text", + "text": "procedure Set_Component" + }, + { + "id": 108, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 107, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 106, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 105, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 104, + "kind": "list", + "list": [ + { + "id": 58, + "kind": "text", + "text": "(" + }, + { + "id": 102, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 101, + "kind": "list", + "list": [ + { + "id": 78, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 77, + "kind": "list", + "list": [ + { + "id": 69, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 68, + "kind": "list", + "list": [ + { + "id": 60, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 59, + "kind": "text", + "text": "N" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 61, + "kind": "text", + "text": " :" + }, + { + "id": 67, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 66, + "kind": "list", + "list": [ + { + "id": 62, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 65, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 64, + "kind": "list", + "list": [ + { + "id": 63, + "kind": "text", + "text": "in Index" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 76, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 72, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 71, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 70, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 75, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 74, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 73, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 79, + "kind": "text", + "text": ";" + }, + { + "id": 80, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 100, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 99, + "kind": "list", + "list": [ + { + "id": 91, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 90, + "kind": "list", + "list": [ + { + "id": 82, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 81, + "kind": "text", + "text": "E" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 83, + "kind": "text", + "text": " :" + }, + { + "id": 89, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 88, + "kind": "list", + "list": [ + { + "id": 84, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 87, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 86, + "kind": "list", + "list": [ + { + "id": 85, + "kind": "text", + "text": "in Item" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 98, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 94, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 93, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 92, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 97, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 96, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 95, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 103, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 114, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + } + } + }, + { + "id": 122, + "kind": "list", + "list": [ + { + "id": 120, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 121, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 123, + "kind": "text", + "text": "private" + }, + { + "id": 160, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 159, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 158, + "kind": "list", + "list": [ + { + "id": 126, + "kind": "list", + "list": [ + { + "id": 124, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 125, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 157, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 156, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 155, + "kind": "list", + "list": [ + { + "id": 128, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 127, + "kind": "text", + "text": "Table" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 129, + "kind": "text", + "text": " :" + }, + { + "id": 130, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 154, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 153, + "kind": "list", + "list": [ + { + "id": 134, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 133, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 132, + "kind": "list", + "list": [ + { + "id": 131, + "kind": "text", + "text": "Item_Array(Index)" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 135, + "kind": "text", + "text": " :=" + }, + { + "id": 136, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 151, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 150, + "kind": "list", + "list": [ + { + "id": 137, + "kind": "text", + "text": "(" + }, + { + "id": 148, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 147, + "kind": "list", + "list": [ + { + "id": 146, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 145, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 144, + "kind": "list", + "list": [ + { + "id": 141, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 140, + "kind": "list", + "list": [ + { + "id": 138, + "kind": "text", + "text": "others =>" + }, + { + "id": 139, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + } + ] + } + } + }, + { + "id": 143, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 142, + "kind": "text", + "text": "Null_Item" + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + } + } + }, + { + "id": 149, + "kind": "text", + "text": ")" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 152, + "kind": "text", + "text": ";" + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + } + } + }, + { + "id": 163, + "kind": "list", + "list": [ + { + "id": 161, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 162, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 164, + "kind": "text", + "text": "end Shared_Array" + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 167, + "kind": "text", + "text": ";" + } + ] + }, + "break": true, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/single_protected_decl/input.ada b/testsuite/tests/unparsing/single_protected_decl/input.ada new file mode 100644 index 000000000..3a5d18a20 --- /dev/null +++ b/testsuite/tests/unparsing/single_protected_decl/input.ada @@ -0,0 +1,6 @@ +protected Shared_Array is + function Component (N : in Index) return Item; + procedure Set_Component(N : in Index; E : in Item); +private + Table : Item_Array(Index) := (others => Null_Item); +end Shared_Array; \ No newline at end of file diff --git a/testsuite/tests/unparsing/single_protected_decl/test.out b/testsuite/tests/unparsing/single_protected_decl/test.out new file mode 100644 index 000000000..e02f8ade8 --- /dev/null +++ b/testsuite/tests/unparsing/single_protected_decl/test.out @@ -0,0 +1,6 @@ +protected Shared_Array is + function Component (N : in Index) return Item; + procedure Set_Component (N : in Index; E : in Item); +private + Table : Item_Array(Index) := (others => Null_Item); +end Shared_Array; diff --git a/testsuite/tests/unparsing/single_protected_decl/test.yaml b/testsuite/tests/unparsing/single_protected_decl/test.yaml new file mode 100644 index 000000000..105a71588 --- /dev/null +++ b/testsuite/tests/unparsing/single_protected_decl/test.yaml @@ -0,0 +1,9 @@ +description: | + This test checks the formatting of a single protected declaration + with private and public part. + It is expected the declaration be formatted by aligning `protected`, + `private` and `end` keywords and the contents of public and private + parts are indented. + +driver: unparser +rule: protected_decl