diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 22e0c5942..19659301a 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -1,5 +1,111 @@ { "node_configs": { + "AcceptStmt": { + "node": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "accept" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_body_decl" + }, + { + "kind": "recurse_field", + "field": "f_entry_index_expr" + }, + { + "kind": "recurse_field", + "field": "f_params" + }, + { + "kind": "text", + "text": ";" + } + ] + } + }, + "AcceptStmtBody": { + "node": [ + { + "kind": "recurse_field", + "field": "f_name" + } + ] + }, + "AcceptStmtWithStmts": { + "node": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "accept" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_body_decl" + }, + { + "kind": "recurse_field", + "field": "f_entry_index_expr" + }, + { + "kind": "recurse_field", + "field": "f_params" + }, + "line", + { + "kind": "text", + "text": "do" + }, + { + "kind": "recurse_field", + "field": "f_stmts" + }, + "hardlineWithoutBreakParent", + { + "kind": "text", + "text": "end" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_end_name" + }, + { + "kind": "text", + "text": ";" + } + ] + }, + "fields": { + "f_entry_index_expr": [ + "whitespace", + { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "(" + }, + "recurse", + { + "kind": "text", + "text": ")" + } + ] + } + ], + "f_params": [ + "whitespace", + "recurse" + ] + } + }, "AdaNodeList": { "sep": [ "recurse", @@ -1284,6 +1390,99 @@ ] } }, + "EntryDecl": { + "node": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_overriding" + }, + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_spec" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + } + ] + }, + { + "kind": "text", + "text": ";" + } + ] + }, + "fields": { + "f_aspects": [ + "hardline", + "recurse" + ] + } + }, + "EntrySpec": { + "node": { + "kind": "align", + "width": 2, + "contents": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "entry" + }, + { + "kind": "recurse_field", + "field": "f_entry_name" + }, + { + "kind": "recurse_field", + "field": "f_family_type" + }, + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_entry_params" + } + ] + } + ] + } + }, + "fields": { + "f_family_type": [ + "whitespace", + { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "(" + }, + "recurse", + { + "kind": "text", + "text": ")" + } + ] + } + ], + "f_entry_params": { + "kind": "ifEmpty", + "then": "recurse", + "else": [ + "line", + "recurse" + ] + } + } + }, "EnumLiteralDeclList": { "sep": [ "recurse", @@ -3897,6 +4096,63 @@ } } }, + "SingleTaskDecl": { + "node": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "task" + }, + { + "kind": "recurse_field", + "field": "f_task_type" + }, + { + "kind": "text", + "text": ";" + } + ] + } + }, + "SingleTaskTypeDecl": { + "node": { + "kind": "group", + "document": [ + { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_name" + }, + { + "kind": "recurse_field", + "field": "f_discriminants" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + } + ] + }, + { + "kind": "recurse_field", + "field": "f_definition" + } + ] + }, + "fields": { + "f_aspects": { + "kind": "align", + "width": 2, + "contents": [ + "hardline", + "recurse" + ] + } + } + }, "StmtList": { "sep": [ "recurse", @@ -4126,6 +4382,210 @@ ] } }, + "TaskBody": { + "node": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "task" + }, + "whitespace", + { + "kind": "text", + "text": "body" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_name" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + }, + "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" + ] + } + }, + "TaskDef": { + "node": { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "is" + }, + { + "kind": "recurse_field", + "field": "f_interfaces" + }, + { + "kind": "indent", + "contents": [ + { + "kind": "recurse_field", + "field": "f_public_part" + } + ] + }, + "hardline", + { + "kind": "recurse_field", + "field": "f_private_part" + }, + { + "kind": "text", + "text": "end" + }, + { + "kind": "recurse_field", + "field": "f_end_name" + } + ] + }, + "fields": { + "f_interfaces": { + "kind": "ifEmpty", + "then": "recurse", + "else": [ + { + "kind": "indent", + "contents": "recurse" + }, + "hardline" + ] + }, + "f_private_part": { + "kind": "ifEmpty", + "then": "recurse", + "else": [ + { + "kind": "indent", + "contents": "recurse" + }, + "hardline" + ] + }, + "f_end_name": { + "kind": "ifEmpty", + "then": "recurse", + "else": [ + "whitespace", + { + "kind": "indent", + "contents": "recurse" + } + ] + } + } + }, + "TaskTypeDecl": { + "node": { + "kind": "group", + "document": [ + { + "kind": "group", + "document": [ + { + "kind": "text", + "text": "task" + }, + "whitespace", + { + "kind": "text", + "text": "type" + }, + "whitespace", + { + "kind": "recurse_field", + "field": "f_name" + }, + { + "kind": "recurse_field", + "field": "f_discriminants" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + } + ] + }, + "line", + { + "kind": "recurse_field", + "field": "f_definition" + }, + { + "kind": "text", + "text": ";" + } + ] + }, + "fields": { + "f_discriminants": { + "kind": "align", + "width": 2, + "contents": "recurse" + }, + "f_aspects": { + "kind": "ifEmpty", + "then": "recurse", + "else": { + "kind": "align", + "width": 2, + "contents": [ + "hardlineWithoutBreakParent", + "recurse" + ] + } + } + } + }, "TypeAccessDef": { "node": { "kind": "group", diff --git a/testsuite/tests/unparsing/entry_decl/entries_family/doc-baseline.json b/testsuite/tests/unparsing/entry_decl/entries_family/doc-baseline.json new file mode 100644 index 000000000..083b576c2 --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/entries_family/doc-baseline.json @@ -0,0 +1,325 @@ +{ + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 34, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 33, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "entry Request " + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 2, + "kind": "list", + "list": [ + { + "id": 1, + "kind": "text", + "text": "(Level)" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 32, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 31, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 30, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 29, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 28, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "text", + "text": "(" + }, + { + "id": 26, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 25, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 24, + "kind": "list", + "list": [ + { + "id": 16, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 15, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 6, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 8, + "kind": "text", + "text": " :" + }, + { + "id": 14, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 13, + "kind": "list", + "list": [ + { + "id": 9, + "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": "text", + "text": "Item" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 23, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "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": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 27, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 38, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/entry_decl/entries_family/input.ada b/testsuite/tests/unparsing/entry_decl/entries_family/input.ada new file mode 100644 index 000000000..51f3115e5 --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/entries_family/input.ada @@ -0,0 +1 @@ +entry Request(Level)(D : Item); diff --git a/testsuite/tests/unparsing/entry_decl/entries_family/test.out b/testsuite/tests/unparsing/entry_decl/entries_family/test.out new file mode 100644 index 000000000..5695bede8 --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/entries_family/test.out @@ -0,0 +1 @@ +entry Request (Level) (D : Item); diff --git a/testsuite/tests/unparsing/entry_decl/entries_family/test.yaml b/testsuite/tests/unparsing/entry_decl/entries_family/test.yaml new file mode 100644 index 000000000..75bafad19 --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/entries_family/test.yaml @@ -0,0 +1,6 @@ +description: | + This test checks the formatting of a family of entries declaration. + It is expected the declaration stays on a single line. + +driver: unparser +rule: entry_decl diff --git a/testsuite/tests/unparsing/entry_decl/simple_entry/doc-baseline.json b/testsuite/tests/unparsing/entry_decl/simple_entry/doc-baseline.json new file mode 100644 index 000000000..54383782c --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/simple_entry/doc-baseline.json @@ -0,0 +1,85 @@ +{ + "id": 10, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 9, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 6, + "kind": "list", + "list": [ + { + "id": 5, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "entry Shut_Down" + }, + { + "id": 2, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 1, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 8, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/entry_decl/simple_entry/input.ada b/testsuite/tests/unparsing/entry_decl/simple_entry/input.ada new file mode 100644 index 000000000..443c374b3 --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/simple_entry/input.ada @@ -0,0 +1 @@ +entry Shut_Down; diff --git a/testsuite/tests/unparsing/entry_decl/simple_entry/test.out b/testsuite/tests/unparsing/entry_decl/simple_entry/test.out new file mode 100644 index 000000000..443c374b3 --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/simple_entry/test.out @@ -0,0 +1 @@ +entry Shut_Down; diff --git a/testsuite/tests/unparsing/entry_decl/simple_entry/test.yaml b/testsuite/tests/unparsing/entry_decl/simple_entry/test.yaml new file mode 100644 index 000000000..000856615 --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/simple_entry/test.yaml @@ -0,0 +1,6 @@ +description: | + This test checks the formatting of a simple entry declaration. + It is expected the declaration stays on a single line. + +driver: unparser +rule: entry_decl diff --git a/testsuite/tests/unparsing/entry_decl/with_parameter/doc-baseline.json b/testsuite/tests/unparsing/entry_decl/with_parameter/doc-baseline.json new file mode 100644 index 000000000..55a02e971 --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/with_parameter/doc-baseline.json @@ -0,0 +1,304 @@ +{ + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + { + "id": 34, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 33, + "kind": "list", + "list": [ + { + "id": 32, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "entry Read" + }, + { + "id": 29, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 28, + "kind": "list", + "list": [ + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 27, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 26, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 25, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 23, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 22, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 12, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "V" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 7, + "kind": "text", + "text": "out Item" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 16, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 19, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 18, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 17, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 24, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 35, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/entry_decl/with_parameter/input.ada b/testsuite/tests/unparsing/entry_decl/with_parameter/input.ada new file mode 100644 index 000000000..a4e718623 --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/with_parameter/input.ada @@ -0,0 +1 @@ +entry Read(V : out Item); diff --git a/testsuite/tests/unparsing/entry_decl/with_parameter/test.out b/testsuite/tests/unparsing/entry_decl/with_parameter/test.out new file mode 100644 index 000000000..1db31604e --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/with_parameter/test.out @@ -0,0 +1 @@ +entry Read (V : out Item); diff --git a/testsuite/tests/unparsing/entry_decl/with_parameter/test.yaml b/testsuite/tests/unparsing/entry_decl/with_parameter/test.yaml new file mode 100644 index 000000000..c79d83c5d --- /dev/null +++ b/testsuite/tests/unparsing/entry_decl/with_parameter/test.yaml @@ -0,0 +1,7 @@ +description: | + This test checks the formatting of an entry declaration + with parameters. + It is expected the declaration stays on a single line. + +driver: unparser +rule: entry_decl diff --git a/testsuite/tests/unparsing/protected_type_decl/with_aspects/doc-baseline.json b/testsuite/tests/unparsing/protected_type_decl/with_aspects/doc-baseline.json index 8574e9bf3..859eba201 100644 --- a/testsuite/tests/unparsing/protected_type_decl/with_aspects/doc-baseline.json +++ b/testsuite/tests/unparsing/protected_type_decl/with_aspects/doc-baseline.json @@ -1,11 +1,11 @@ { - "id": 94, + "id": 114, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 93, + "id": 113, "kind": "list", "list": [ { @@ -613,28 +613,28 @@ } }, { - "id": 91, + "id": 111, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 90, + "id": 110, "kind": "list", "list": [ { - "id": 85, + "id": 105, "kind": "command", "command": { "command": "indent", "indentContents": { - "id": 84, + "id": 104, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 83, + "id": 103, "kind": "list", "list": [ { @@ -661,16 +661,96 @@ ] }, { - "id": 78, - "kind": "text", - "text": "entry Fill;" + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 85, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 84, + "kind": "list", + "list": [ + { + "id": 83, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 82, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 81, + "kind": "list", + "list": [ + { + "id": 78, + "kind": "text", + "text": "entry Fill" + }, + { + "id": 80, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 79, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } }, { - "id": 81, + "id": 91, "kind": "list", "list": [ { - "id": 79, + "id": 89, "kind": "command", "command": { "command": "line", @@ -680,7 +760,7 @@ } }, { - "id": 80, + "id": 90, "kind": "command", "command": { "command": "breakParent" @@ -689,9 +769,89 @@ ] }, { - "id": 82, - "kind": "text", - "text": "entry Drain;" + "id": 102, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 101, + "kind": "list", + "list": [ + { + "id": 99, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 98, + "kind": "list", + "list": [ + { + "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": [ + { + "id": 92, + "kind": "text", + "text": "entry Drain" + }, + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 100, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } } ] }, @@ -702,11 +862,11 @@ } }, { - "id": 88, + "id": 108, "kind": "list", "list": [ { - "id": 86, + "id": 106, "kind": "command", "command": { "command": "line", @@ -716,7 +876,7 @@ } }, { - "id": 87, + "id": 107, "kind": "command", "command": { "command": "breakParent" @@ -725,7 +885,7 @@ ] }, { - "id": 89, + "id": 109, "kind": "text", "text": "end Worker" } @@ -736,7 +896,7 @@ } }, { - "id": 92, + "id": 112, "kind": "text", "text": ";" } diff --git a/testsuite/tests/unparsing/protected_type_decl/with_public_and_private_part/doc-baseline.json b/testsuite/tests/unparsing/protected_type_decl/with_public_and_private_part/doc-baseline.json index 985515a90..7c244159e 100644 --- a/testsuite/tests/unparsing/protected_type_decl/with_public_and_private_part/doc-baseline.json +++ b/testsuite/tests/unparsing/protected_type_decl/with_public_and_private_part/doc-baseline.json @@ -1,11 +1,11 @@ { - "id": 62, + "id": 72, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 61, + "id": 71, "kind": "list", "list": [ { @@ -61,28 +61,28 @@ } }, { - "id": 59, + "id": 69, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 58, + "id": 68, "kind": "list", "list": [ { - "id": 27, + "id": 37, "kind": "command", "command": { "command": "indent", "indentContents": { - "id": 26, + "id": 36, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 25, + "id": 35, "kind": "list", "list": [ { @@ -109,16 +109,96 @@ ] }, { - "id": 10, - "kind": "text", - "text": "entry Seize;" + "id": 20, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 19, + "kind": "list", + "list": [ + { + "id": 17, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 16, + "kind": "list", + "list": [ + { + "id": 15, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 14, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 13, + "kind": "list", + "list": [ + { + "id": 10, + "kind": "text", + "text": "entry Seize" + }, + { + "id": 12, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 11, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 18, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } }, { - "id": 13, + "id": 23, "kind": "list", "list": [ { - "id": 11, + "id": 21, "kind": "command", "command": { "command": "line", @@ -128,7 +208,7 @@ } }, { - "id": 12, + "id": 22, "kind": "command", "command": { "command": "breakParent" @@ -137,27 +217,27 @@ ] }, { - "id": 24, + "id": 34, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 23, + "id": 33, "kind": "list", "list": [ { - "id": 21, + "id": 31, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 20, + "id": 30, "kind": "list", "list": [ { - "id": 19, + "id": 29, "kind": "command", "command": { "command": "align", @@ -166,28 +246,28 @@ "n": 2 }, "alignContents": { - "id": 18, + "id": 28, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 17, + "id": 27, "kind": "list", "list": [ { - "id": 14, + "id": 24, "kind": "text", "text": "procedure Release" }, { - "id": 16, + "id": 26, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 15, + "id": 25, "kind": "list", "list": [ ] @@ -211,7 +291,7 @@ } }, { - "id": 22, + "id": 32, "kind": "text", "text": ";" } @@ -230,11 +310,11 @@ } }, { - "id": 30, + "id": 40, "kind": "list", "list": [ { - "id": 28, + "id": 38, "kind": "command", "command": { "command": "line", @@ -244,7 +324,7 @@ } }, { - "id": 29, + "id": 39, "kind": "command", "command": { "command": "breakParent" @@ -253,31 +333,31 @@ ] }, { - "id": 31, + "id": 41, "kind": "text", "text": "private" }, { - "id": 53, + "id": 63, "kind": "command", "command": { "command": "indent", "indentContents": { - "id": 52, + "id": 62, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 51, + "id": 61, "kind": "list", "list": [ { - "id": 34, + "id": 44, "kind": "list", "list": [ { - "id": 32, + "id": 42, "kind": "command", "command": { "command": "line", @@ -287,7 +367,7 @@ } }, { - "id": 33, + "id": 43, "kind": "command", "command": { "command": "breakParent" @@ -296,29 +376,29 @@ ] }, { - "id": 50, + "id": 60, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 49, + "id": 59, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 48, + "id": 58, "kind": "list", "list": [ { - "id": 36, + "id": 46, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 35, + "id": 45, "kind": "text", "text": "Busy" }, @@ -327,12 +407,12 @@ } }, { - "id": 37, + "id": 47, "kind": "text", "text": " :" }, { - "id": 38, + "id": 48, "kind": "command", "command": { "command": "line", @@ -342,7 +422,7 @@ } }, { - "id": 47, + "id": 57, "kind": "command", "command": { "command": "align", @@ -351,11 +431,11 @@ "n": 2 }, "alignContents": { - "id": 46, + "id": 56, "kind": "list", "list": [ { - "id": 42, + "id": 52, "kind": "command", "command": { "command": "align", @@ -364,17 +444,17 @@ "n": 2 }, "alignContents": { - "id": 41, + "id": 51, "kind": "command", "command": { "command": "group", "id": 0, "groupContents": { - "id": 40, + "id": 50, "kind": "list", "list": [ { - "id": 39, + "id": 49, "kind": "text", "text": "Boolean" } @@ -387,12 +467,12 @@ } }, { - "id": 43, + "id": 53, "kind": "text", "text": " :=" }, { - "id": 44, + "id": 54, "kind": "command", "command": { "command": "line", @@ -402,7 +482,7 @@ } }, { - "id": 45, + "id": 55, "kind": "text", "text": "False;" } @@ -429,11 +509,11 @@ } }, { - "id": 56, + "id": 66, "kind": "list", "list": [ { - "id": 54, + "id": 64, "kind": "command", "command": { "command": "line", @@ -443,7 +523,7 @@ } }, { - "id": 55, + "id": 65, "kind": "command", "command": { "command": "breakParent" @@ -452,7 +532,7 @@ ] }, { - "id": 57, + "id": 67, "kind": "text", "text": "end Resource" } @@ -463,7 +543,7 @@ } }, { - "id": 60, + "id": 70, "kind": "text", "text": ";" } diff --git a/testsuite/tests/unparsing/task_type_decl/simple_task_type/doc-baseline.json b/testsuite/tests/unparsing/task_type_decl/simple_task_type/doc-baseline.json new file mode 100644 index 000000000..b7a7e6271 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/simple_task_type/doc-baseline.json @@ -0,0 +1,571 @@ +{ + "id": 73, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 72, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 1, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "task type Server" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 3, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "text", + "text": "is" + }, + { + "id": 62, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 61, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 60, + "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": 45, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 44, + "kind": "list", + "list": [ + { + "id": 42, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 41, + "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": 8, + "kind": "text", + "text": "entry Next_Work_Item" + }, + { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "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": "WI" + }, + "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 Work_Item" + } + ] + }, + "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 + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 43, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 48, + "kind": "list", + "list": [ + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 47, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + { + "id": 56, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 55, + "kind": "list", + "list": [ + { + "id": 54, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 49, + "kind": "text", + "text": "entry Shut_Down" + }, + { + "id": 51, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 50, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 57, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + } + } + }, + { + "id": 65, + "kind": "list", + "list": [ + { + "id": 63, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 66, + "kind": "text", + "text": "end " + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 67, + "kind": "text", + "text": "Server" + } + } + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": ";" + } + ] + }, + "break": true, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/task_type_decl/simple_task_type/input.ada b/testsuite/tests/unparsing/task_type_decl/simple_task_type/input.ada new file mode 100644 index 000000000..624f125ff --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/simple_task_type/input.ada @@ -0,0 +1,4 @@ +task type Server is + entry Next_Work_Item(WI : in Work_Item); + entry Shut_Down; +end Server; diff --git a/testsuite/tests/unparsing/task_type_decl/simple_task_type/test.out b/testsuite/tests/unparsing/task_type_decl/simple_task_type/test.out new file mode 100644 index 000000000..1c4ce0eb2 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/simple_task_type/test.out @@ -0,0 +1,5 @@ +task type Server +is + entry Next_Work_Item (WI : in Work_Item); + entry Shut_Down; +end Server; diff --git a/testsuite/tests/unparsing/task_type_decl/simple_task_type/test.yaml b/testsuite/tests/unparsing/task_type_decl/simple_task_type/test.yaml new file mode 100644 index 000000000..955f22eda --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/simple_task_type/test.yaml @@ -0,0 +1,9 @@ +description: | + This test checks the formatting of a task type declaration. + It is expected the declaration breaks before the discriminant + specification, before `with` and `is` keywords and be formatted + by indenting the declarative part; the `task`, `is` and `end` + keywords are aligned. + +driver: unparser +rule: task_type_decl diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl/doc-baseline.json b/testsuite/tests/unparsing/task_type_decl/single_task_decl/doc-baseline.json new file mode 100644 index 000000000..b28d42dbd --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl/doc-baseline.json @@ -0,0 +1,63 @@ +{ + "id": 8, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 7, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "task" + }, + { + "id": 5, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 4, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 2, + "kind": "list", + "list": [ + { + "id": 1, + "kind": "text", + "text": " single_task" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 6, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl/input.ada b/testsuite/tests/unparsing/task_type_decl/single_task_decl/input.ada new file mode 100644 index 000000000..1514a1f60 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl/input.ada @@ -0,0 +1 @@ +task single_task; diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl/test.out b/testsuite/tests/unparsing/task_type_decl/single_task_decl/test.out new file mode 100644 index 000000000..1514a1f60 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl/test.out @@ -0,0 +1 @@ +task single_task; diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl/test.yaml b/testsuite/tests/unparsing/task_type_decl/single_task_decl/test.yaml new file mode 100644 index 000000000..d036ceccd --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl/test.yaml @@ -0,0 +1,7 @@ +description: | + This test checks the formatting of a single task declaration + without entries. + It is expected the declaration stays on a single line. + +driver: unparser +rule: single_task_decl diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/doc-baseline.json b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/doc-baseline.json new file mode 100644 index 000000000..99ff534a7 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/doc-baseline.json @@ -0,0 +1,789 @@ +{ + "id": 100, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 99, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "task" + }, + { + "id": 97, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 96, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 2, + "kind": "list", + "list": [ + { + "id": 1, + "kind": "text", + "text": " Parser" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 95, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 94, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "text", + "text": " is" + }, + { + "id": 89, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "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": 45, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 44, + "kind": "list", + "list": [ + { + "id": 42, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 41, + "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": 8, + "kind": "text", + "text": "entry Next_Lexeme" + }, + { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "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": "L" + }, + "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 Lexical_Element" + } + ] + }, + "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 + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 43, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 48, + "kind": "list", + "list": [ + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 47, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 85, + "kind": "list", + "list": [ + { + "id": 83, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 82, + "kind": "list", + "list": [ + { + "id": 81, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 80, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 79, + "kind": "list", + "list": [ + { + "id": 49, + "kind": "text", + "text": "entry Next_Action" + }, + { + "id": 78, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 77, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 76, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 75, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "(" + }, + { + "id": 72, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 71, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 70, + "kind": "list", + "list": [ + { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "text", + "text": "A" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 54, + "kind": "text", + "text": " :" + }, + { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 59, + "kind": "list", + "list": [ + { + "id": 55, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 58, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 57, + "kind": "list", + "list": [ + { + "id": 56, + "kind": "text", + "text": "out Parser_Action" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 69, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 65, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 64, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 63, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 68, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 67, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 66, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 73, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 84, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + } + } + }, + { + "id": 92, + "kind": "list", + "list": [ + { + "id": 90, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 91, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 93, + "kind": "text", + "text": "end" + } + ] + }, + "break": true, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 98, + "kind": "text", + "text": ";" + } + ] + }, + "break": true, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/input.ada b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/input.ada new file mode 100644 index 000000000..08db2d4fa --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/input.ada @@ -0,0 +1,4 @@ +task Parser is + entry Next_Lexeme(L : in Lexical_Element); + entry Next_Action(A : out Parser_Action); +end; diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/test.out b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/test.out new file mode 100644 index 000000000..efceadfe1 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/test.out @@ -0,0 +1,4 @@ +task Parser is + entry Next_Lexeme (L : in Lexical_Element); + entry Next_Action (A : out Parser_Action); +end; diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/test.yaml b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/test.yaml new file mode 100644 index 000000000..388b96db1 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_entry/test.yaml @@ -0,0 +1,9 @@ +description: | + This test checks the formatting of a single task declaration + with entries. + It is expected the declaration be formatted by adding a line + break after `is` keyword and the entries be aligned and indented + as well the `task` and `end` keywords be aligned. + +driver: unparser +rule: single_task_decl diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/doc-baseline.json b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/doc-baseline.json new file mode 100644 index 000000000..39b062347 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/doc-baseline.json @@ -0,0 +1,495 @@ +{ + "id": 64, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 63, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "task" + }, + { + "id": 61, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 60, + "kind": "list", + "list": [ + { + "id": 3, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 2, + "kind": "list", + "list": [ + { + "id": 1, + "kind": "text", + "text": " Controller" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "text", + "text": " is" + }, + { + "id": 51, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 50, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 49, + "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": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "list", + "list": [ + { + "id": 45, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 44, + "kind": "list", + "list": [ + { + "id": 43, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 42, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 41, + "kind": "list", + "list": [ + { + "id": 8, + "kind": "text", + "text": "entry Request " + }, + { + "id": 11, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 9, + "kind": "text", + "text": "(Level)" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + { + "id": 12, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 38, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 37, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 36, + "kind": "list", + "list": [ + { + "id": 13, + "kind": "text", + "text": "(" + }, + { + "id": 34, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 33, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 24, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 23, + "kind": "list", + "list": [ + { + "id": 15, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 14, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 16, + "kind": "text", + "text": " :" + }, + { + "id": 22, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 21, + "kind": "list", + "list": [ + { + "id": 17, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 20, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 19, + "kind": "list", + "list": [ + { + "id": 18, + "kind": "text", + "text": "Item" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 27, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 30, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 29, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 28, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 35, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 46, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + } + } + }, + { + "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": 55, + "kind": "text", + "text": "end " + }, + { + "id": 57, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 56, + "kind": "text", + "text": "Controller" + } + } + } + ] + }, + "break": true, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 62, + "kind": "text", + "text": ";" + } + ] + }, + "break": true, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/input.ada b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/input.ada new file mode 100644 index 000000000..589f02b94 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/input.ada @@ -0,0 +1,3 @@ +task Controller is + entry Request(Level)(D : Item); -- a family of entries +end Controller; diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/test.out b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/test.out new file mode 100644 index 000000000..b6d97533c --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/test.out @@ -0,0 +1,3 @@ +task Controller is + entry Request (Level) (D : Item); +end Controller; diff --git a/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/test.yaml b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/test.yaml new file mode 100644 index 000000000..6ad4889f7 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/single_task_decl_with_family_of_entries/test.yaml @@ -0,0 +1,9 @@ +description: | + This test checks the formatting of a single task declaration + with entries. + It is expected the declaration be formatted by adding a line + break after `is` keyword and the entries be aligned and indented + as well; the `task` and `end` keywords are aligned. + +driver: unparser +rule: single_task_decl diff --git a/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/doc-baseline.json b/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/doc-baseline.json new file mode 100644 index 000000000..3588dc71b --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/doc-baseline.json @@ -0,0 +1,1123 @@ +{ + "id": 143, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 142, + "kind": "list", + "list": [ + { + "id": 34, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 33, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "task type Keyboard_Driver" + }, + { + "id": 32, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 28, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 27, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "list", + "list": [ + { + "id": 11, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 10, + "kind": "list", + "list": [ + { + "id": 4, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 3, + "kind": "text", + "text": "ID" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 5, + "kind": "text", + "text": " :" + }, + { + "id": 9, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 8, + "kind": "list", + "list": [ + { + "id": 6, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 7, + "kind": "text", + "text": "Keyboard_ID" + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 17, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 16, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 15, + "kind": "list", + "list": [ + { + "id": 12, + "kind": "text", + "text": " :=" + }, + { + "id": 13, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 14, + "kind": "text", + "text": "New_ID" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "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": " :=" + }, + { + "id": 19, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 20, + "kind": "text", + "text": "New_ID" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 29, + "kind": "text", + "text": ")" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 35, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 140, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 139, + "kind": "list", + "list": [ + { + "id": 36, + "kind": "text", + "text": "is new" + }, + { + "id": 43, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 42, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 41, + "kind": "list", + "list": [ + { + "id": 39, + "kind": "list", + "list": [ + { + "id": 37, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 38, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 40, + "kind": "text", + "text": "Serial_Device" + } + ] + }, + "break": true, + "expandedStates": null + } + } + } + }, + { + "id": 46, + "kind": "list", + "list": [ + { + "id": 44, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 45, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 47, + "kind": "text", + "text": "with" + }, + { + "id": 132, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 131, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 130, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 49, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 85, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 84, + "kind": "list", + "list": [ + { + "id": 83, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 82, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 81, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "entry Read" + }, + { + "id": 80, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 79, + "kind": "list", + "list": [ + { + "id": 52, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 78, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 53, + "kind": "text", + "text": "(" + }, + { + "id": 74, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 73, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 72, + "kind": "list", + "list": [ + { + "id": 64, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 63, + "kind": "list", + "list": [ + { + "id": 55, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 54, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 56, + "kind": "text", + "text": " :" + }, + { + "id": 62, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 61, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 60, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 59, + "kind": "list", + "list": [ + { + "id": 58, + "kind": "text", + "text": "out Character" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 67, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 70, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 69, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 68, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 75, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 91, + "kind": "list", + "list": [ + { + "id": 89, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 129, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 128, + "kind": "list", + "list": [ + { + "id": 126, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 125, + "kind": "list", + "list": [ + { + "id": 124, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 123, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 122, + "kind": "list", + "list": [ + { + "id": 92, + "kind": "text", + "text": "entry Write" + }, + { + "id": 121, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 120, + "kind": "list", + "list": [ + { + "id": 93, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 119, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 118, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 117, + "kind": "list", + "list": [ + { + "id": 94, + "kind": "text", + "text": "(" + }, + { + "id": 115, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 114, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 113, + "kind": "list", + "list": [ + { + "id": 105, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 104, + "kind": "list", + "list": [ + { + "id": 96, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 95, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 97, + "kind": "text", + "text": " :" + }, + { + "id": 103, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 98, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 100, + "kind": "list", + "list": [ + { + "id": 99, + "kind": "text", + "text": "in Character" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 112, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 108, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 107, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 106, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "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": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 116, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 127, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": true, + "expandedStates": null + } + } + } + }, + { + "id": 135, + "kind": "list", + "list": [ + { + "id": 133, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 134, + "kind": "command", + "command": { + "command": "breakParent" + } + } + ] + }, + { + "id": 136, + "kind": "text", + "text": "end " + }, + { + "id": 138, + "kind": "command", + "command": { + "command": "indent", + "indentContents": { + "id": 137, + "kind": "text", + "text": "Keyboard_Driver" + } + } + } + ] + }, + "break": true, + "expandedStates": null + } + }, + { + "id": 141, + "kind": "text", + "text": ";" + } + ] + }, + "break": true, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/input.ada b/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/input.ada new file mode 100644 index 000000000..c205b35c6 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/input.ada @@ -0,0 +1,5 @@ +task type Keyboard_Driver(ID : Keyboard_ID := New_ID) is + new Serial_Device with + entry Read (C : out Character); + entry Write(C : in Character); +end Keyboard_Driver; diff --git a/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/test.out b/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/test.out new file mode 100644 index 000000000..7b8f932c0 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/test.out @@ -0,0 +1,7 @@ +task type Keyboard_Driver (ID : Keyboard_ID := New_ID) +is new + Serial_Device +with + entry Read (C : out Character); + entry Write (C : in Character); +end Keyboard_Driver; diff --git a/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/test.yaml b/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/test.yaml new file mode 100644 index 000000000..b7b426523 --- /dev/null +++ b/testsuite/tests/unparsing/task_type_decl/with_known_discriminant/test.yaml @@ -0,0 +1,10 @@ +description: | + This test checks the formatting of a task type declaration + with known discriminant and interfaces. + It is expected the declaration breaks before `is` and `with` + keywords and be formatted by indenting the interfaces list + elements and the declarations part; keep the `task`, `is` and + `end` keywords aligned. + +driver: unparser +rule: task_type_decl