diff --git a/extensions/default_unparsing_config.json b/extensions/default_unparsing_config.json index 2299c69c5..22e0c5942 100644 --- a/extensions/default_unparsing_config.json +++ b/extensions/default_unparsing_config.json @@ -2883,6 +2883,44 @@ ] } }, + "NullSubpDecl": { + "node": { + "kind": "group", + "document": [ + { + "kind": "recurse_field", + "field": "f_overriding" + }, + { + "kind": "recurse_field", + "field": "f_subp_spec" + }, + "line", + { + "kind": "text", + "text": "is" + }, + { + "kind": "text", + "text": "null" + }, + { + "kind": "recurse_field", + "field": "f_aspects" + }, + { + "kind": "text", + "text": ";" + } + ] + }, + "fields": { + "f_aspects": [ + "hardlineWithoutBreakParent", + "recurse" + ] + } + }, "ObjectDecl": { "node": { "kind": "group", diff --git a/testsuite/tests/unparsing/null_subp_decl/long/doc-baseline.json b/testsuite/tests/unparsing/null_subp_decl/long/doc-baseline.json new file mode 100644 index 000000000..60a8f8e5b --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/long/doc-baseline.json @@ -0,0 +1,835 @@ +{ + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "procedure Foo" + }, + { + "id": 96, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 95, + "kind": "list", + "list": [ + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "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": "AAAAAAAAAAAA" + }, + "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": "Bar" + } + ] + }, + "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": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "BBBBBBBBBBBB" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "CCCCCCCCCCCC" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "DDDDDDDDDDDD" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 100, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "text", + "text": "is null;" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/null_subp_decl/long/input.ada b/testsuite/tests/unparsing/null_subp_decl/long/input.ada new file mode 100644 index 000000000..1603034d8 --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/long/input.ada @@ -0,0 +1,5 @@ +procedure Foo + (AAAAAAAAAAAA : Bar; + BBBBBBBBBBBB : Baz; + CCCCCCCCCCCC : Qux; + DDDDDDDDDDDD : Corge) is null; diff --git a/testsuite/tests/unparsing/null_subp_decl/long/test.out b/testsuite/tests/unparsing/null_subp_decl/long/test.out new file mode 100644 index 000000000..f5fd29fd3 --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/long/test.out @@ -0,0 +1,6 @@ +procedure Foo + (AAAAAAAAAAAA : Bar; + BBBBBBBBBBBB : Baz; + CCCCCCCCCCCC : Qux; + DDDDDDDDDDDD : Corge) +is null; diff --git a/testsuite/tests/unparsing/null_subp_decl/long/test.yaml b/testsuite/tests/unparsing/null_subp_decl/long/test.yaml new file mode 100644 index 000000000..638a12c98 --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/long/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: null_subp_decl +description: | + Test that a line break is added before the `is` keyword and that it has the + same indentation as the `function` keyword. diff --git a/testsuite/tests/unparsing/null_subp_decl/short/doc-baseline.json b/testsuite/tests/unparsing/null_subp_decl/short/doc-baseline.json new file mode 100644 index 000000000..7b1c30063 --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/short/doc-baseline.json @@ -0,0 +1,835 @@ +{ + "id": 103, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 102, + "kind": "list", + "list": [ + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "procedure Foo" + }, + { + "id": 96, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 95, + "kind": "list", + "list": [ + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "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": "A" + }, + "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": "Bar" + } + ] + }, + "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": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 100, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "text", + "text": "is null;" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/null_subp_decl/short/input.ada b/testsuite/tests/unparsing/null_subp_decl/short/input.ada new file mode 100644 index 000000000..9749b4594 --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/short/input.ada @@ -0,0 +1 @@ +procedure Foo(A:Bar;B:Baz;C:Qux;D:Corge)is null; diff --git a/testsuite/tests/unparsing/null_subp_decl/short/test.out b/testsuite/tests/unparsing/null_subp_decl/short/test.out new file mode 100644 index 000000000..8d2ad0c40 --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/short/test.out @@ -0,0 +1 @@ +procedure Foo (A : Bar; B : Baz; C : Qux; D : Corge) is null; diff --git a/testsuite/tests/unparsing/null_subp_decl/short/test.yaml b/testsuite/tests/unparsing/null_subp_decl/short/test.yaml new file mode 100644 index 000000000..0639f277f --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/short/test.yaml @@ -0,0 +1,4 @@ +driver: unparser +rule: null_subp_decl +description: | + Test that no line break are added. diff --git a/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/doc-baseline.json b/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/doc-baseline.json new file mode 100644 index 000000000..5d228083d --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/doc-baseline.json @@ -0,0 +1,913 @@ +{ + "id": 113, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 112, + "kind": "list", + "list": [ + { + "id": 99, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 98, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 97, + "kind": "list", + "list": [ + { + "id": 0, + "kind": "text", + "text": "procedure Foo" + }, + { + "id": 96, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 95, + "kind": "list", + "list": [ + { + "id": 1, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 94, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 93, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 1 + }, + "alignContents": { + "id": 92, + "kind": "list", + "list": [ + { + "id": 2, + "kind": "text", + "text": "(" + }, + { + "id": 90, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "innerRoot" + }, + "alignContents": { + "id": 89, + "kind": "list", + "list": [ + { + "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": "A" + }, + "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": "Bar" + } + ] + }, + "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": 23, + "kind": "text", + "text": ";" + }, + { + "id": 24, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 44, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 43, + "kind": "list", + "list": [ + { + "id": 35, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 34, + "kind": "list", + "list": [ + { + "id": 26, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 25, + "kind": "text", + "text": "B" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 27, + "kind": "text", + "text": " :" + }, + { + "id": 33, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 32, + "kind": "list", + "list": [ + { + "id": 28, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 31, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 30, + "kind": "list", + "list": [ + { + "id": 29, + "kind": "text", + "text": "Baz" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 42, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 38, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 37, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 36, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 41, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 40, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 39, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 45, + "kind": "text", + "text": ";" + }, + { + "id": 46, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 66, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 65, + "kind": "list", + "list": [ + { + "id": 57, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 56, + "kind": "list", + "list": [ + { + "id": 48, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 47, + "kind": "text", + "text": "C" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 49, + "kind": "text", + "text": " :" + }, + { + "id": 55, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 54, + "kind": "list", + "list": [ + { + "id": 50, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 53, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 52, + "kind": "list", + "list": [ + { + "id": 51, + "kind": "text", + "text": "Qux" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 64, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 60, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 59, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 58, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 63, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 62, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 61, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 67, + "kind": "text", + "text": ";" + }, + { + "id": 68, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 88, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 87, + "kind": "list", + "list": [ + { + "id": 79, + "kind": "command", + "command": { + "command": "group", + "id": 1, + "groupContents": { + "id": 78, + "kind": "list", + "list": [ + { + "id": 70, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 69, + "kind": "text", + "text": "D" + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 71, + "kind": "text", + "text": " :" + }, + { + "id": 77, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 76, + "kind": "list", + "list": [ + { + "id": 72, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 75, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 74, + "kind": "list", + "list": [ + { + "id": 73, + "kind": "text", + "text": "Corge" + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 86, + "kind": "command", + "command": { + "command": "ifBreak", + "ifBreakGroupId": 1, + "breakContents": { + "id": 82, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 4 + }, + "alignContents": { + "id": 81, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 80, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + "flatContents": { + "id": 85, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 84, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 83, + "kind": "list", + "list": [ + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + } + } + }, + { + "id": 91, + "kind": "text", + "text": ")" + } + ] + } + } + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + }, + { + "id": 100, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 101, + "kind": "text", + "text": "is null" + }, + { + "id": 102, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": true + } + }, + { + "id": 110, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 109, + "kind": "list", + "list": [ + { + "id": 103, + "kind": "text", + "text": "with" + }, + { + "id": 108, + "kind": "command", + "command": { + "command": "align", + "alignData": { + "kind": "width", + "n": 2 + }, + "alignContents": { + "id": 107, + "kind": "command", + "command": { + "command": "group", + "id": 0, + "groupContents": { + "id": 106, + "kind": "list", + "list": [ + { + "id": 104, + "kind": "command", + "command": { + "command": "line", + "literal": false, + "soft": false, + "hard": false + } + }, + { + "id": 105, + "kind": "text", + "text": "Garplyyyyyyy" + } + ] + }, + "break": false, + "expandedStates": null + } + } + } + } + ] + }, + "break": false, + "expandedStates": null + } + }, + { + "id": 111, + "kind": "text", + "text": ";" + } + ] + }, + "break": false, + "expandedStates": null + } +} diff --git a/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/input.ada b/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/input.ada new file mode 100644 index 000000000..ccf34cf18 --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/input.ada @@ -0,0 +1 @@ +procedure Foo (A : Bar; B : Baz; C : Qux; D : Corge) is null with Garplyyyyyyy; diff --git a/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/test.out b/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/test.out new file mode 100644 index 000000000..5366c61ff --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/test.out @@ -0,0 +1,2 @@ +procedure Foo (A : Bar; B : Baz; C : Qux; D : Corge) is null +with Garplyyyyyyy; diff --git a/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/test.yaml b/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/test.yaml new file mode 100644 index 000000000..4d7b9c759 --- /dev/null +++ b/testsuite/tests/unparsing/null_subp_decl/short_with_aspects/test.yaml @@ -0,0 +1,5 @@ +driver: unparser +rule: null_subp_decl +description: | + Test that a line break is added before the `with` keyword and that it has the + same indentation as the `function` keyword.