From 922af22f5b9688b1eb49fa6688f19141e8bc201c Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Tue, 4 Jul 2023 18:32:14 +0200 Subject: [PATCH] feat: automatic formatting in Langium (#526) Closes #31 Closes #33 Closes #513 Closes partially #433 ### Summary of Changes * Migrate Xtext formatter to Langium * Break the following lists across multiple lines if needed: * arguments * parameters * type parameters * results * Allow additional new lines between statements * Greatly improve formatter tests (though `vitest` doesn't quite reflect that for now) --------- Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com> --- DSL/package-lock.json | 1 + DSL/package.json | 1 + .../formatting/safe-ds-formatter.ts | 921 ++++++++++++++++++ .../language-server/grammar/safe-ds.langium | 14 +- .../language-server/helpers/astShortcuts.ts | 26 + DSL/src/language-server/safe-ds-module.ts | 4 + DSL/syntaxes/safe-ds.tmLanguage.json | 2 +- DSL/tests/formatting/testFormatter.test.ts | 93 ++ DSL/tests/grammar/testGrammar.test.ts | 24 +- .../comments/before declarations.sdstest | 8 + .../comments/before imports.sdstest | 8 + .../before module annotations.sdstest | 8 + .../comments/before module name.sdstest | 8 + .../complex argument list (unchanged).sdstest | 11 + .../complex argument list.sdstest | 8 + .../empty argument list.sdstest | 5 + .../long argument list.sdstest | 10 + .../multiple arguments.sdstest | 5 + .../annotation calls/named argument.sdstest | 5 + .../annotation calls/no argument list.sdstest | 5 + .../positional argument.sdstest | 5 + .../annotations/annotation call.sdstest | 12 + ...complex parameter list (unchanged).sdstest | 11 + .../complex parameter list.sdstest | 8 + .../annotations/empty parameter list.sdstest | 5 + .../declarations/annotations/full.sdstest | 29 + .../annotations/long parameter list.sdstest | 10 + .../annotations/multiple parameters.sdstest | 33 + .../annotations/no parameter list.sdstest | 5 + .../with multiple constraints.sdstest | 12 + .../annotations/with sub constraint.sdstest | 9 + .../annotations/with super constraint.sdstest | 9 + .../with typed optional parameter.sdstest | 5 + .../with typed required parameter.sdstest | 5 + ...dic parameter (with default value).sdstest | 5 + .../with typed variadic parameter.sdstest | 5 + .../with untyped optional parameter.sdstest | 5 + .../with untyped required parameter.sdstest | 5 + ...dic parameter (with default value).sdstest | 5 + .../with untyped variadic parameter.sdstest | 5 + .../classes/annotated type parameter.sdstest | 8 + .../classes/annotation call.sdstest | 10 + .../classes/attributes/annotated.sdstest | 10 + .../classes/attributes/no type.sdstest | 9 + .../classes/attributes/static.sdstest | 9 + .../classes/attributes/with type.sdstest | 9 + ...complex parameter list (unchanged).sdstest | 11 + .../classes/complex parameter list.sdstest | 8 + ...ype parameter with annotation call.sdstest | 8 + .../contravariant type parameter.sdstest | 5 + ...ype parameter with annotation call.sdstest | 8 + .../classes/covariant type parameter.sdstest | 5 + .../declarations/classes/empty body.sdstest | 5 + .../classes/empty constraint list.sdstest | 5 + .../classes/empty parameter list.sdstest | 5 + .../classes/empty type parameter list.sdstest | 5 + .../declarations/classes/full body.sdstest | 65 ++ .../classes/invariant type parameter.sdstest | 5 + .../classes/long parameter list.sdstest | 10 + ...ng type parameter list (unchanged).sdstest | 15 + .../classes/long type parameter list.sdstest | 10 + .../methods/annotated type parameter.sdstest | 12 + .../classes/methods/annotation call.sdstest | 10 + ...ype parameter with annotation call.sdstest | 12 + .../contravariant type parameter.sdstest | 9 + ...ype parameter with annotation call.sdstest | 12 + .../methods/covariant type parameter.sdstest | 9 + .../methods/empty constraint list.sdstest | 9 + .../methods/empty type parameter list.sdstest | 9 + .../methods/invariant type parameter.sdstest | 9 + .../methods/multiple parameters.sdstest | 36 + .../classes/methods/multiple results.sdstest | 23 + .../methods/multiple type parameters.sdstest | 14 + .../no parameters and no results.sdstest | 9 + .../methods/no results (explicit).sdstest | 9 + .../one typed result (in parentheses).sdstest | 9 + .../one typed result (no parentheses).sdstest | 9 + ...ne untyped result (no parentheses).sdstest | 9 + ... untyped result (with parentheses).sdstest | 9 + .../classes/methods/static.sdstest | 9 + .../methods/with multiple constraints.sdstest | 17 + .../methods/with sub constraint.sdstest | 13 + .../methods/with super constraint.sdstest | 14 + .../with typed optional parameter.sdstest | 9 + .../with typed required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../with typed variadic parameter.sdstest | 9 + .../with untyped optional parameter.sdstest | 9 + .../with untyped required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../with untyped variadic parameter.sdstest | 9 + .../declarations/classes/minimal.sdstest | 5 + .../classes/multiple parameters.sdstest | 33 + .../classes/multiple parent types.sdstest | 5 + .../classes/multiple type parameters.sdstest | 10 + .../annotated type parameter.sdstest | 12 + .../nested classes/annotation call.sdstest | 10 + ...ype parameter with annotation call.sdstest | 12 + .../contravariant type parameter.sdstest | 9 + ...ype parameter with annotation call.sdstest | 12 + .../covariant type parameter.sdstest | 9 + .../classes/nested classes/empty body.sdstest | 9 + .../empty constraint list.sdstest | 9 + .../empty parameter list.sdstest | 9 + .../empty type parameter list.sdstest | 9 + .../invariant type parameter.sdstest | 9 + .../classes/nested classes/minimal.sdstest | 9 + .../multiple parameters.sdstest | 37 + .../multiple parent types.sdstest | 9 + .../multiple type parameters.sdstest | 14 + .../nested classes/parent type.sdstest | 9 + .../with multiple constraints.sdstest | 18 + .../with sub constraint.sdstest | 13 + .../with super constraint.sdstest | 13 + .../with typed optional parameter.sdstest | 9 + .../with typed required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../with typed variadic parameter.sdstest | 9 + .../with untyped optional parameter.sdstest | 9 + .../with untyped required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../with untyped variadic parameter.sdstest | 9 + .../nested enums/annotation call.sdstest | 10 + .../classes/nested enums/empty body.sdstest | 9 + .../classes/nested enums/no body.sdstest | 9 + .../nested enums/variants in body.sdstest | 13 + .../variants/annotated type parameter.sdstest | 16 + .../variants/annotation call.sdstest | 14 + ...ype parameter with annotation call.sdstest | 16 + .../contravariant type parameter.sdstest | 13 + ...ype parameter with annotation call.sdstest | 16 + .../variants/covariant type parameter.sdstest | 13 + .../empty type parameter list.sdstest | 13 + .../variants/invariant type parameter.sdstest | 13 + .../variants/multiple parameters.sdstest | 40 + .../variants/multiple type parameters.sdstest | 18 + .../variants/no parameter list.sdstest | 13 + .../with multiple constraints.sdstest | 19 + .../variants/with sub constraint.sdstest | 17 + .../variants/with super constraint.sdstest | 17 + .../with typed optional parameter.sdstest | 13 + .../with typed required parameter.sdstest | 13 + ...dic parameter (with default value).sdstest | 13 + .../with typed variadic parameter.sdstest | 13 + .../with untyped optional parameter.sdstest | 13 + .../with untyped required parameter.sdstest | 13 + ...dic parameter (with default value).sdstest | 13 + .../with untyped variadic parameter.sdstest | 13 + .../classes/one parent type.sdstest | 5 + .../classes/with multiple constraints.sdstest | 14 + .../classes/with sub constraint.sdstest | 9 + .../classes/with super constraint.sdstest | 9 + .../with typed optional parameter.sdstest | 5 + .../with typed required parameter.sdstest | 5 + ...dic parameter (with default value).sdstest | 5 + .../with typed variadic parameter.sdstest | 5 + .../with untyped optional parameter.sdstest | 5 + .../with untyped required parameter.sdstest | 5 + ...dic parameter (with default value).sdstest | 5 + .../with untyped variadic parameter.sdstest | 5 + .../enums/annotation call.sdstest | 10 + .../declarations/enums/empty body.sdstest | 5 + .../declarations/enums/full body.sdstest | 27 + .../declarations/enums/no body.sdstest | 5 + .../enums/variants in body.sdstest | 9 + .../variants/annotated type parameter.sdstest | 12 + .../enums/variants/annotation call.sdstest | 10 + ...complex parameter list (unchanged).sdstest | 15 + .../variants/complex parameter list.sdstest | 12 + ...ype parameter with annotation call.sdstest | 12 + .../contravariant type parameter.sdstest | 9 + ...ype parameter with annotation call.sdstest | 12 + .../variants/covariant type parameter.sdstest | 9 + .../empty type parameter list.sdstest | 9 + .../variants/invariant type parameter.sdstest | 9 + .../variants/long parameter list.sdstest | 14 + ...ng type parameter list (unchanged).sdstest | 19 + .../variants/long type parameter list.sdstest | 14 + .../variants/multiple parameters.sdstest | 37 + .../variants/multiple type parameters.sdstest | 14 + .../enums/variants/no parameter list.sdstest | 9 + .../with multiple constraints.sdstest | 18 + .../variants/with sub constraint.sdstest | 13 + .../variants/with super constraint.sdstest | 13 + .../with typed optional parameter.sdstest | 9 + .../with typed required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../with typed variadic parameter.sdstest | 9 + .../with untyped optional parameter.sdstest | 9 + .../with untyped required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../with untyped variadic parameter.sdstest | 9 + .../annotated type parameter.sdstest | 8 + .../functions/annotation call.sdstest | 10 + ...complex parameter list (unchanged).sdstest | 11 + .../functions/complex parameter list.sdstest | 8 + .../complex result list (unchanged).sdstest | 11 + .../functions/complex result list.sdstest | 8 + ...ype parameter with annotation call.sdstest | 8 + .../contravariant type parameter.sdstest | 5 + ...ype parameter with annotation call.sdstest | 8 + .../covariant type parameter.sdstest | 5 + .../functions/empty constraint list.sdstest | 5 + .../empty type parameter list.sdstest | 5 + .../invariant type parameter.sdstest | 5 + .../functions/long parameter list.sdstest | 10 + .../functions/long result list.sdstest | 10 + ...ng type parameter list (unchanged).sdstest | 15 + .../long type parameter list.sdstest | 10 + .../functions/multiple parameters.sdstest | 32 + .../functions/multiple results.sdstest | 20 + .../multiple type parameters.sdstest | 10 + .../no parameters and no results.sdstest | 5 + .../functions/no results (explicit).sdstest | 5 + .../one typed result (in parentheses).sdstest | 5 + .../one typed result (no parentheses).sdstest | 5 + ...ne untyped result (no parentheses).sdstest | 5 + ... untyped result (with parentheses).sdstest | 5 + .../with multiple constraints.sdstest | 13 + .../functions/with sub constraint.sdstest | 9 + .../functions/with super constraint.sdstest | 9 + .../with typed optional parameter.sdstest | 5 + .../with typed required parameter.sdstest | 5 + ...dic parameter (with default value).sdstest | 5 + .../with typed variadic parameter.sdstest | 5 + .../with untyped optional parameter.sdstest | 5 + .../with untyped required parameter.sdstest | 5 + ...dic parameter (with default value).sdstest | 5 + .../with untyped variadic parameter.sdstest | 5 + .../pipelines/annotation call.sdstest | 10 + .../declarations/pipelines/empty body.sdstest | 5 + .../pipelines/statements in body.sdstest | 9 + .../segments/annotation call.sdstest | 10 + ...complex parameter list (unchanged).sdstest | 11 + .../segments/complex parameter list.sdstest | 8 + .../complex result list (unchanged).sdstest | 11 + .../segments/complex result list.sdstest | 8 + ...ernal segment with annotation call.sdstest | 10 + .../segments/internal segment.sdstest | 5 + .../segments/long parameter list.sdstest | 10 + .../segments/long result list.sdstest | 10 + .../segments/multiple parameters.sdstest | 32 + .../segments/multiple results.sdstest | 20 + ...ters and no results and empty body.sdstest | 5 + .../segments/no results (explicit).sdstest | 5 + .../one typed result (in parentheses).sdstest | 5 + .../one typed result (no parentheses).sdstest | 5 + ...ne untyped result (no parentheses).sdstest | 5 + ... untyped result (with parentheses).sdstest | 5 + ...ivate segment with annotation call.sdstest | 10 + .../segments/private segment.sdstest | 5 + .../segments/statements in body.sdstest | 9 + .../with typed optional parameter.sdstest | 5 + .../with typed required parameter.sdstest | 5 + ...dic parameter (with default value).sdstest | 5 + .../with typed variadic parameter.sdstest | 5 + .../with untyped optional parameter.sdstest | 5 + .../with untyped required parameter.sdstest | 5 + ...dic parameter (with default value).sdstest | 5 + .../with untyped variadic parameter.sdstest | 5 + .../arithmetic operators/addition.sdstest | 9 + .../complex example.sdstest | 9 + .../arithmetic operators/division.sdstest | 9 + .../multiplication.sdstest | 9 + .../arithmetic operators/negation.sdstest | 9 + .../arithmetic operators/subtraction.sdstest | 9 + ...complex parameter list (unchanged).sdstest | 15 + .../complex parameter list.sdstest | 12 + .../block lambdas/filled body.sdstest | 13 + .../block lambdas/long parameter list.sdstest | 14 + .../block lambdas/multiple parameters.sdstest | 36 + .../no parameters and empty body.sdstest | 9 + .../with typed optional parameter.sdstest | 9 + .../with typed required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../with typed variadic parameter.sdstest | 9 + .../with untyped optional parameter.sdstest | 9 + .../with untyped required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../with untyped variadic parameter.sdstest | 9 + .../complex argument list (unchanged).sdstest | 15 + .../calls/complex argument list.sdstest | 12 + .../expressions/calls/complex call.sdstest | 9 + .../calls/contravariant type argument.sdstest | 9 + .../calls/covariant type argument.sdstest | 9 + ...ype argument list and no arguments.sdstest | 9 + .../calls/long argument list.sdstest | 14 + .../expressions/calls/named argument.sdstest | 9 + .../calls/named type argument.sdstest | 9 + ...gument lists (named type argument).sdstest | 9 + ...ype argument list and no arguments.sdstest | 9 + .../calls/positional argument.sdstest | 9 + .../calls/positional type argument.sdstest | 9 + ...t lists (positional type argument).sdstest | 41 + .../expressions/calls/star projection.sdstest | 9 + .../greater than or equal.sdstest | 9 + .../comparison operators/greater than.sdstest | 9 + .../less than or equal.sdstest | 9 + .../less than vs. type argument list.sdstest | 9 + .../comparison operators/less than.sdstest | 9 + .../complex chained expression.sdstest | 9 + .../equality operators/equal.sdstest | 9 + .../equality operators/identical.sdstest | 9 + .../equality operators/not equal.sdstest | 9 + .../equality operators/not identical.sdstest | 9 + ...complex parameter list (unchanged).sdstest | 15 + .../complex parameter list.sdstest | 12 + .../long parameter list.sdstest | 14 + .../multiple parameters.sdstest | 37 + .../expression lambdas/no parameters.sdstest | 9 + .../typed optional parameter.sdstest | 9 + .../typed required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../typed variadic parameter.sdstest | 9 + .../untyped optional parameter.sdstest | 9 + .../untyped required parameter.sdstest | 9 + ...dic parameter (with default value).sdstest | 9 + .../untyped variadic parameter.sdstest | 9 + .../indexed accesses/literal index.sdstest | 9 + .../indexed accesses/reference index.sdstest | 9 + .../expressions/literals/false.sdstest | 9 + .../literals/float/basic example.sdstest | 25 + ...ientific notation with lowercase e.sdstest | 15 + ...ientific notation with uppercase e.sdstest | 15 + .../literals/int/leading zero.sdstest | 9 + .../literals/int/multiple digits.sdstest | 9 + .../literals/int/one digit.sdstest | 9 + .../expressions/literals/null.sdstest | 9 + .../literals/string/basic content.sdstest | 9 + ...sing template expression delimiter.sdstest | 9 + .../curly braces separated by space.sdstest | 9 + .../string/empty template expression.sdstest | 9 + .../expressions/literals/string/empty.sdstest | 9 + .../string/escaped curly brace.sdstest | 9 + .../literals/string/multiple lines.sdstest | 17 + .../string/newline escape sequence.sdstest | 9 + .../string/single curly brace.sdstest | 9 + .../literals/string/single quote.sdstest | 9 + ...plate string with basic expression.sdstest | 9 + ...mplate string with two expressions.sdstest | 9 + .../string/unicode escape sequence.sdstest | 9 + .../expressions/literals/true.sdstest | 9 + .../complex example.sdstest | 9 + .../logical operations/conjunction.sdstest | 9 + .../logical operations/disjunction.sdstest | 9 + .../logical operations/negation.sdstest | 9 + .../member accesses/not nullable.sdstest | 9 + .../member accesses/nullable.sdstest | 9 + .../parenthesized expressions/nested.sdstest | 9 + .../one level.sdstest | 9 + .../formatting/expressions/reference.sdstest | 9 + .../annotation call and declaration.sdstest | 11 + ...on call and import and declaration.sdstest | 16 + .../annotation call and import.sdstest | 11 + ...l and package name and declaration.sdstest | 16 + ...ge name and import and declaration.sdstest | 21 + ...n call and package name and import.sdstest | 16 + .../annotation call and package name.sdstest | 11 + .../modules/annotation call.sdstest | 6 + .../annotation calls and declarations.sdstest | 19 + ...calls and imports and declarations.sdstest | 30 + .../annotation calls and imports.sdstest | 20 + ... and package name and declarations.sdstest | 24 + ... name and imports and declarations.sdstest | 35 + ...calls and package name and imports.sdstest | 25 + .../annotation calls and package name.sdstest | 14 + .../modules/annotation calls.sdstest | 9 + .../formatting/modules/declaration.sdstest | 6 + .../formatting/modules/declarations.sdstest | 11 + .../formatting/modules/empty.sdstest | 5 + .../resources/formatting/modules/full.sdstest | 102 ++ .../modules/import and declaration.sdstest | 11 + .../formatting/modules/import.sdstest | 6 + .../modules/imports and declarations.sdstest | 22 + .../formatting/modules/imports.sdstest | 12 + .../package name and declaration.sdstest | 11 + .../package name and declarations.sdstest | 16 + ...ge name and import and declaration.sdstest | 16 + .../modules/package name and import.sdstest | 11 + ... name and imports and declarations.sdstest | 26 + .../modules/package name and imports.sdstest | 17 + .../formatting/modules/package name.sdstest | 6 + .../formatting/schema/annotationCall.sdstest | 10 + .../formatting/schema/empty schema.sdstest | 5 + .../formatting/schema/one column.sdstest | 9 + .../formatting/schema/two columns.sdstest | 13 + .../assignments/in block lambda.sdstest | 15 + .../assignments/in pipeline.sdstest | 11 + .../statements/assignments/in segment.sdstest | 11 + .../in block lambda.sdstest | 13 + .../expression statements/in pipeline.sdstest | 9 + .../expression statements/in segment.sdstest | 9 + .../in block lambda.sdstest | 20 + .../flexible new lines/in pipeline.sdstest | 16 + .../flexible new lines/in segment.sdstest | 16 + ... list of annotation call (complex).sdstest | 8 + ...ent list of annotation call (long).sdstest | 10 + ...ist of annotation call (unchanged).sdstest | 5 + .../argument list of annotation call.sdstest | 5 + .../argument list of call (complex).sdstest | 12 + .../argument list of call (long).sdstest | 14 + .../argument list of call (unchanged).sdstest | 9 + .../argument list of call.sdstest | 9 + ...list of assignment in block lambda.sdstest | 13 + .../assignee list of assignment.sdstest | 9 + .../column list of schema.sdstest | 11 + .../constraint list of annotation.sdstest | 11 + .../constraint list of class.sdstest | 11 + .../constraint list of enum variant.sdstest | 15 + .../constraint list of function.sdstest | 11 + ...meter list of annotation (complex).sdstest | 8 + ...arameter list of annotation (long).sdstest | 10 + ...ter list of annotation (unchanged).sdstest | 5 + ...st of annotation (with annotation).sdstest | 9 + .../parameter list of annotation.sdstest | 5 + ...ter list of block lambda (complex).sdstest | 12 + ...ameter list of block lambda (long).sdstest | 14 + ...r list of block lambda (unchanged).sdstest | 9 + ... of block lambda (with annotation).sdstest | 13 + .../parameter list of block lambda.sdstest | 9 + ...er list of callable type (complex).sdstest | 12 + ...meter list of callable type (long).sdstest | 14 + ... list of callable type (unchanged).sdstest | 9 + ...of callable type (with annotation).sdstest | 13 + .../parameter list of callable type.sdstest | 9 + .../parameter list of class (complex).sdstest | 8 + .../parameter list of class (long).sdstest | 10 + ...arameter list of class (unchanged).sdstest | 5 + ...er list of class (with annotation).sdstest | 9 + .../parameter list of class.sdstest | 5 + ...ter list of enum variant (complex).sdstest | 12 + ...ameter list of enum variant (long).sdstest | 14 + ...r list of enum variant (unchanged).sdstest | 9 + ... of enum variant (with annotation).sdstest | 13 + .../parameter list of enum variant.sdstest | 9 + ...ist of expression lambda (complex).sdstest | 12 + ...r list of expression lambda (long).sdstest | 14 + ...t of expression lambda (unchanged).sdstest | 9 + ...xpression lambda (with annotation).sdstest | 13 + ...arameter list of expression lambda.sdstest | 9 + ...rameter list of function (complex).sdstest | 8 + .../parameter list of function (long).sdstest | 10 + ...meter list of function (unchanged).sdstest | 5 + ...list of function (with annotation).sdstest | 9 + .../parameter list of function.sdstest | 5 + ...arameter list of segment (complex).sdstest | 8 + .../parameter list of segment (long).sdstest | 10 + ...ameter list of segment (unchanged).sdstest | 5 + ... list of segment (with annotation).sdstest | 9 + .../parameter list of segment.sdstest | 5 + .../parent type list of class.sdstest | 5 + ...lt list of callable type (complex).sdstest | 12 + ...esult list of callable type (long).sdstest | 14 + ... list of callable type (unchanged).sdstest | 9 + ...of callable type (with annotation).sdstest | 13 + .../result list of callable type.sdstest | 9 + .../result list of function (complex).sdstest | 8 + .../result list of function (long).sdstest | 10 + ...esult list of function (unchanged).sdstest | 5 + ...list of function (with annotation).sdstest | 9 + .../result list of function.sdstest | 5 + .../result list of segment (complex).sdstest | 8 + .../result list of segment (long).sdstest | 10 + ...result list of segment (unchanged).sdstest | 5 + ... list of segment (with annotation).sdstest | 9 + .../result list of segment.sdstest | 5 + ... argument list of call (unchanged).sdstest | 9 + .../type argument list of call.sdstest | 9 + .../type argument list of named type.sdstest | 9 + .../type argument list of union type.sdstest | 9 + ...ype parameter list of class (long).sdstest | 10 + ...arameter list of class (unchanged).sdstest | 5 + ...er list of class (with annotation).sdstest | 9 + .../type parameter list of class.sdstest | 5 + ...ameter list of enum variant (long).sdstest | 14 + ...r list of enum variant (unchanged).sdstest | 9 + ... of enum variant (with annotation).sdstest | 13 + ...ype parameter list of enum variant.sdstest | 9 + ... parameter list of function (long).sdstest | 10 + ...meter list of function (unchanged).sdstest | 5 + ...list of function (with annotation).sdstest | 9 + .../type parameter list of function.sdstest | 5 + ...complex parameter list (unchanged).sdstest | 16 + .../with complex parameter list.sdstest | 12 + ...th complex result list (unchanged).sdstest | 15 + .../with complex result list.sdstest | 12 + .../with long parameter list.sdstest | 14 + .../with long result list.sdstest | 14 + .../with multiple parameters.sdstest | 37 + .../with multiple results.sdstest | 20 + .../with one typed parameter.sdstest | 9 + ... one typed result (in parentheses).sdstest | 9 + ... one typed result (no parentheses).sdstest | 9 + .../with one untyped parameter.sdstest | 9 + ...ne untyped result (in parentheses).sdstest | 9 + ...ne untyped result (no parentheses).sdstest | 9 + .../without parameters or results.sdstest | 9 + .../member types/long complex chain.sdstest | 9 + ...allable) and member (not nullable).sdstest | 9 + ...r (callable) and member (nullable).sdstest | 9 + ...ullable) and member (not nullable).sdstest | 9 + ...ot nullable) and member (nullable).sdstest | 9 + ...ullable) and member (not nullable).sdstest | 9 + ...d, nullable) and member (nullable).sdstest | 9 + ... (union) and member (not nullable).sdstest | 9 + ...iver (union) and member (nullable).sdstest | 9 + ...no type arguments and not nullable.sdstest | 5 + .../no type arguments and nullable.sdstest | 5 + .../type argument and nullable.sdstest | 9 + .../type arguments and not nullable.sdstest | 9 + .../types/union types/empty.sdstest | 5 + .../types/union types/nested.sdstest | 9 + .../union types/with type arguments.sdstest | 9 + .../bad-unclosed argument list.sdstest | 1 - .../good-empty argument list.sdstest | 1 - .../good-multiple arguments.sdstest | 1 - .../good-named argument.sdstest | 1 - .../good-no argument list.sdstest | 1 - .../good-positional argument.sdstest | 1 - .../annotations/good-annotation call.sdstest | 2 + .../good-with sub constraint.sdstest | 2 +- .../good-with super constraint.sdstest | 2 +- .../classes/good-annotation call.sdstest | 2 + .../enums/good-annotation call.sdstest | 2 + .../functions/good-annotation call.sdstest | 2 + .../pipelines/good-annotation call.sdstest | 2 + .../bad-missing body.sdstest} | 2 +- .../bad-missing parameter list.sdstest} | 2 +- ...o visibilities (internal, private).sdstest | 3 + ...o visibilities (private, internal).sdstest | 3 + .../segments/bad-unclosed body.sdstest | 3 + .../bad-unclosed parameter list.sdstest | 2 +- .../segments/good-annotation call.sdstest | 6 + .../segments/good-internal segment.sdstest | 3 + .../good-multiple parameters.sdstest | 2 +- .../good-multiple results.sdstest | 2 +- ...ters and no results and empty body.sdstest | 2 +- .../good-no results (explicit).sdstest | 3 + ...-one typed result (in parentheses).sdstest | 3 + ...-one typed result (no parentheses).sdstest | 3 + ...ne untyped result (no parentheses).sdstest | 3 + ... untyped result (with parentheses).sdstest | 3 + .../segments/good-private segment.sdstest | 3 + .../good-statements in body.sdstest | 2 +- ...good-with typed optional parameter.sdstest | 3 + ...good-with typed required parameter.sdstest | 3 + ...dic parameter (with default value).sdstest | 3 + ...good-with typed variadic parameter.sdstest | 3 + ...od-with untyped optional parameter.sdstest | 3 + ...od-with untyped required parameter.sdstest | 2 +- ...dic parameter (with default value).sdstest | 3 + ...od-with untyped variadic parameter.sdstest | 3 + ...o visibilities (internal, private).sdstest | 3 - ...o visibilities (private, internal).sdstest | 3 - .../steps/good-internal step.sdstest | 3 - .../steps/good-no results (explicit).sdstest | 3 - ...-one typed result (in parentheses).sdstest | 3 - ...-one typed result (no parentheses).sdstest | 3 - ...ne untyped result (no parentheses).sdstest | 3 - ... untyped result (with parentheses).sdstest | 3 - .../steps/good-private step.sdstest | 3 - ...good-with typed optional parameter.sdstest | 3 - ...good-with typed required parameter.sdstest | 3 - ...dic parameter (with default value).sdstest | 3 - ...good-with typed variadic parameter.sdstest | 3 - ...od-with untyped optional parameter.sdstest | 3 - ...dic parameter (with default value).sdstest | 3 - ...od-with untyped variadic parameter.sdstest | 3 - .../bad-unescaped segment.sdstest} | 2 +- .../bad-unescaped step.sdstest | 3 - .../good-escapedKeywords.sdstest | 2 +- .../good-annotation call.sdstest | 4 +- .../grammar/schema/good-one column.sdstest | 2 +- .../grammar/schema/good-two columns.sdstest | 4 +- ... bad-in segment without assignees.sdstest} | 2 +- ...bad-in segment without expression.sdstest} | 2 +- ... bad-in segment without semicolon.sdstest} | 2 +- ...n step.sdstest => good-in segment.sdstest} | 2 +- ...=> bad-empty statement in segment.sdstest} | 2 +- ... bad-in segment without semicolon.sdstest} | 2 +- ...n step.sdstest => good-in segment.sdstest} | 2 +- ...d-argument list of annotation call.sdstest | 2 +- ...od-parameter list of callable type.sdstest | 2 +- ...=> good-parameter list of segment.sdstest} | 4 +- .../good-result list of callable type.sdstest | 2 +- ...st => good-result list of segment.sdstest} | 2 +- ...d-type argument list of named type.sdstest | 2 +- ...d-type argument list of union type.sdstest | 2 +- .../bad-with missing arrow.sdstest | 2 +- .../bad-with missing parameter list.sdstest | 2 +- .../bad-with missing result list.sdstest | 2 +- .../good-with multiple parameters.sdstest | 2 +- .../good-with multiple results.sdstest | 2 +- .../good-with one typed parameter.sdstest | 2 +- ... one typed result (in parentheses).sdstest | 2 +- ... one typed result (no parentheses).sdstest | 2 +- .../good-with one untyped parameter.sdstest | 2 +- ...ne untyped result (in parentheses).sdstest | 2 +- ...ne untyped result (no parentheses).sdstest | 2 +- ...good-without parameters or results.sdstest | 2 +- .../bad-callable type as member.sdstest | 2 +- .../member types/bad-missing member.sdstest | 2 +- .../member types/bad-missing receiver.sdstest | 2 +- .../bad-unclosed angle bracket.sdstest | 2 +- .../bad-union type as member.sdstest | 2 +- .../good-long complex chain.sdstest | 2 +- ...allable) and member (not nullable).sdstest | 2 +- ...r (callable) and member (nullable).sdstest | 2 +- ...ullable) and member (not nullable).sdstest | 2 +- ...ot nullable) and member (nullable).sdstest | 2 +- ...ullable) and member (not nullable).sdstest | 2 +- ...d, nullable) and member (nullable).sdstest | 2 +- ... (union) and member (not nullable).sdstest | 2 +- ...iver (union) and member (nullable).sdstest | 2 +- .../bad-unclosed angle bracket.sdstest | 2 +- ...no type arguments and not nullable.sdstest | 2 +- ...ood-no type arguments and nullable.sdstest | 2 +- .../good-type argument and nullable.sdstest | 2 +- ...od-type arguments and not nullable.sdstest | 2 +- .../bad-unclosed angle bracket.sdstest | 2 +- .../types/union types/good-empty.sdstest | 2 +- .../types/union types/good-nested.sdstest | 2 +- .../good-with type arguments.sdstest | 2 +- DSL/tsconfig.json | 4 +- docs/development/formatting-testing.md | 20 + docs/language/common/parameters.md | 6 +- docs/language/common/results.md | 14 +- docs/language/common/types.md | 4 +- docs/language/pipeline-language/README.md | 6 +- .../language/pipeline-language/expressions.md | 62 +- docs/language/pipeline-language/pipelines.md | 4 +- docs/language/pipeline-language/segments.md | 136 +++ docs/language/pipeline-language/statements.md | 20 +- docs/language/pipeline-language/steps.md | 136 --- docs/language/stub-language/annotations.md | 6 +- docs/stdlib/safeds_lang.md | 15 +- mkdocs.yml | 3 +- 637 files changed, 6873 insertions(+), 352 deletions(-) create mode 100644 DSL/src/language-server/formatting/safe-ds-formatter.ts create mode 100644 DSL/src/language-server/helpers/astShortcuts.ts create mode 100644 DSL/tests/formatting/testFormatter.test.ts create mode 100644 DSL/tests/resources/formatting/comments/before declarations.sdstest create mode 100644 DSL/tests/resources/formatting/comments/before imports.sdstest create mode 100644 DSL/tests/resources/formatting/comments/before module annotations.sdstest create mode 100644 DSL/tests/resources/formatting/comments/before module name.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotation calls/complex argument list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotation calls/empty argument list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotation calls/long argument list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotation calls/multiple arguments.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotation calls/named argument.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotation calls/no argument list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotation calls/positional argument.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/complex parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/empty parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/full.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/long parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/no parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with multiple constraints.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with sub constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with super constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/annotated type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/attributes/annotated.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/attributes/no type.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/attributes/static.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/attributes/with type.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/complex parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/contravariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/contravariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/covariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/covariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/empty body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/empty constraint list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/empty parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/empty type parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/full body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/invariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/long parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/long type parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/annotated type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/empty constraint list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/empty type parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/invariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/multiple results.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/multiple type parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/no parameters and no results.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/no results (explicit).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/one typed result (in parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/one typed result (no parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (no parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (with parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/static.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with multiple constraints.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with sub constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with super constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/minimal.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/multiple parent types.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/multiple type parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/annotated type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/empty body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/empty constraint list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/empty parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/empty type parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/invariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/minimal.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parent types.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/multiple type parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/parent type.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with multiple constraints.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with sub constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with super constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/empty body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/no body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants in body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotated type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/empty type parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/invariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple type parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/no parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with multiple constraints.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with sub constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with super constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/one parent type.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with multiple constraints.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with sub constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with super constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/empty body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/full body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/no body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants in body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/annotated type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/empty type parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/invariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/long parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/multiple type parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/no parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with multiple constraints.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with sub constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with super constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/annotated type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/complex parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/complex result list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/contravariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/contravariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/covariant type parameter with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/covariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/empty constraint list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/empty type parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/invariant type parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/long parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/long result list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/long type parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/multiple results.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/multiple type parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/no parameters and no results.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/no results (explicit).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/one typed result (in parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/one typed result (no parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/one untyped result (no parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/one untyped result (with parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with multiple constraints.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with sub constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with super constraint.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/pipelines/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/pipelines/empty body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/pipelines/statements in body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/complex parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/complex result list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/internal segment with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/internal segment.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/long parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/long result list.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/multiple results.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/no parameters and no results and empty body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/no results (explicit).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/one typed result (in parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/one typed result (no parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/one untyped result (no parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/one untyped result (with parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/private segment with annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/private segment.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/statements in body.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/with typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/with untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/with untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/arithmetic operators/addition.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/arithmetic operators/complex example.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/arithmetic operators/division.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/arithmetic operators/multiplication.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/arithmetic operators/negation.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/arithmetic operators/subtraction.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/filled body.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/long parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/no parameters and empty body.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/with typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/with untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/with untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/complex argument list.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/complex call.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/covariant type argument.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/long argument list.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/named argument.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/named type argument.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/no type argument list and no arguments.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/positional argument.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/positional type argument.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest create mode 100644 DSL/tests/resources/formatting/expressions/calls/star projection.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/comparison operators/greater than or equal.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/comparison operators/greater than.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/comparison operators/less than or equal.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/comparison operators/less than.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/complex chained expression.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/equality operators/equal.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/equality operators/identical.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/equality operators/not equal.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/equality operators/not identical.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/long parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/no parameters.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/typed optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/typed required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/untyped optional parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/untyped required parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/indexed accesses/literal index.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/indexed accesses/reference index.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/false.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/float/basic example.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/float/scientific notation with lowercase e.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/float/scientific notation with uppercase e.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/int/leading zero.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/int/multiple digits.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/int/one digit.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/null.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/basic content.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/closing template expression delimiter.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/curly braces separated by space.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/empty template expression.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/empty.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/escaped curly brace.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/multiple lines.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/newline escape sequence.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/single curly brace.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/single quote.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/template string with basic expression.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/template string with two expressions.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/string/unicode escape sequence.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/literals/true.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/logical operations/complex example.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/logical operations/conjunction.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/logical operations/disjunction.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/logical operations/negation.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/member accesses/not nullable.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/member accesses/nullable.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/parenthesized expressions/nested.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/parenthesized expressions/one level.sdstest create mode 100644 DSL/tests/resources/formatting/expressions/reference.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation call and declaration.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation call and import and declaration.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation call and import.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation call and package name and declaration.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation call and package name and import and declaration.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation call and package name and import.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation call and package name.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation calls and declarations.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation calls and imports and declarations.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation calls and imports.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation calls and package name and declarations.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation calls and package name and imports and declarations.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation calls and package name and imports.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation calls and package name.sdstest create mode 100644 DSL/tests/resources/formatting/modules/annotation calls.sdstest create mode 100644 DSL/tests/resources/formatting/modules/declaration.sdstest create mode 100644 DSL/tests/resources/formatting/modules/declarations.sdstest create mode 100644 DSL/tests/resources/formatting/modules/empty.sdstest create mode 100644 DSL/tests/resources/formatting/modules/full.sdstest create mode 100644 DSL/tests/resources/formatting/modules/import and declaration.sdstest create mode 100644 DSL/tests/resources/formatting/modules/import.sdstest create mode 100644 DSL/tests/resources/formatting/modules/imports and declarations.sdstest create mode 100644 DSL/tests/resources/formatting/modules/imports.sdstest create mode 100644 DSL/tests/resources/formatting/modules/package name and declaration.sdstest create mode 100644 DSL/tests/resources/formatting/modules/package name and declarations.sdstest create mode 100644 DSL/tests/resources/formatting/modules/package name and import and declaration.sdstest create mode 100644 DSL/tests/resources/formatting/modules/package name and import.sdstest create mode 100644 DSL/tests/resources/formatting/modules/package name and imports and declarations.sdstest create mode 100644 DSL/tests/resources/formatting/modules/package name and imports.sdstest create mode 100644 DSL/tests/resources/formatting/modules/package name.sdstest create mode 100644 DSL/tests/resources/formatting/schema/annotationCall.sdstest create mode 100644 DSL/tests/resources/formatting/schema/empty schema.sdstest create mode 100644 DSL/tests/resources/formatting/schema/one column.sdstest create mode 100644 DSL/tests/resources/formatting/schema/two columns.sdstest create mode 100644 DSL/tests/resources/formatting/statements/assignments/in block lambda.sdstest create mode 100644 DSL/tests/resources/formatting/statements/assignments/in pipeline.sdstest create mode 100644 DSL/tests/resources/formatting/statements/assignments/in segment.sdstest create mode 100644 DSL/tests/resources/formatting/statements/expression statements/in block lambda.sdstest create mode 100644 DSL/tests/resources/formatting/statements/expression statements/in pipeline.sdstest create mode 100644 DSL/tests/resources/formatting/statements/expression statements/in segment.sdstest create mode 100644 DSL/tests/resources/formatting/statements/flexible new lines/in block lambda.sdstest create mode 100644 DSL/tests/resources/formatting/statements/flexible new lines/in pipeline.sdstest create mode 100644 DSL/tests/resources/formatting/statements/flexible new lines/in segment.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/argument list of annotation call (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/argument list of annotation call (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/argument list of annotation call.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/argument list of call (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/argument list of call (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/argument list of call.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/assignee list of assignment in block lambda.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/assignee list of assignment.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/column list of schema.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/constraint list of annotation.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/constraint list of class.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/constraint list of enum variant.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/constraint list of function.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of annotation (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of annotation (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of annotation (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of annotation.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of block lambda.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of callable type (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of callable type (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of callable type (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of callable type.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of class (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of class (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of class (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of class.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of enum variant.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of function (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of function (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of function (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of function.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of segment (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of segment (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of segment (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parameter list of segment.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/parent type list of class.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of callable type (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of callable type (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of callable type (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of callable type.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of function (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of function (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of function (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of function.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of segment (complex).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of segment (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of segment (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/result list of segment.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type argument list of call.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type argument list of named type.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type argument list of union type.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of class (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of class (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of class.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant.sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of function (long).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of function (with annotation).sdstest create mode 100644 DSL/tests/resources/formatting/trailing commas/type parameter list of function.sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with complex parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with complex result list.sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with long parameter list.sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with long result list.sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with multiple parameters.sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with multiple results.sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with one typed parameter.sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with one typed result (in parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with one typed result (no parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with one untyped parameter.sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with one untyped result (in parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/with one untyped result (no parentheses).sdstest create mode 100644 DSL/tests/resources/formatting/types/callable types/without parameters or results.sdstest create mode 100644 DSL/tests/resources/formatting/types/member types/long complex chain.sdstest create mode 100644 DSL/tests/resources/formatting/types/member types/receiver (callable) and member (not nullable).sdstest create mode 100644 DSL/tests/resources/formatting/types/member types/receiver (callable) and member (nullable).sdstest create mode 100644 DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (not nullable).sdstest create mode 100644 DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (nullable).sdstest create mode 100644 DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (not nullable).sdstest create mode 100644 DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (nullable).sdstest create mode 100644 DSL/tests/resources/formatting/types/member types/receiver (union) and member (not nullable).sdstest create mode 100644 DSL/tests/resources/formatting/types/member types/receiver (union) and member (nullable).sdstest create mode 100644 DSL/tests/resources/formatting/types/named types/no type arguments and not nullable.sdstest create mode 100644 DSL/tests/resources/formatting/types/named types/no type arguments and nullable.sdstest create mode 100644 DSL/tests/resources/formatting/types/named types/type argument and nullable.sdstest create mode 100644 DSL/tests/resources/formatting/types/named types/type arguments and not nullable.sdstest create mode 100644 DSL/tests/resources/formatting/types/union types/empty.sdstest create mode 100644 DSL/tests/resources/formatting/types/union types/nested.sdstest create mode 100644 DSL/tests/resources/formatting/types/union types/with type arguments.sdstest rename DSL/tests/resources/grammar/declarations/{steps/bad-missing parameter list.sdstest => segments/bad-missing body.sdstest} (54%) rename DSL/tests/resources/grammar/declarations/{steps/bad-unclosed body.sdstest => segments/bad-missing parameter list.sdstest} (53%) create mode 100644 DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (internal, private).sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (private, internal).sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/bad-unclosed body.sdstest rename DSL/tests/resources/grammar/declarations/{steps => segments}/bad-unclosed parameter list.sdstest (52%) create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-annotation call.sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-internal segment.sdstest rename DSL/tests/resources/grammar/declarations/{steps => segments}/good-multiple parameters.sdstest (89%) rename DSL/tests/resources/grammar/declarations/{steps => segments}/good-multiple results.sdstest (76%) rename DSL/tests/resources/grammar/declarations/{steps => segments}/good-no parameters and no results and empty body.sdstest (54%) create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-no results (explicit).sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-one typed result (in parentheses).sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-one typed result (no parentheses).sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-one untyped result (no parentheses).sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-one untyped result (with parentheses).sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-private segment.sdstest rename DSL/tests/resources/grammar/declarations/{steps => segments}/good-statements in body.sdstest (58%) create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-with typed optional parameter.sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-with typed required parameter.sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-with untyped optional parameter.sdstest rename DSL/tests/resources/grammar/declarations/{steps => segments}/good-with untyped required parameter.sdstest (52%) create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest create mode 100644 DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-internal step.sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-no results (explicit).sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-one typed result (in parentheses).sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-one typed result (no parentheses).sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-one untyped result (no parentheses).sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-one untyped result (with parentheses).sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-private step.sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-with typed optional parameter.sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-with typed required parameter.sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-with typed variadic parameter (with default value).sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-with typed variadic parameter.sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-with untyped optional parameter.sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-with untyped variadic parameter (with default value).sdstest delete mode 100644 DSL/tests/resources/grammar/declarations/steps/good-with untyped variadic parameter.sdstest rename DSL/tests/resources/grammar/{declarations/steps/bad-missing body.sdstest => keywords as names/bad-unescaped segment.sdstest} (63%) delete mode 100644 DSL/tests/resources/grammar/keywords as names/bad-unescaped step.sdstest rename DSL/tests/resources/grammar/{declarations/steps => schema}/good-annotation call.sdstest (54%) rename DSL/tests/resources/grammar/statements/assignments/{bad-in step without assignees.sdstest => bad-in segment without assignees.sdstest} (61%) rename DSL/tests/resources/grammar/statements/assignments/{bad-in step without expression.sdstest => bad-in segment without expression.sdstest} (63%) rename DSL/tests/resources/grammar/statements/assignments/{bad-in step without semicolon.sdstest => bad-in segment without semicolon.sdstest} (64%) rename DSL/tests/resources/grammar/statements/assignments/{good-in step.sdstest => good-in segment.sdstest} (77%) rename DSL/tests/resources/grammar/statements/{bad-empty statement in step.sdstest => bad-empty statement in segment.sdstest} (59%) rename DSL/tests/resources/grammar/statements/expression statements/{bad-in step without semicolon.sdstest => bad-in segment without semicolon.sdstest} (62%) rename DSL/tests/resources/grammar/statements/expression statements/{good-in step.sdstest => good-in segment.sdstest} (65%) rename DSL/tests/resources/grammar/trailing commas/{good-parameter list of step.sdstest => good-parameter list of segment.sdstest} (65%) rename DSL/tests/resources/grammar/trailing commas/{good-result list of step.sdstest => good-result list of segment.sdstest} (79%) create mode 100644 docs/development/formatting-testing.md create mode 100644 docs/language/pipeline-language/segments.md delete mode 100644 docs/language/pipeline-language/steps.md diff --git a/DSL/package-lock.json b/DSL/package-lock.json index 891b96b05..359343821 100644 --- a/DSL/package-lock.json +++ b/DSL/package-lock.json @@ -17,6 +17,7 @@ "true-myth": "^6.2.0", "vscode-languageclient": "^8.1.0", "vscode-languageserver": "^8.1.0", + "vscode-languageserver-types": "^3.17.3", "vscode-uri": "^3.0.7" }, "bin": { diff --git a/DSL/package.json b/DSL/package.json index ec0abb1d1..47a33ff83 100644 --- a/DSL/package.json +++ b/DSL/package.json @@ -64,6 +64,7 @@ "true-myth": "^6.2.0", "vscode-languageclient": "^8.1.0", "vscode-languageserver": "^8.1.0", + "vscode-languageserver-types": "^3.17.3", "vscode-uri": "^3.0.7" }, "devDependencies": { diff --git a/DSL/src/language-server/formatting/safe-ds-formatter.ts b/DSL/src/language-server/formatting/safe-ds-formatter.ts new file mode 100644 index 000000000..e65c26d68 --- /dev/null +++ b/DSL/src/language-server/formatting/safe-ds-formatter.ts @@ -0,0 +1,921 @@ +import { AbstractFormatter, AstNode, CstNode, findCommentNode, Formatting, isAstNode } from 'langium'; +import * as ast from '../generated/ast'; +import { SdsImport, SdsImportAlias, SdsModule } from '../generated/ast'; +import { annotationCallsOrEmpty, typeArgumentsOrEmpty } from '../helpers/astShortcuts'; +import { FormattingAction, FormattingActionOptions } from 'langium/src/lsp/formatter'; +import noSpace = Formatting.noSpace; +import newLine = Formatting.newLine; +import newLines = Formatting.newLines; +import oneSpace = Formatting.oneSpace; +import indent = Formatting.indent; + +const newLinesWithIndent = function (count: number, options?: FormattingActionOptions): FormattingAction { + return { + options: options ?? {}, + moves: [ + { + tabs: 1, + lines: count, + }, + ], + }; +}; + +export class SafeDSFormatter extends AbstractFormatter { + protected override format(node: AstNode): void { + // ----------------------------------------------------------------------------- + // Module + // ----------------------------------------------------------------------------- + if (ast.isSdsModule(node)) { + this.formatSdsModule(node); + } else if (ast.isSdsImport(node)) { + this.formatSdsImport(node); + } else if (ast.isSdsImportAlias(node)) { + this.formatSdsImportAlias(node); + } + + // ----------------------------------------------------------------------------- + // Declarations + // ----------------------------------------------------------------------------- + else if (ast.isSdsAnnotation(node)) { + this.formatSdsAnnotation(node); + } else if (ast.isSdsAttribute(node)) { + this.formatSdsAttribute(node); + } else if (ast.isSdsClass(node)) { + this.formatSdsClass(node); + } else if (ast.isSdsParentTypeList(node)) { + this.formatSdsParentTypeList(node); + } else if (ast.isSdsClassBody(node)) { + this.formatSdsClassBody(node); + } else if (ast.isSdsEnum(node)) { + this.formatSdsEnum(node); + } else if (ast.isSdsEnumBody(node)) { + this.formatSdsEnumBody(node); + } else if (ast.isSdsEnumVariant(node)) { + this.formatSdsEnumVariant(node); + } else if (ast.isSdsFunction(node)) { + this.formatSdsFunction(node); + } else if (ast.isSdsPipeline(node)) { + this.formatSdsPipeline(node); + } else if (ast.isSdsSegment(node)) { + this.formatSdsSegment(node); + } + + // ----------------------------------------------------------------------------- + // Annotation calls + // ----------------------------------------------------------------------------- + else if (ast.isSdsAnnotationCallList(node)) { + this.formatSdsAnnotationCallList(node); + } else if (ast.isSdsAnnotationCall(node)) { + this.formatSdsAnnotationCall(node); + } + + // ----------------------------------------------------------------------------- + // Constraints + // ----------------------------------------------------------------------------- + else if (ast.isSdsConstraintList(node)) { + this.formatSdsConstraintList(node); + } else if (ast.isSdsTypeParameterConstraint(node)) { + this.formatSdsTypeParameterConstraint(node); + } + + // ----------------------------------------------------------------------------- + // Callables, parameters, and results + // ----------------------------------------------------------------------------- + else if (ast.isSdsParameterList(node)) { + this.formatSdsParameterList(node); + } else if (ast.isSdsParameter(node)) { + this.formatSdsParameter(node); + } else if (ast.isSdsResultList(node)) { + this.formatSdsResultList(node); + } else if (ast.isSdsResult(node)) { + this.formatSdsResult(node); + } + + // ----------------------------------------------------------------------------- + // Statements + // ----------------------------------------------------------------------------- + else if (ast.isSdsBlock(node)) { + this.formatSdsBlock(node); + } else if (ast.isSdsAssignment(node)) { + this.formatSdsAssignment(node); + } else if (ast.isSdsAssigneeList(node)) { + this.formatSdsAssigneeList(node); + } else if (ast.isSdsPlaceholder(node)) { + this.formatSdsPlaceholder(node); + } else if (ast.isSdsYield(node)) { + this.formatSdsYield(node); + } else if (ast.isSdsExpressionStatement(node)) { + this.formatSdsExpressionStatement(node); + } + + // ----------------------------------------------------------------------------- + // Expressions + // ----------------------------------------------------------------------------- + else if (ast.isSdsBlockLambda(node)) { + this.formatSdsBlockLambda(node); + } else if (ast.isSdsBlockLambdaResult(node)) { + this.formatSdsBlockLambdaResult(node); + } else if (ast.isSdsExpressionLambda(node)) { + this.formatSdsExpressionLambda(node); + } else if (ast.isSdsInfixOperation(node)) { + this.formatSdsInfixOperation(node); + } else if (ast.isSdsPrefixOperation(node)) { + this.formatSdsPrefixOperation(node); + } else if (ast.isSdsCall(node)) { + this.formatSdsCall(node); + } else if (ast.isSdsArgumentList(node)) { + this.formatSdsArgumentList(node); + } else if (ast.isSdsArgument(node)) { + this.formatSdsArgument(node); + } else if (ast.isSdsIndexedAccess(node)) { + this.formatSdsIndexedAccess(node); + } else if (ast.isSdsMemberAccess(node)) { + this.formatSdsMemberAccess(node); + } else if (ast.isSdsParenthesizedExpression(node)) { + this.formatSdsParenthesizedExpression(node); + } else if (ast.isSdsTemplateStringStart(node)) { + this.formatSdsTemplateStringStart(node); + } else if (ast.isSdsTemplateStringInner(node)) { + this.formatSdsTemplateStringInner(node); + } else if (ast.isSdsTemplateStringEnd(node)) { + this.formatSdsTemplateStringEnd(node); + } + + // ----------------------------------------------------------------------------- + // Types + // ----------------------------------------------------------------------------- + else if (ast.isSdsMemberType(node)) { + this.formatSdsMemberType(node); + } else if (ast.isSdsCallableType(node)) { + this.formatSdsCallableType(node); + } else if (ast.isSdsNamedType(node)) { + this.formatSdsNamedType(node); + } else if (ast.isSdsUnionType(node)) { + this.formatSdsUnionType(node); + } else if (ast.isSdsTypeParameterList(node)) { + this.formatSdsTypeParameterList(node); + } else if (ast.isSdsTypeParameter(node)) { + this.formatSdsTypeParameter(node); + } else if (ast.isSdsTypeArgumentList(node)) { + this.formatSdsTypeArgumentList(node); + } else if (ast.isSdsTypeArgument(node)) { + this.formatSdsTypeArgument(node); + } else if (ast.isSdsTypeProjection(node)) { + this.formatSdsTypeProjection(node); + } + + // ----------------------------------------------------------------------------- + // Schemas + // ----------------------------------------------------------------------------- + else if (ast.isSdsSchema(node)) { + this.formatSdsSchema(node); + } else if (ast.isSdsColumnList(node)) { + this.formatSdsColumnList(node); + } else if (ast.isSdsColumn(node)) { + this.formatSdsColumn(node); + } + } + + // ----------------------------------------------------------------------------- + // Module + // ----------------------------------------------------------------------------- + + private formatSdsModule(node: SdsModule): void { + const formatter = this.getNodeFormatter(node); + const annotations = annotationCallsOrEmpty(node); + const name = node.name; + const imports = node.imports; + const members = node.members; + + // Annotations + annotations.forEach((value, index) => { + if (index === 0) { + if (this.hasComment(value)) { + formatter.node(value).prepend(newLine()); + } else { + formatter.node(value).prepend(noSpace()); + } + } else { + formatter.node(value).prepend(newLines(1)); + } + }); + + // Package + if (annotations.length === 0) { + const packageKeyword = formatter.keyword('package'); + const cstNodes = packageKeyword.nodes; + + if (cstNodes.length > 0 && this.hasComment(cstNodes[0])) { + packageKeyword.prepend(newLine()); + } else { + packageKeyword.prepend(noSpace()); + } + } else { + formatter.keyword('package').prepend(newLines(2)); + } + formatter.keyword('package').append(oneSpace()); + formatter.keyword('.').surround(noSpace()); + + // Imports + imports.forEach((value, index) => { + if (index === 0) { + if (annotations.length === 0 && !name) { + if (this.hasComment(value)) { + formatter.node(value).prepend(newLine()); + } else { + formatter.node(value).prepend(noSpace()); + } + } else { + formatter.node(value).prepend(newLines(2)); + } + } else { + formatter.node(value).prepend(newLines(1)); + } + }); + + // Members + members.forEach((value, index) => { + if (index === 0) { + if (annotations.length === 0 && !name && imports.length === 0) { + if (this.hasComment(value)) { + formatter.node(value).prepend(newLine()); + } else { + formatter.node(value).prepend(noSpace()); + } + } else { + const valueAnnotations = annotationCallsOrEmpty(value); + if (valueAnnotations.length > 0) { + formatter.node(valueAnnotations[0]).prepend(newLines(2)); + } else { + formatter.node(value).prepend(newLines(2)); + } + } + } else { + const valueAnnotations = annotationCallsOrEmpty(value); + if (valueAnnotations.length > 0) { + formatter.node(valueAnnotations[0]).prepend(newLines(2)); + } else { + formatter.node(value).prepend(newLines(2)); + } + } + }); + } + + private formatSdsImport(node: SdsImport): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('import').append(oneSpace()); + formatter.keyword('.').surround(noSpace()); + } + + private formatSdsImportAlias(node: SdsImportAlias): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('as').surround(Formatting.oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Declarations + // ----------------------------------------------------------------------------- + + private formatSdsAnnotation(node: ast.SdsAnnotation): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('annotation').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('constraintList').prepend(oneSpace()); + } + + private formatSdsAttribute(node: ast.SdsAttribute): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + if (node.static) { + formatter.keyword('static').prepend(newLine()); + } else { + formatter.keyword('attr').prepend(newLine()); + } + } + + formatter.keyword('static').append(oneSpace()); + formatter.property('name').prepend(oneSpace()); + formatter.keyword(':').prepend(noSpace()).append(oneSpace()); + } + + private formatSdsClass(node: ast.SdsClass): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('class').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('typeParameterList').prepend(noSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('parentTypeList').prepend(oneSpace()); + formatter.property('constraintList').prepend(oneSpace()); + + if (node.constraintList) { + formatter.property('body').prepend(newLine()); + } else { + formatter.property('body').prepend(oneSpace()); + } + } + + formatSdsParentTypeList(node: ast.SdsParentTypeList): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('sub').append(oneSpace()); + formatter.keywords(',').prepend(noSpace()).append(oneSpace()); + } + + private formatSdsClassBody(node: ast.SdsClassBody): void { + const formatter = this.getNodeFormatter(node); + + const members = node.members ?? []; + if (members.length === 0) { + formatter.keyword('{').append(noSpace()); + formatter.keyword('}').prepend(noSpace()); + } else { + members.forEach((value, index) => { + if (index === 0) { + formatter.node(value).prepend(indent()); + } else { + formatter.node(value).prepend(newLinesWithIndent(2)); + } + }); + formatter.keyword('}').prepend(newLine()); + } + } + + private formatSdsEnum(node: ast.SdsEnum): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('enum').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('body').prepend(oneSpace()); + } + + private formatSdsEnumBody(node: ast.SdsEnumBody): void { + const formatter = this.getNodeFormatter(node); + + const variants = node.variants ?? []; + if (variants.length === 0) { + formatter.keyword('{').append(noSpace()); + formatter.keyword('}').prepend(noSpace()); + } else { + variants.forEach((value, index) => { + if (index === 0) { + formatter.node(value).prepend(indent()); + } else { + formatter.node(value).prepend(newLinesWithIndent(2)); + } + }); + formatter.keyword('}').prepend(newLine()); + } + } + + private formatSdsEnumVariant(node: ast.SdsEnumVariant): void { + const formatter = this.getNodeFormatter(node); + + const annotationCalls = annotationCallsOrEmpty(node); + + formatter.nodes(...annotationCalls.slice(1)).prepend(newLine()); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.property('name').prepend(newLine()); + } + + formatter.property('typeParameterList').prepend(noSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('constraintList').prepend(oneSpace()); + } + + formatSdsFunction(node: ast.SdsFunction): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + if (node.static) { + formatter.keyword('static').prepend(newLine()); + } else { + formatter.keyword('fun').prepend(newLine()); + } + } + + formatter.keyword('static').append(oneSpace()); + formatter.property('name').prepend(oneSpace()); + formatter.property('typeParameterList').prepend(noSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('resultList').prepend(oneSpace()); + formatter.property('constraintList').prepend(oneSpace()); + } + + private formatSdsPipeline(node: ast.SdsPipeline): void { + const formatter = this.getNodeFormatter(node); + + formatter.property('annotationCallList').prepend(noSpace()); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('pipeline').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.node(node.body).prepend(oneSpace()); + } + + private formatSdsSegment(node: ast.SdsSegment): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length === 0) { + if (node.visibility) { + formatter.keyword('segment').prepend(oneSpace()); + } + } else { + if (node.visibility) { + formatter.property('visibility').prepend(newLine()); + formatter.keyword('segment').prepend(oneSpace()); + } else { + formatter.keyword('segment').prepend(newLine()); + } + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('parameterList').prepend(noSpace()); + formatter.property('resultList').prepend(oneSpace()); + formatter.property('body').prepend(oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Annotation calls + // ----------------------------------------------------------------------------- + + private formatSdsAnnotationCallList(node: ast.SdsAnnotationCallList): void { + const formatter = this.getNodeFormatter(node); + const annotationCalls = node.annotationCalls ?? []; + + formatter.nodes(...annotationCalls.slice(1)).prepend(newLine()); + } + + private formatSdsAnnotationCall(node: ast.SdsAnnotationCall): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('@').append(noSpace()); + formatter.property('argumentList').prepend(noSpace()); + } + + // ----------------------------------------------------------------------------- + // Constraints + // ----------------------------------------------------------------------------- + + private formatSdsConstraintList(node: ast.SdsConstraintList) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('where').append(oneSpace()); + + const openingBrace = formatter.keyword('{'); + const closingBrace = formatter.keyword('}'); + + const constraints = node.constraints ?? []; + + if (constraints.length === 0) { + openingBrace.append(noSpace()); + closingBrace.prepend(noSpace()); + } else { + formatter.nodes(...constraints).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingBrace.prepend(newLine()); + } + } + + private formatSdsTypeParameterConstraint(node: ast.SdsTypeParameterConstraint) { + const formatter = this.getNodeFormatter(node); + + formatter.property('operator').surround(oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Callables, parameters, and results + // ----------------------------------------------------------------------------- + + private formatSdsParameterList(node: ast.SdsParameterList): void { + const formatter = this.getNodeFormatter(node); + + const openingParenthesis = formatter.keyword('('); + const closingParenthesis = formatter.keyword(')'); + + const parameters = node.parameters ?? []; + + if ( + parameters.length >= 3 || + parameters.some((it) => annotationCallsOrEmpty(it).length > 0 || this.isComplexType(it.type)) + ) { + formatter.nodes(...parameters).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(newLine()); + } else { + openingParenthesis.append(noSpace()); + formatter.nodes(...parameters.slice(1)).prepend(oneSpace()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(noSpace()); + } + } + + private formatSdsParameter(node: ast.SdsParameter): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length === 0) { + if (node.variadic) { + formatter.property('name').prepend(oneSpace()); + } + } else { + formatter.property('name').prepend(newLine()); + } + + formatter.keyword(':').prepend(noSpace()).append(oneSpace()); + formatter.keyword('=').surround(oneSpace()); + } + + private formatSdsResultList(node: ast.SdsResultList): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('->').surround(oneSpace()); + + const openingParenthesis = formatter.keyword('('); + const closingParenthesis = formatter.keyword(')'); + + const results = node.results ?? []; + + if ( + results.length >= 3 || + results.some((it) => annotationCallsOrEmpty(it).length > 0 || this.isComplexType(it.type)) + ) { + formatter.nodes(...results).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(newLine()); + } else { + openingParenthesis.append(noSpace()); + formatter.nodes(...results.slice(1)).prepend(oneSpace()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(noSpace()); + } + } + + private formatSdsResult(node: ast.SdsResult): void { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.property('name').prepend(newLine()); + } + + formatter.keyword(':').prepend(noSpace()).append(oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Statements + // ----------------------------------------------------------------------------- + + private formatSdsBlock(node: ast.SdsBlock): void { + const formatter = this.getNodeFormatter(node); + const openingBrace = formatter.keyword('{'); + const closingBrace = formatter.keyword('}'); + + if (node.statements.length === 0) { + openingBrace.append(noSpace()); + closingBrace.prepend(noSpace()); + } else { + formatter.nodes(...node.statements).prepend(indent({ allowMore: true })); + closingBrace.prepend(newLine()); + } + } + + private formatSdsAssignment(node: ast.SdsAssignment) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('=').surround(oneSpace()); + formatter.keyword(';').prepend(noSpace()); + } + + private formatSdsAssigneeList(node: ast.SdsAssigneeList) { + const formatter = this.getNodeFormatter(node); + + formatter.keywords(',').prepend(noSpace()).append(oneSpace()); + } + + private formatSdsPlaceholder(node: ast.SdsPlaceholder) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('val').append(oneSpace()); + } + + private formatSdsYield(node: ast.SdsYield) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('yield').append(oneSpace()); + formatter.property('result').prepend(oneSpace()); + } + + private formatSdsExpressionStatement(node: ast.SdsExpressionStatement) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword(';').prepend(noSpace()); + } + + // ----------------------------------------------------------------------------- + // Expressions + // ----------------------------------------------------------------------------- + + private formatSdsBlockLambda(node: ast.SdsBlockLambda): void { + const formatter = this.getNodeFormatter(node); + + formatter.property('body').prepend(oneSpace()); + } + + private formatSdsBlockLambdaResult(node: ast.SdsBlockLambdaResult) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('yield').append(oneSpace()); + } + + private formatSdsExpressionLambda(node: ast.SdsExpressionLambda) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('->').surround(oneSpace()); + } + + private formatSdsInfixOperation(node: ast.SdsInfixOperation) { + const formatter = this.getNodeFormatter(node); + + formatter.property('operator').surround(oneSpace()); + } + + private formatSdsPrefixOperation(node: ast.SdsPrefixOperation) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('not').append(oneSpace()); + formatter.keyword('-').append(noSpace()); + } + + private formatSdsCall(node: ast.SdsCall) { + const formatter = this.getNodeFormatter(node); + + formatter.property('typeArgumentList').prepend(noSpace()); + formatter.property('argumentList').prepend(noSpace()); + } + + private formatSdsArgumentList(node: ast.SdsArgumentList): void { + const formatter = this.getNodeFormatter(node); + + const openingParenthesis = formatter.keyword('('); + const closingParenthesis = formatter.keyword(')'); + + const args = node.arguments ?? []; + + if (args.length >= 3 || args.some((it) => this.isComplexExpression(it.value))) { + formatter.nodes(...args).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(newLine()); + } else { + openingParenthesis.append(noSpace()); + formatter.nodes(...args.slice(1)).prepend(oneSpace()); + formatter.keywords(',').prepend(noSpace()); + closingParenthesis.prepend(noSpace()); + } + } + + private formatSdsArgument(node: ast.SdsArgument): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('=').surround(oneSpace()); + } + + private formatSdsIndexedAccess(node: ast.SdsIndexedAccess) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('[').surround(noSpace()); + formatter.keyword(']').prepend(noSpace()); + } + + private formatSdsMemberAccess(node: ast.SdsMemberAccess) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('?').surround(noSpace()); + formatter.keyword('.').surround(noSpace()); + } + + private formatSdsParenthesizedExpression(node: ast.SdsParenthesizedExpression): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('(').append(noSpace()); + formatter.keyword(')').prepend(noSpace()); + } + + private formatSdsTemplateStringStart(node: ast.SdsTemplateStringStart) { + const formatter = this.getNodeFormatter(node); + + formatter.node(node).append(oneSpace()); + } + + private formatSdsTemplateStringInner(node: ast.SdsTemplateStringInner) { + const formatter = this.getNodeFormatter(node); + + formatter.node(node).surround(oneSpace()); + } + + private formatSdsTemplateStringEnd(node: ast.SdsTemplateStringEnd) { + const formatter = this.getNodeFormatter(node); + + formatter.node(node).prepend(oneSpace()); + } + + /** + * Returns whether the expression is considered complex and requires special formatting like placing the associated + * argument on its own line. + * + * @param node The expression to check. + */ + private isComplexExpression(node: ast.SdsExpression | undefined): boolean { + return ast.isSdsChainedExpression(node); + } + + // ----------------------------------------------------------------------------- + // Types + // ----------------------------------------------------------------------------- + + private formatSdsMemberType(node: ast.SdsMemberType) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('.').surround(noSpace()); + } + + private formatSdsCallableType(node: ast.SdsCallableType) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('->').surround(oneSpace()); + } + + private formatSdsNamedType(node: ast.SdsNamedType) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('?').prepend(noSpace()); + formatter.property('typeArgumentList').prepend(noSpace()); + } + + private formatSdsUnionType(node: ast.SdsUnionType): void { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('union').append(noSpace()); + } + + private formatSdsTypeParameterList(node: ast.SdsTypeParameterList): void { + const formatter = this.getNodeFormatter(node); + + const closingBracket = formatter.keyword('>'); + + const typeParameters = node.typeParameters ?? []; + + if (typeParameters.length >= 3 || typeParameters.some((it) => annotationCallsOrEmpty(it).length > 0)) { + formatter.nodes(...typeParameters).prepend(indent()); + formatter.keywords(',').prepend(noSpace()); + closingBracket.prepend(newLine()); + } else { + if (typeParameters.length > 0) { + formatter.node(typeParameters[0]).prepend(noSpace()); + formatter.nodes(...typeParameters.slice(1)).prepend(oneSpace()); + } + formatter.keywords(',').prepend(noSpace()); + closingBracket.prepend(noSpace()); + } + } + + private formatSdsTypeParameter(node: ast.SdsTypeParameter) { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + if (node.variance) { + formatter.property('variance').prepend(newLine()); + } else { + formatter.property('name').prepend(newLine()); + } + } + + formatter.property('variance').append(oneSpace()); + } + + private formatSdsTypeArgumentList(node: ast.SdsTypeArgumentList): void { + const formatter = this.getNodeFormatter(node); + const typeArguments = node.typeArguments ?? []; + + if (typeArguments.length > 0) { + formatter.node(typeArguments[0]).prepend(noSpace()); + formatter.nodes(...typeArguments.slice(1)).prepend(oneSpace()); + } + + formatter.keywords(',').prepend(noSpace()); + formatter.keyword('>').prepend(noSpace()); + } + + private formatSdsTypeArgument(node: ast.SdsTypeArgument) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword('=').surround(oneSpace()); + } + + private formatSdsTypeProjection(node: ast.SdsTypeProjection) { + const formatter = this.getNodeFormatter(node); + + formatter.property('variance').append(oneSpace()); + } + + /** + * Returns whether the type is considered complex and requires special formatting like placing the associated + * parameter on its own line. + * + * @param node The type to check. + */ + private isComplexType(node: ast.SdsType | undefined): boolean { + if (!node) { + return false; + } + + if (ast.isSdsCallableType(node) || ast.isSdsMemberType(node)) { + return true; + } else if (ast.isSdsUnionType(node)) { + return typeArgumentsOrEmpty(node.typeArgumentList).length > 0; + } else if (ast.isSdsNamedType(node)) { + return typeArgumentsOrEmpty(node.typeArgumentList).length > 0; + } else { + return false; + } + } + + // ----------------------------------------------------------------------------- + // Schemas + // ----------------------------------------------------------------------------- + + private formatSdsSchema(node: ast.SdsSchema) { + const formatter = this.getNodeFormatter(node); + + if (annotationCallsOrEmpty(node).length > 0) { + formatter.keyword('schema').prepend(newLine()); + } + + formatter.property('name').prepend(oneSpace()); + formatter.property('columnList').prepend(oneSpace()); + } + + private formatSdsColumnList(node: ast.SdsColumnList) { + const formatter = this.getNodeFormatter(node); + const columns = node.columns ?? []; + + if (columns.length === 0) { + formatter.keyword('{').append(noSpace()); + formatter.keyword('}').prepend(noSpace()); + } else { + formatter.nodes(...columns).prepend(indent()); + formatter.keywords(',').prepend(noSpace()).append(newLine()); + formatter.keyword('}').prepend(newLine()); + } + } + + private formatSdsColumn(node: ast.SdsColumn) { + const formatter = this.getNodeFormatter(node); + + formatter.keyword(':').prepend(noSpace()).append(oneSpace()); + } + + // ----------------------------------------------------------------------------- + // Helpers + // ----------------------------------------------------------------------------- + + /** + * Returns whether the given node has a comment associated with it. + * + * @param node The node to check. + */ + private hasComment(node: AstNode | CstNode | undefined): boolean { + return Boolean(this.getCommentNode(node)); + } + + /** + * Returns the comment associated with the given node. + * + * @param node The node to get the comment for. + */ + private getCommentNode(node: AstNode | CstNode | undefined): CstNode | undefined { + const commentNames = ['ML_COMMENT', 'SL_COMMENT']; + + if (isAstNode(node)) { + return findCommentNode(node.$cstNode, commentNames); + } else { + return findCommentNode(node, commentNames); + } + } +} diff --git a/DSL/src/language-server/grammar/safe-ds.langium b/DSL/src/language-server/grammar/safe-ds.langium index 4b889faeb..61dbfe921 100644 --- a/DSL/src/language-server/grammar/safe-ds.langium +++ b/DSL/src/language-server/grammar/safe-ds.langium @@ -103,8 +103,8 @@ SdsAnnotatedModuleMember returns SdsAnnotatedObject: | {SdsPipeline.annotationCallList=current} SdsPipelineFragment - | {SdsStep.annotationCallList=current} - SdsStepFragment + | {SdsSegment.annotationCallList=current} + SdsSegmentFragment ) ; @@ -127,8 +127,8 @@ SdsUnannotatedModuleMember returns SdsAnnotatedObject: | {SdsPipeline} SdsPipelineFragment - | {SdsStep} - SdsStepFragment + | {SdsSegment} + SdsSegmentFragment ; interface SdsAnnotation extends SdsCallable, SdsModuleMember { @@ -287,15 +287,15 @@ fragment SdsPipelineFragment: body=SdsBlock ; -interface SdsStep extends SdsCallable, SdsModuleMember { +interface SdsSegment extends SdsCallable, SdsModuleMember { visibility?: string resultList?: SdsResultList body: SdsBlock } -fragment SdsStepFragment: +fragment SdsSegmentFragment: visibility=('internal' | 'private')? - 'step' + 'segment' name=ID parameterList=SdsParameterList resultList=SdsResultList? diff --git a/DSL/src/language-server/helpers/astShortcuts.ts b/DSL/src/language-server/helpers/astShortcuts.ts new file mode 100644 index 000000000..6301f9a46 --- /dev/null +++ b/DSL/src/language-server/helpers/astShortcuts.ts @@ -0,0 +1,26 @@ +// SdsAbstractDeclaration -------------------------------------------------------------------------- +import { + isSdsDeclaration, + SdsAnnotatedObject, + SdsAnnotationCall, + SdsClass, + SdsObject, + SdsTypeArgument, + SdsTypeArgumentList, +} from '../generated/ast'; + +export const annotationCallsOrEmpty = function (node: SdsAnnotatedObject): SdsAnnotationCall[] { + if (isSdsDeclaration(node)) { + return node?.annotationCallList?.annotationCalls ?? node?.annotationCalls ?? []; + } else { + return node?.annotationCalls ?? []; + } +}; + +export const classMembersOrEmpty = function (node: SdsClass): SdsObject[] { + return node.body?.members ?? []; +}; + +export const typeArgumentsOrEmpty = function (node: SdsTypeArgumentList | undefined): SdsTypeArgument[] { + return node?.typeArguments ?? []; +}; diff --git a/DSL/src/language-server/safe-ds-module.ts b/DSL/src/language-server/safe-ds-module.ts index 744db53b2..9c69eef26 100644 --- a/DSL/src/language-server/safe-ds-module.ts +++ b/DSL/src/language-server/safe-ds-module.ts @@ -10,6 +10,7 @@ import { } from 'langium'; import { SafeDsGeneratedModule, SafeDsGeneratedSharedModule } from './generated/module'; import { SafeDsValidator, registerValidationChecks } from './validation/safe-ds-validator'; +import { SafeDSFormatter } from './formatting/safe-ds-formatter'; /** * Declaration of custom services - add your own service classes here. @@ -32,6 +33,9 @@ export type SafeDsServices = LangiumServices & SafeDsAddedServices; * selected services, while the custom services must be fully specified. */ export const SafeDsModule: Module = { + lsp: { + Formatter: () => new SafeDSFormatter(), + }, validation: { SafeDsValidator: () => new SafeDsValidator(), }, diff --git a/DSL/syntaxes/safe-ds.tmLanguage.json b/DSL/syntaxes/safe-ds.tmLanguage.json index 65cccd1f7..44789e2b4 100644 --- a/DSL/syntaxes/safe-ds.tmLanguage.json +++ b/DSL/syntaxes/safe-ds.tmLanguage.json @@ -12,7 +12,7 @@ }, { "name": "keyword.control.safe-ds", - "match": "\\b(and|annotation|as|attr|class|enum|false|fun|import|in|internal|not|null|or|out|package|pipeline|private|schema|static|step|sub|super|true|union|val|vararg|where|yield)\\b" + "match": "\\b(and|annotation|as|attr|class|enum|false|fun|import|in|internal|not|null|or|out|package|pipeline|private|schema|segment|static|sub|super|true|union|val|vararg|where|yield)\\b" }, { "name": "string.quoted.double.safe-ds", diff --git a/DSL/tests/formatting/testFormatter.test.ts b/DSL/tests/formatting/testFormatter.test.ts new file mode 100644 index 000000000..fa6df4463 --- /dev/null +++ b/DSL/tests/formatting/testFormatter.test.ts @@ -0,0 +1,93 @@ +import { createSafeDsServices } from '../../src/language-server/safe-ds-module'; +import { expectFormatting, validationHelper } from 'langium/test'; +import { describe, it } from 'vitest'; +import { EmptyFileSystem } from 'langium'; +import { listTestResources, resolvePathRelativeToResources } from '../helpers/testResources'; +import path from 'path'; +import fs from 'fs'; +import { Diagnostic } from 'vscode-languageserver-types'; + +const services = createSafeDsServices({ ...EmptyFileSystem }).SafeDs; +const separator = '// -----------------------------------------------------------------------------'; + +describe('formatter', async () => { + it.each(await createFormatterTest())('$testName', async (test) => { + if (test.error) { + throw test.error; + } + + await expectFormatting(services)({ + before: test.originalCode, + after: test.expectedFormattedCode, + }); + }); +}); + +const createFormatterTest = async (): Promise => { + const testCases = listTestResources('formatting').map(async (pathRelativeToResources): Promise => { + const absolutePath = resolvePathRelativeToResources(path.join('formatting', pathRelativeToResources)); + const program = fs.readFileSync(absolutePath).toString(); + const parts = program.split(separator); + + // Must contain exactly one separator + if (parts.length !== 2) { + return { + testName: `INVALID TEST FILE [${pathRelativeToResources}]`, + originalCode: '', + expectedFormattedCode: '', + error: new SeparatorError(parts.length - 1), + }; + } + + // Original code must not contain syntax errors + const originalCode = normalizeLineBreaks(parts[0]).trimEnd(); + const expectedFormattedCode = normalizeLineBreaks(parts[1]).trim(); + + const validationResult = await validationHelper(services)(parts[0]); + const syntaxErrors = validationResult.diagnostics.filter( + (d) => d.severity === 1 && (d.code === 'lexing-error' || d.code === 'parsing-error'), + ); + + if (syntaxErrors.length > 0) { + return { + testName: `INVALID TEST FILE [${pathRelativeToResources}]`, + originalCode, + expectedFormattedCode, + error: new SyntaxErrorsInOriginalCodeError(syntaxErrors), + }; + } + + return { + testName: `${pathRelativeToResources} should be formatted correctly`, + originalCode, + expectedFormattedCode, + }; + }); + + return Promise.all(testCases); +}; + +const normalizeLineBreaks = (code: string): string => { + return code.replace(/\r\n?/gu, '\n'); +}; + +interface FormatterTest { + testName: string; + originalCode: string; + expectedFormattedCode: string; + error?: Error; +} + +class SeparatorError extends Error { + constructor(readonly number_of_separators: number) { + super(`Expected exactly one separator but found ${number_of_separators}.`); + } +} + +class SyntaxErrorsInOriginalCodeError extends Error { + constructor(readonly syntaxErrors: Diagnostic[]) { + const syntaxErrorsAsString = syntaxErrors.map((e) => `- ${e.message}`).join(`\n`); + + super(`Original code has syntax errors:\n${syntaxErrorsAsString}`); + } +} diff --git a/DSL/tests/grammar/testGrammar.test.ts b/DSL/tests/grammar/testGrammar.test.ts index 5e97979de..eb14cc879 100644 --- a/DSL/tests/grammar/testGrammar.test.ts +++ b/DSL/tests/grammar/testGrammar.test.ts @@ -25,25 +25,25 @@ describe('grammar', () => { throw new Error('No diagnostics found'); } - const grammarErrors = diagnostics.filter( + const syntaxErrors = diagnostics.filter( (d) => d.severity === 1 && (d.code === 'lexing-error' || d.code === 'parsing-error'), ); - if (test.expectedResults === 'syntax_error') { - if (grammarErrors.length === 0) { + if (test.expectedResult === 'syntax_error') { + if (syntaxErrors.length === 0) { throw new AssertionError({ message: 'Expected syntax errors but found none.', - actual: grammarErrors, + actual: syntaxErrors, expected: [], }); } } - if (test.expectedResults === 'no_syntax_error') { - if (grammarErrors.length > 0) { + if (test.expectedResult === 'no_syntax_error') { + if (syntaxErrors.length > 0) { throw new AssertionError({ message: 'Expected no syntax errors but found some.', - actual: grammarErrors, + actual: syntaxErrors, expected: [], }); } @@ -61,7 +61,7 @@ const createGrammarTests = (): GrammarTest[] => { if (comments.length === 0) { return { absolutePath, - expectedResults: 'invalid', + expectedResult: 'invalid', testName: `INVALID TEST FILE [${pathRelativeToResources}]`, error: new NoCommentsError(), }; @@ -71,7 +71,7 @@ const createGrammarTests = (): GrammarTest[] => { if (comments.length > 1) { return { absolutePath, - expectedResults: 'invalid', + expectedResult: 'invalid', testName: `INVALID TEST FILE [${pathRelativeToResources}]`, error: new MultipleCommentsError(comments), }; @@ -83,7 +83,7 @@ const createGrammarTests = (): GrammarTest[] => { if (comment !== 'syntax_error' && comment !== 'no_syntax_error') { return { absolutePath, - expectedResults: 'invalid', + expectedResult: 'invalid', testName: `INVALID TEST FILE [${pathRelativeToResources}]`, error: new InvalidCommentError(comment), }; @@ -98,7 +98,7 @@ const createGrammarTests = (): GrammarTest[] => { return { absolutePath, - expectedResults: comment, + expectedResult: comment, testName, }; }); @@ -106,7 +106,7 @@ const createGrammarTests = (): GrammarTest[] => { interface GrammarTest { absolutePath: string; - expectedResults: 'syntax_error' | 'no_syntax_error' | 'invalid'; + expectedResult: 'syntax_error' | 'no_syntax_error' | 'invalid'; testName: string; error?: Error; } diff --git a/DSL/tests/resources/formatting/comments/before declarations.sdstest b/DSL/tests/resources/formatting/comments/before declarations.sdstest new file mode 100644 index 000000000..48f6b4814 --- /dev/null +++ b/DSL/tests/resources/formatting/comments/before declarations.sdstest @@ -0,0 +1,8 @@ +// test + +class C + +// ----------------------------------------------------------------------------- + +// test +class C diff --git a/DSL/tests/resources/formatting/comments/before imports.sdstest b/DSL/tests/resources/formatting/comments/before imports.sdstest new file mode 100644 index 000000000..e3f919432 --- /dev/null +++ b/DSL/tests/resources/formatting/comments/before imports.sdstest @@ -0,0 +1,8 @@ +// test + +import test + +// ----------------------------------------------------------------------------- + +// test +import test diff --git a/DSL/tests/resources/formatting/comments/before module annotations.sdstest b/DSL/tests/resources/formatting/comments/before module annotations.sdstest new file mode 100644 index 000000000..df48ef4d6 --- /dev/null +++ b/DSL/tests/resources/formatting/comments/before module annotations.sdstest @@ -0,0 +1,8 @@ +// test + +@Annotation + +// ----------------------------------------------------------------------------- + +// test +@Annotation diff --git a/DSL/tests/resources/formatting/comments/before module name.sdstest b/DSL/tests/resources/formatting/comments/before module name.sdstest new file mode 100644 index 000000000..375fe08f7 --- /dev/null +++ b/DSL/tests/resources/formatting/comments/before module name.sdstest @@ -0,0 +1,8 @@ +// test + +package test + +// ----------------------------------------------------------------------------- + +// test +package test diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest new file mode 100644 index 000000000..6d69262d6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list (unchanged).sdstest @@ -0,0 +1,11 @@ +@A( + f(), + 2 +) + +// ----------------------------------------------------------------------------- + +@A( + f(), + 2 +) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list.sdstest new file mode 100644 index 000000000..f4a31456b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/complex argument list.sdstest @@ -0,0 +1,8 @@ +@A( f() , 2 ) + +// ----------------------------------------------------------------------------- + +@A( + f(), + 2 +) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/empty argument list.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/empty argument list.sdstest new file mode 100644 index 000000000..0b066997a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/empty argument list.sdstest @@ -0,0 +1,5 @@ +@ Annotation ( ) + +// ----------------------------------------------------------------------------- + +@Annotation() diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/long argument list.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/long argument list.sdstest new file mode 100644 index 000000000..a6d92ecd0 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/long argument list.sdstest @@ -0,0 +1,10 @@ +@A( 1 , 2 , 3 , 4 ) + +// ----------------------------------------------------------------------------- + +@A( + 1, + 2, + 3, + 4 +) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/multiple arguments.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/multiple arguments.sdstest new file mode 100644 index 000000000..1806ee099 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/multiple arguments.sdstest @@ -0,0 +1,5 @@ +@ Annotation ( 1 , a = 2 ) + +// ----------------------------------------------------------------------------- + +@Annotation(1, a = 2) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/named argument.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/named argument.sdstest new file mode 100644 index 000000000..f04f337b9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/named argument.sdstest @@ -0,0 +1,5 @@ +@ Annotation ( b = 2 ) + +// ----------------------------------------------------------------------------- + +@Annotation(b = 2) diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/no argument list.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/no argument list.sdstest new file mode 100644 index 000000000..8c92de681 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/no argument list.sdstest @@ -0,0 +1,5 @@ +@ Annotation + +// ----------------------------------------------------------------------------- + +@Annotation diff --git a/DSL/tests/resources/formatting/declarations/annotation calls/positional argument.sdstest b/DSL/tests/resources/formatting/declarations/annotation calls/positional argument.sdstest new file mode 100644 index 000000000..f747c346c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotation calls/positional argument.sdstest @@ -0,0 +1,5 @@ +@ Annotation ( 1 ) + +// ----------------------------------------------------------------------------- + +@Annotation(1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/annotations/annotation call.sdstest new file mode 100644 index 000000000..a385b814e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/annotation call.sdstest @@ -0,0 +1,12 @@ +package test + +@Annotation + +annotation MyAnnotation + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +annotation MyAnnotation diff --git a/DSL/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..d597db58e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/complex parameter list (unchanged).sdstest @@ -0,0 +1,11 @@ +annotation A( + a: A.B, + b: Int +) + +// ----------------------------------------------------------------------------- + +annotation A( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/annotations/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/annotations/complex parameter list.sdstest new file mode 100644 index 000000000..f7628dd84 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/complex parameter list.sdstest @@ -0,0 +1,8 @@ +annotation A( a: A.B , b: Int ) + +// ----------------------------------------------------------------------------- + +annotation A( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/annotations/empty parameter list.sdstest b/DSL/tests/resources/formatting/declarations/annotations/empty parameter list.sdstest new file mode 100644 index 000000000..394e945c2 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/empty parameter list.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation() diff --git a/DSL/tests/resources/formatting/declarations/annotations/full.sdstest b/DSL/tests/resources/formatting/declarations/annotations/full.sdstest new file mode 100644 index 000000000..2db8cb0cc --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/full.sdstest @@ -0,0 +1,29 @@ +package test + +@Annotation1 + +@Annotation2 + + annotation MyAnnotation ( + @Annotation3 a : Int , + vararg b : Int = 3 + ) +where { + T2 super Number , + T3 sub Number + } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation1 +@Annotation2 +annotation MyAnnotation( + @Annotation3 + a: Int, + vararg b: Int = 3 +) where { + T2 super Number, + T3 sub Number +} diff --git a/DSL/tests/resources/formatting/declarations/annotations/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/annotations/long parameter list.sdstest new file mode 100644 index 000000000..066329102 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/long parameter list.sdstest @@ -0,0 +1,10 @@ +annotation A( a: Int , b: Int , c: Int , d: Int ) + +// ----------------------------------------------------------------------------- + +annotation A( + a: Int, + b: Int, + c: Int, + d: Int +) diff --git a/DSL/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest new file mode 100644 index 000000000..d853a481c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/multiple parameters.sdstest @@ -0,0 +1,33 @@ +annotation MyAnnotation ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) diff --git a/DSL/tests/resources/formatting/declarations/annotations/no parameter list.sdstest b/DSL/tests/resources/formatting/declarations/annotations/no parameter list.sdstest new file mode 100644 index 000000000..0de8ec591 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/no parameter list.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation diff --git a/DSL/tests/resources/formatting/declarations/annotations/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with multiple constraints.sdstest new file mode 100644 index 000000000..f0d5b0688 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with multiple constraints.sdstest @@ -0,0 +1,12 @@ +annotation MyAnnotation where { + T sub Number , + + S super Number + } + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation where { + T sub Number, + S super Number +} diff --git a/DSL/tests/resources/formatting/declarations/annotations/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with sub constraint.sdstest new file mode 100644 index 000000000..c9de91be8 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with sub constraint.sdstest @@ -0,0 +1,9 @@ +annotation MyAnnotation where { + T sub Number + } + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation where { + T sub Number +} diff --git a/DSL/tests/resources/formatting/declarations/annotations/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with super constraint.sdstest new file mode 100644 index 000000000..c5cb246ba --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with super constraint.sdstest @@ -0,0 +1,9 @@ +annotation MyAnnotation where { + T super Number + } + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation where { + T super Number +} diff --git a/DSL/tests/resources/formatting/declarations/annotations/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with typed optional parameter.sdstest new file mode 100644 index 000000000..d7f259be5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with typed required parameter.sdstest new file mode 100644 index 000000000..0d855efdc --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with typed required parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( a : Int ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(a: Int) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..d4d79500c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( vararg a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(vararg a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest new file mode 100644 index 000000000..789d7b355 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( vararg a : Int ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(vararg a: Int) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with untyped optional parameter.sdstest new file mode 100644 index 000000000..c9a973832 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( a = 1 ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(a = 1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with untyped required parameter.sdstest new file mode 100644 index 000000000..f622292c7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( a ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(a) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..423b92fef --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( vararg a = 1 ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(vararg a = 1) diff --git a/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..998951649 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/annotations/with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +annotation MyAnnotation ( vararg a ) + +// ----------------------------------------------------------------------------- + +annotation MyAnnotation(vararg a) diff --git a/DSL/tests/resources/formatting/declarations/classes/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/annotated type parameter.sdstest new file mode 100644 index 000000000..803898a6b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/annotated type parameter.sdstest @@ -0,0 +1,8 @@ +class MyClass < @Annotation T > + +// ----------------------------------------------------------------------------- + +class MyClass< + @Annotation + T +> diff --git a/DSL/tests/resources/formatting/declarations/classes/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/annotation call.sdstest new file mode 100644 index 000000000..692ab4668 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation class MyClass + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/attributes/annotated.sdstest b/DSL/tests/resources/formatting/declarations/classes/attributes/annotated.sdstest new file mode 100644 index 000000000..af1e2dad3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/attributes/annotated.sdstest @@ -0,0 +1,10 @@ +class MyClass { + @Annotation attr a +} + +// ----------------------------------------------------------------------------- + +class MyClass { + @Annotation + attr a +} diff --git a/DSL/tests/resources/formatting/declarations/classes/attributes/no type.sdstest b/DSL/tests/resources/formatting/declarations/classes/attributes/no type.sdstest new file mode 100644 index 000000000..6a01b4578 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/attributes/no type.sdstest @@ -0,0 +1,9 @@ +class MyClass { + attr a +} + +// ----------------------------------------------------------------------------- + +class MyClass { + attr a +} diff --git a/DSL/tests/resources/formatting/declarations/classes/attributes/static.sdstest b/DSL/tests/resources/formatting/declarations/classes/attributes/static.sdstest new file mode 100644 index 000000000..c5b44b3df --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/attributes/static.sdstest @@ -0,0 +1,9 @@ +class MyClass { + static attr a : Int +} + +// ----------------------------------------------------------------------------- + +class MyClass { + static attr a: Int +} diff --git a/DSL/tests/resources/formatting/declarations/classes/attributes/with type.sdstest b/DSL/tests/resources/formatting/declarations/classes/attributes/with type.sdstest new file mode 100644 index 000000000..7e5a6ec5c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/attributes/with type.sdstest @@ -0,0 +1,9 @@ +class MyClass { + attr a : Int +} + +// ----------------------------------------------------------------------------- + +class MyClass { + attr a: Int +} diff --git a/DSL/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..311595c15 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/complex parameter list (unchanged).sdstest @@ -0,0 +1,11 @@ +class C( + a: A.B, + b: Int +) + +// ----------------------------------------------------------------------------- + +class C( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/classes/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/complex parameter list.sdstest new file mode 100644 index 000000000..9023c5ec2 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/complex parameter list.sdstest @@ -0,0 +1,8 @@ +class C( a: A.B , b: Int ) + +// ----------------------------------------------------------------------------- + +class C( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..fde132974 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,8 @@ +class MyClass < @Annotation in T > + +// ----------------------------------------------------------------------------- + +class MyClass< + @Annotation + in T +> diff --git a/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter.sdstest new file mode 100644 index 000000000..1d6efc467 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/contravariant type parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass < in T > + +// ----------------------------------------------------------------------------- + +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..4e4d6949c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/covariant type parameter with annotation call.sdstest @@ -0,0 +1,8 @@ +class MyClass < @Annotation out T > + +// ----------------------------------------------------------------------------- + +class MyClass< + @Annotation + out T +> diff --git a/DSL/tests/resources/formatting/declarations/classes/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/covariant type parameter.sdstest new file mode 100644 index 000000000..43febd0f9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/covariant type parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass < out T > + +// ----------------------------------------------------------------------------- + +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/empty body.sdstest b/DSL/tests/resources/formatting/declarations/classes/empty body.sdstest new file mode 100644 index 000000000..aa8773209 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/empty body.sdstest @@ -0,0 +1,5 @@ +class MyClass { } + +// ----------------------------------------------------------------------------- + +class MyClass {} diff --git a/DSL/tests/resources/formatting/declarations/classes/empty constraint list.sdstest b/DSL/tests/resources/formatting/declarations/classes/empty constraint list.sdstest new file mode 100644 index 000000000..cc46fbac7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/empty constraint list.sdstest @@ -0,0 +1,5 @@ +class MyClass where { } + +// ----------------------------------------------------------------------------- + +class MyClass where {} diff --git a/DSL/tests/resources/formatting/declarations/classes/empty parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/empty parameter list.sdstest new file mode 100644 index 000000000..a26e2fce8 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/empty parameter list.sdstest @@ -0,0 +1,5 @@ +class MyClass ( ) + +// ----------------------------------------------------------------------------- + +class MyClass() diff --git a/DSL/tests/resources/formatting/declarations/classes/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/empty type parameter list.sdstest new file mode 100644 index 000000000..ddd2f5d9b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/empty type parameter list.sdstest @@ -0,0 +1,5 @@ +class MyClass < > + +// ----------------------------------------------------------------------------- + +class MyClass<> diff --git a/DSL/tests/resources/formatting/declarations/classes/full body.sdstest b/DSL/tests/resources/formatting/declarations/classes/full body.sdstest new file mode 100644 index 000000000..1b1ce7205 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/full body.sdstest @@ -0,0 +1,65 @@ +class MyClass { + + @Annotation + + static attr a: Int + + + attr b: String + + + @Annotation + + class InnerClass { + + @Annotation + + fun h() + + + @Annotation + + attr c: Int + + } + + + @Annotation + + enum E {} + + + @Annotation + + static fun f() + + + fun g() + + } + +// ----------------------------------------------------------------------------- + +class MyClass { + @Annotation + static attr a: Int + + attr b: String + + @Annotation + class InnerClass { + @Annotation + fun h() + + @Annotation + attr c: Int + } + + @Annotation + enum E {} + + @Annotation + static fun f() + + fun g() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/invariant type parameter.sdstest new file mode 100644 index 000000000..99534b071 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/invariant type parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass < T > + +// ----------------------------------------------------------------------------- + +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/long parameter list.sdstest new file mode 100644 index 000000000..e34baf9e1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/long parameter list.sdstest @@ -0,0 +1,10 @@ +class C( a: Int , b: Int , c: Int , d: Int ) + +// ----------------------------------------------------------------------------- + +class C( + a: Int, + b: Int, + c: Int, + d: Int +) diff --git a/DSL/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest new file mode 100644 index 000000000..9082a2494 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/long type parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +class C< + K, + V, + X, + Y +> + +// ----------------------------------------------------------------------------- + +class C< + K, + V, + X, + Y +> diff --git a/DSL/tests/resources/formatting/declarations/classes/long type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/long type parameter list.sdstest new file mode 100644 index 000000000..83dc16b67 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/long type parameter list.sdstest @@ -0,0 +1,10 @@ +class C< K , V , X , Y > + +// ----------------------------------------------------------------------------- + +class C< + K, + V, + X, + Y +> diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/annotated type parameter.sdstest new file mode 100644 index 000000000..b965067aa --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/annotated type parameter.sdstest @@ -0,0 +1,12 @@ +class MyClass { + fun myFunction < @Annotation T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction< + @Annotation + T + >() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/annotation call.sdstest new file mode 100644 index 000000000..156742cf9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/annotation call.sdstest @@ -0,0 +1,10 @@ +class MyClass { + @Annotation fun myFunction ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + @Annotation + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..d3049b416 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +class MyClass { + fun myFunction < @Annotation in T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction< + @Annotation + in T + >() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter.sdstest new file mode 100644 index 000000000..b0672b049 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/contravariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction < in T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..a31c7e82f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +class MyClass { + fun myFunction < @Annotation out T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction< + @Annotation + out T + >() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter.sdstest new file mode 100644 index 000000000..77fb88dfe --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/covariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction < out T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/empty constraint list.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/empty constraint list.sdstest new file mode 100644 index 000000000..1ca500b04 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/empty constraint list.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) where { } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() where {} +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/empty type parameter list.sdstest new file mode 100644 index 000000000..3775b18ab --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/empty type parameter list.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction < > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction<>() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/invariant type parameter.sdstest new file mode 100644 index 000000000..049ac65d1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/invariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction < T > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest new file mode 100644 index 000000000..712dec1e3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/multiple parameters.sdstest @@ -0,0 +1,36 @@ +class MyClass { + fun myFunction ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/multiple results.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/multiple results.sdstest new file mode 100644 index 000000000..5afbbde82 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/multiple results.sdstest @@ -0,0 +1,23 @@ +class MyClass { + fun myFunction ( ) -> ( + @Annotation a , + + b , + + c : Int , + + d : Int + ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> ( + @Annotation + a, + b, + c: Int, + d: Int + ) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/multiple type parameters.sdstest new file mode 100644 index 000000000..02ee93eda --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/multiple type parameters.sdstest @@ -0,0 +1,14 @@ +class MyClass { + fun myFunction < @Annotation T , in S , out U > ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction< + @Annotation + T, + in S, + out U + >() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/no parameters and no results.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/no parameters and no results.sdstest new file mode 100644 index 000000000..adcf16397 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/no parameters and no results.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/no results (explicit).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/no results (explicit).sdstest new file mode 100644 index 000000000..0a7b35fe6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/no results (explicit).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> () +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (in parentheses).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (in parentheses).sdstest new file mode 100644 index 000000000..a7bec63c3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (in parentheses).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> ( a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> (a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (no parentheses).sdstest new file mode 100644 index 000000000..d2afc17f6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/one typed result (no parentheses).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> a : Int +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> a: Int +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..390f3c867 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (no parentheses).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> a +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> a +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (with parentheses).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..0f85cec7e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/one untyped result (with parentheses).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( ) -> ( a ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() -> (a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/static.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/static.sdstest new file mode 100644 index 000000000..f51223011 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/static.sdstest @@ -0,0 +1,9 @@ +class MyClass { + static fun myFunction ( ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + static fun myFunction() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with multiple constraints.sdstest new file mode 100644 index 000000000..a589fa28a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with multiple constraints.sdstest @@ -0,0 +1,17 @@ +class MyClass { + fun myFunction ( ) where { + + T sub Number , + + S super Number + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() where { + T sub Number, + S super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with sub constraint.sdstest new file mode 100644 index 000000000..1013e15e0 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with sub constraint.sdstest @@ -0,0 +1,13 @@ +class MyClass { + fun myFunction ( ) where { + T sub Number + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() where { + T sub Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with super constraint.sdstest new file mode 100644 index 000000000..60ef8bc03 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with super constraint.sdstest @@ -0,0 +1,14 @@ +class MyClass { + fun myFunction ( ) where { + + T super Number + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction() where { + T super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with typed optional parameter.sdstest new file mode 100644 index 000000000..bf987f163 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with typed optional parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with typed required parameter.sdstest new file mode 100644 index 000000000..9613eddcd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with typed required parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..b938bdbae --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( vararg a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(vararg a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest new file mode 100644 index 000000000..c13cb60dd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( vararg a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(vararg a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped optional parameter.sdstest new file mode 100644 index 000000000..b2be955d6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( a = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped required parameter.sdstest new file mode 100644 index 000000000..32af588d5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped required parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( a ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..80670436e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( vararg a = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(vararg a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..1c90825bd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/methods/with untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +class MyClass { + fun myFunction ( vararg a ) +} + +// ----------------------------------------------------------------------------- + +class MyClass { + fun myFunction(vararg a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/minimal.sdstest b/DSL/tests/resources/formatting/declarations/classes/minimal.sdstest new file mode 100644 index 000000000..99f3e1846 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/minimal.sdstest @@ -0,0 +1,5 @@ +class MyClass + +// ----------------------------------------------------------------------------- + +class MyClass diff --git a/DSL/tests/resources/formatting/declarations/classes/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/multiple parameters.sdstest new file mode 100644 index 000000000..04a9448d7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/multiple parameters.sdstest @@ -0,0 +1,33 @@ +class MyClass ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) + +// ----------------------------------------------------------------------------- + +class MyClass( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) diff --git a/DSL/tests/resources/formatting/declarations/classes/multiple parent types.sdstest b/DSL/tests/resources/formatting/declarations/classes/multiple parent types.sdstest new file mode 100644 index 000000000..cf14b00bf --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/multiple parent types.sdstest @@ -0,0 +1,5 @@ +class MyClass sub Int , Number + +// ----------------------------------------------------------------------------- + +class MyClass sub Int, Number diff --git a/DSL/tests/resources/formatting/declarations/classes/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/multiple type parameters.sdstest new file mode 100644 index 000000000..a68e1227d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/multiple type parameters.sdstest @@ -0,0 +1,10 @@ +class MyClass < @Annotation T , in S , out U > + +// ----------------------------------------------------------------------------- + +class MyClass< + @Annotation + T, + in S, + out U +> diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/annotated type parameter.sdstest new file mode 100644 index 000000000..07498409a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/annotated type parameter.sdstest @@ -0,0 +1,12 @@ +class MyOuterClass { + class MyClass < @Annotation T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass< + @Annotation + T + > +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/annotation call.sdstest new file mode 100644 index 000000000..5cdb77ded --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/annotation call.sdstest @@ -0,0 +1,10 @@ +class MyOuterClass { + @Annotation class MyClass +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + @Annotation + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..2ed3d7123 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +class MyOuterClass { + class MyClass < @Annotation in T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass< + @Annotation + in T + > +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter.sdstest new file mode 100644 index 000000000..b008b22de --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/contravariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass < in T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..a7be42a8a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +class MyOuterClass { + class MyClass < @Annotation out T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass< + @Annotation + out T + > +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter.sdstest new file mode 100644 index 000000000..97d72dd17 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/covariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass < out T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/empty body.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty body.sdstest new file mode 100644 index 000000000..be3dd1235 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty body.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass { } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass {} +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/empty constraint list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty constraint list.sdstest new file mode 100644 index 000000000..509de9aac --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty constraint list.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass where { } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass where {} +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/empty parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty parameter list.sdstest new file mode 100644 index 000000000..c6b4acdc5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty parameter list.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass() +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty type parameter list.sdstest new file mode 100644 index 000000000..14f98b903 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/empty type parameter list.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass < > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass<> +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/invariant type parameter.sdstest new file mode 100644 index 000000000..fcfc30c45 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/invariant type parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass < T > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/minimal.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/minimal.sdstest new file mode 100644 index 000000000..603263048 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/minimal.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest new file mode 100644 index 000000000..5518f008e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parameters.sdstest @@ -0,0 +1,37 @@ +class MyOuterClass { + class MyClass ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parent types.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parent types.sdstest new file mode 100644 index 000000000..4974c5740 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple parent types.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass sub Int , Number +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass sub Int, Number +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple type parameters.sdstest new file mode 100644 index 000000000..0fd48754e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/multiple type parameters.sdstest @@ -0,0 +1,14 @@ +class MyOuterClass { + class MyClass < @Annotation T , in S , out U > +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass< + @Annotation + T, + in S, + out U + > +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/parent type.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/parent type.sdstest new file mode 100644 index 000000000..6245987b1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/parent type.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass sub Int +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass sub Int +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with multiple constraints.sdstest new file mode 100644 index 000000000..969f28c88 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with multiple constraints.sdstest @@ -0,0 +1,18 @@ +class MyOuterClass { + class MyClass where { + + T sub Number , + + S super Number + + } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass where { + T sub Number, + S super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with sub constraint.sdstest new file mode 100644 index 000000000..a4f41215b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with sub constraint.sdstest @@ -0,0 +1,13 @@ +class MyOuterClass { + class MyClass where { + T sub Number + } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass where { + T sub Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with super constraint.sdstest new file mode 100644 index 000000000..affc2aba1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with super constraint.sdstest @@ -0,0 +1,13 @@ +class MyOuterClass { + class MyClass where { + T super Number + } +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass where { + T super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed optional parameter.sdstest new file mode 100644 index 000000000..4e602819a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed optional parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed required parameter.sdstest new file mode 100644 index 000000000..67059b584 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed required parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..4f8362e1a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( vararg a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(vararg a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest new file mode 100644 index 000000000..9096c9df5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( vararg a : Int ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(vararg a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped optional parameter.sdstest new file mode 100644 index 000000000..dd6142d9f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( a = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped required parameter.sdstest new file mode 100644 index 000000000..e2ca23f40 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped required parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( a ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..417253885 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( vararg a = 1 ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(vararg a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..a4f040167 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested classes/with untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +class MyOuterClass { + class MyClass ( vararg a ) +} + +// ----------------------------------------------------------------------------- + +class MyOuterClass { + class MyClass(vararg a) +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/annotation call.sdstest new file mode 100644 index 000000000..74eaf7b60 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/annotation call.sdstest @@ -0,0 +1,10 @@ +class MyClass { + @Annotation enum MyEnum +} + +// ----------------------------------------------------------------------------- + +class MyClass { + @Annotation + enum MyEnum +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/empty body.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/empty body.sdstest new file mode 100644 index 000000000..821a0f32b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/empty body.sdstest @@ -0,0 +1,9 @@ +class MyClass { + enum MyEnum { } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum {} +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/no body.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/no body.sdstest new file mode 100644 index 000000000..3ba95b00e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/no body.sdstest @@ -0,0 +1,9 @@ +class MyClass { + enum MyEnum +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants in body.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants in body.sdstest new file mode 100644 index 000000000..bb39b4aee --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants in body.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotated type parameter.sdstest new file mode 100644 index 000000000..e16c9e40c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotated type parameter.sdstest @@ -0,0 +1,16 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < @Annotation T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant< + @Annotation + T + > + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotation call.sdstest new file mode 100644 index 000000000..182bae7fa --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/annotation call.sdstest @@ -0,0 +1,14 @@ +class MyClass { + enum MyEnum { + @Annotation MyEnumVariant + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + @Annotation + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..a43fcb568 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,16 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < @Annotation in T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant< + @Annotation + in T + > + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter.sdstest new file mode 100644 index 000000000..bc6026aa1 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/contravariant type parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < in T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..b0ba9f682 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter with annotation call.sdstest @@ -0,0 +1,16 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < @Annotation out T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant< + @Annotation + out T + > + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter.sdstest new file mode 100644 index 000000000..e405ad122 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/covariant type parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < out T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/empty type parameter list.sdstest new file mode 100644 index 000000000..78e3dcdc6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/empty type parameter list.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant<> + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/invariant type parameter.sdstest new file mode 100644 index 000000000..bd77cccc6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/invariant type parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < T > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest new file mode 100644 index 000000000..9b6dfe9f6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple parameters.sdstest @@ -0,0 +1,40 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple type parameters.sdstest new file mode 100644 index 000000000..05dfd5c69 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/multiple type parameters.sdstest @@ -0,0 +1,18 @@ +class MyClass { + enum MyEnum { + MyEnumVariant < @Annotation T , in S , out U > + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant< + @Annotation + T, + in S, + out U + > + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/no parameter list.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/no parameter list.sdstest new file mode 100644 index 000000000..0c08692a3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/no parameter list.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with multiple constraints.sdstest new file mode 100644 index 000000000..aecf34a93 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with multiple constraints.sdstest @@ -0,0 +1,19 @@ +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number , + S super Number + } + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number, + S super Number + } + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with sub constraint.sdstest new file mode 100644 index 000000000..73e974902 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with sub constraint.sdstest @@ -0,0 +1,17 @@ +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number + } + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant where { + T sub Number + } + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with super constraint.sdstest new file mode 100644 index 000000000..622a6ff99 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with super constraint.sdstest @@ -0,0 +1,17 @@ +class MyClass { + enum MyEnum { + MyEnumVariant where { + T super Number + } + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant where { + T super Number + } + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed optional parameter.sdstest new file mode 100644 index 000000000..9b1c03acb --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed optional parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( a : Int = 1 ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(a: Int = 1) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed required parameter.sdstest new file mode 100644 index 000000000..8a18e134f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed required parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( a : Int ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(a: Int) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..a2208dcb3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( vararg a : Int = 1 ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a: Int = 1) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest new file mode 100644 index 000000000..0545dc7fa --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with typed variadic parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( vararg a : Int ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a: Int) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped optional parameter.sdstest new file mode 100644 index 000000000..fe43730f9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped optional parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( a = 1 ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(a = 1) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped required parameter.sdstest new file mode 100644 index 000000000..f42ef72a0 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped required parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( a ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(a) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..7a808b7c7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( vararg a = 1 ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a = 1) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..6a6973ac4 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/nested enums/variants/with untyped variadic parameter.sdstest @@ -0,0 +1,13 @@ +class MyClass { + enum MyEnum { + MyEnumVariant ( vararg a ) + } +} + +// ----------------------------------------------------------------------------- + +class MyClass { + enum MyEnum { + MyEnumVariant(vararg a) + } +} diff --git a/DSL/tests/resources/formatting/declarations/classes/one parent type.sdstest b/DSL/tests/resources/formatting/declarations/classes/one parent type.sdstest new file mode 100644 index 000000000..edea5b0de --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/one parent type.sdstest @@ -0,0 +1,5 @@ +class MyClass sub Int + +// ----------------------------------------------------------------------------- + +class MyClass sub Int diff --git a/DSL/tests/resources/formatting/declarations/classes/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/classes/with multiple constraints.sdstest new file mode 100644 index 000000000..c804bba16 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with multiple constraints.sdstest @@ -0,0 +1,14 @@ +class MyClass where { + + T sub Number , + + S super Number + + } + +// ----------------------------------------------------------------------------- + +class MyClass where { + T sub Number, + S super Number +} diff --git a/DSL/tests/resources/formatting/declarations/classes/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/with sub constraint.sdstest new file mode 100644 index 000000000..717b1af28 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with sub constraint.sdstest @@ -0,0 +1,9 @@ +class MyClass where { + T sub Number + } + +// ----------------------------------------------------------------------------- + +class MyClass where { + T sub Number +} diff --git a/DSL/tests/resources/formatting/declarations/classes/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/classes/with super constraint.sdstest new file mode 100644 index 000000000..67725a957 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with super constraint.sdstest @@ -0,0 +1,9 @@ +class MyClass where { + T super Number + } + +// ----------------------------------------------------------------------------- + +class MyClass where { + T super Number +} diff --git a/DSL/tests/resources/formatting/declarations/classes/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with typed optional parameter.sdstest new file mode 100644 index 000000000..498e4353d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +class MyClass(a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/classes/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with typed required parameter.sdstest new file mode 100644 index 000000000..82e69d627 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with typed required parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( a : Int ) + +// ----------------------------------------------------------------------------- + +class MyClass(a: Int) diff --git a/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..a05a5eae6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +class MyClass ( vararg a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +class MyClass(vararg a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest new file mode 100644 index 000000000..1df3e13ca --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( vararg a : Int ) + +// ----------------------------------------------------------------------------- + +class MyClass(vararg a: Int) diff --git a/DSL/tests/resources/formatting/declarations/classes/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with untyped optional parameter.sdstest new file mode 100644 index 000000000..87ae661e8 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( a = 1 ) + +// ----------------------------------------------------------------------------- + +class MyClass(a = 1) diff --git a/DSL/tests/resources/formatting/declarations/classes/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with untyped required parameter.sdstest new file mode 100644 index 000000000..1ac2b0b22 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( a ) + +// ----------------------------------------------------------------------------- + +class MyClass(a) diff --git a/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..742ca1d20 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +class MyClass ( vararg a = 1 ) + +// ----------------------------------------------------------------------------- + +class MyClass(vararg a = 1) diff --git a/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..de5cbea73 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/classes/with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +class MyClass ( vararg a ) + +// ----------------------------------------------------------------------------- + +class MyClass(vararg a) diff --git a/DSL/tests/resources/formatting/declarations/enums/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/enums/annotation call.sdstest new file mode 100644 index 000000000..2dc1c9171 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation enum MyEnum + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +enum MyEnum diff --git a/DSL/tests/resources/formatting/declarations/enums/empty body.sdstest b/DSL/tests/resources/formatting/declarations/enums/empty body.sdstest new file mode 100644 index 000000000..660dfbc95 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/empty body.sdstest @@ -0,0 +1,5 @@ +enum MyEnum { } + +// ----------------------------------------------------------------------------- + +enum MyEnum {} diff --git a/DSL/tests/resources/formatting/declarations/enums/full body.sdstest b/DSL/tests/resources/formatting/declarations/enums/full body.sdstest new file mode 100644 index 000000000..0140234fb --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/full body.sdstest @@ -0,0 +1,27 @@ +enum MyEnum { + + @Annotation + + MyEnumVariant1 + + + MyEnumVariant2 + + + @Annotation + + MyEnumVariant3 + + } + +// ----------------------------------------------------------------------------- + +enum MyEnum { + @Annotation + MyEnumVariant1 + + MyEnumVariant2 + + @Annotation + MyEnumVariant3 +} diff --git a/DSL/tests/resources/formatting/declarations/enums/no body.sdstest b/DSL/tests/resources/formatting/declarations/enums/no body.sdstest new file mode 100644 index 000000000..a3465e9cf --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/no body.sdstest @@ -0,0 +1,5 @@ +enum MyEnum + +// ----------------------------------------------------------------------------- + +enum MyEnum diff --git a/DSL/tests/resources/formatting/declarations/enums/variants in body.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants in body.sdstest new file mode 100644 index 000000000..c285ed2f4 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants in body.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant + } + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/annotated type parameter.sdstest new file mode 100644 index 000000000..e044ce70e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/annotated type parameter.sdstest @@ -0,0 +1,12 @@ +enum MyEnum { + MyEnumVariant < @Annotation T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant< + @Annotation + T + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/annotation call.sdstest new file mode 100644 index 000000000..6b066b798 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/annotation call.sdstest @@ -0,0 +1,10 @@ +enum MyEnum { + @Annotation MyEnumVariant +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + @Annotation + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..1552b4e76 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +enum E { + A( + a: A.B, + b: Int + ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: A.B, + b: Int + ) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list.sdstest new file mode 100644 index 000000000..585fff906 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/complex parameter list.sdstest @@ -0,0 +1,12 @@ +enum E { + A( a: A.B , b: Int ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: A.B, + b: Int + ) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..2fc767b57 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +enum MyEnum { + MyEnumVariant < @Annotation in T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant< + @Annotation + in T + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter.sdstest new file mode 100644 index 000000000..1c8a3553e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/contravariant type parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant < in T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..ad529a158 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter with annotation call.sdstest @@ -0,0 +1,12 @@ +enum MyEnum { + MyEnumVariant < @Annotation out T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant< + @Annotation + out T + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter.sdstest new file mode 100644 index 000000000..d059c09fc --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/covariant type parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant < out T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/empty type parameter list.sdstest new file mode 100644 index 000000000..25578d9e6 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/empty type parameter list.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant < > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant<> +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/invariant type parameter.sdstest new file mode 100644 index 000000000..c90eaf89b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/invariant type parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant < T > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/long parameter list.sdstest new file mode 100644 index 000000000..a27994544 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/long parameter list.sdstest @@ -0,0 +1,14 @@ +enum E { + A( a: Int , b: Int , c: Int , d: Int ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: Int, + b: Int, + c: Int, + d: Int + ) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest new file mode 100644 index 000000000..f4f44b314 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list (unchanged).sdstest @@ -0,0 +1,19 @@ +enum E { + A< + K, + V, + X, + Y + > +} + +// ----------------------------------------------------------------------------- + +enum E { + A< + K, + V, + X, + Y + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list.sdstest new file mode 100644 index 000000000..78fc5760f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/long type parameter list.sdstest @@ -0,0 +1,14 @@ +enum E { + A< K , V , X , Y > +} + +// ----------------------------------------------------------------------------- + +enum E { + A< + K, + V, + X, + Y + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest new file mode 100644 index 000000000..da483aa5a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/multiple parameters.sdstest @@ -0,0 +1,37 @@ +enum MyEnum { + MyEnumVariant ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/multiple type parameters.sdstest new file mode 100644 index 000000000..5d5cd27ac --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/multiple type parameters.sdstest @@ -0,0 +1,14 @@ +enum MyEnum { + MyEnumVariant < @Annotation T , in S , out U > +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant< + @Annotation + T, + in S, + out U + > +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/no parameter list.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/no parameter list.sdstest new file mode 100644 index 000000000..d55b4c602 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/no parameter list.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with multiple constraints.sdstest new file mode 100644 index 000000000..ee8eca3fe --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with multiple constraints.sdstest @@ -0,0 +1,18 @@ +enum MyEnum { + MyEnumVariant where { + + T sub Number , + + S super Number + + } +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant where { + T sub Number, + S super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with sub constraint.sdstest new file mode 100644 index 000000000..fff7e5244 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with sub constraint.sdstest @@ -0,0 +1,13 @@ +enum MyEnum { + MyEnumVariant where { + T sub Number + } +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant where { + T sub Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with super constraint.sdstest new file mode 100644 index 000000000..abc4c75a2 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with super constraint.sdstest @@ -0,0 +1,13 @@ +enum MyEnum { + MyEnumVariant where { + T super Number + } +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant where { + T super Number + } +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with typed optional parameter.sdstest new file mode 100644 index 000000000..d7efefaa9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with typed optional parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with typed required parameter.sdstest new file mode 100644 index 000000000..60e8652fb --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with typed required parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( a : Int ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..a0ec0c970 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( vararg a : Int = 1 ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(vararg a: Int = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest new file mode 100644 index 000000000..e61188a82 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( vararg a : Int ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(vararg a: Int) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped optional parameter.sdstest new file mode 100644 index 000000000..e361d229d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( a = 1 ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped required parameter.sdstest new file mode 100644 index 000000000..f163e978f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped required parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( a ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(a) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..6d4fa2a96 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant (vararg a = 1 ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(vararg a = 1) +} diff --git a/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..0eb53e36a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/enums/variants/with untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +enum MyEnum { + MyEnumVariant ( vararg a ) +} + +// ----------------------------------------------------------------------------- + +enum MyEnum { + MyEnumVariant(vararg a) +} diff --git a/DSL/tests/resources/formatting/declarations/functions/annotated type parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/annotated type parameter.sdstest new file mode 100644 index 000000000..30704d78d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/annotated type parameter.sdstest @@ -0,0 +1,8 @@ +fun myFunction < @Annotation T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction< + @Annotation + T +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/functions/annotation call.sdstest new file mode 100644 index 000000000..a71836c3a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation fun myFunction ( ) + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..7b7db9fd3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/complex parameter list (unchanged).sdstest @@ -0,0 +1,11 @@ +fun f( + a: A.B, + b: Int +) + +// ----------------------------------------------------------------------------- + +fun f( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/functions/complex parameter list.sdstest new file mode 100644 index 000000000..3c27aa52b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/complex parameter list.sdstest @@ -0,0 +1,8 @@ +fun f( a: A.B , b: Int ) + +// ----------------------------------------------------------------------------- + +fun f( + a: A.B, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest new file mode 100644 index 000000000..f3328934b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/complex result list (unchanged).sdstest @@ -0,0 +1,11 @@ +fun f() -> ( + x: A.B, + y: Int +) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: A.B, + y: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/complex result list.sdstest b/DSL/tests/resources/formatting/declarations/functions/complex result list.sdstest new file mode 100644 index 000000000..8108296b5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/complex result list.sdstest @@ -0,0 +1,8 @@ +fun f() -> ( x: A.B , y: Int ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: A.B, + y: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..d6e8b37b3 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter with annotation call.sdstest @@ -0,0 +1,8 @@ +fun myFunction < @Annotation in T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction< + @Annotation + in T +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter.sdstest new file mode 100644 index 000000000..a02ea971d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/contravariant type parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction < in T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/covariant type parameter with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/functions/covariant type parameter with annotation call.sdstest new file mode 100644 index 000000000..ba691458a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/covariant type parameter with annotation call.sdstest @@ -0,0 +1,8 @@ +fun myFunction < @Annotation out T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction< + @Annotation + out T +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/covariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/covariant type parameter.sdstest new file mode 100644 index 000000000..0b8b00b53 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/covariant type parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction < out T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/empty constraint list.sdstest b/DSL/tests/resources/formatting/declarations/functions/empty constraint list.sdstest new file mode 100644 index 000000000..a2d6bee0a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/empty constraint list.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) where { } + +// ----------------------------------------------------------------------------- + +fun myFunction() where {} diff --git a/DSL/tests/resources/formatting/declarations/functions/empty type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/functions/empty type parameter list.sdstest new file mode 100644 index 000000000..0d045ebf7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/empty type parameter list.sdstest @@ -0,0 +1,5 @@ +fun myFunction < > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction<>() diff --git a/DSL/tests/resources/formatting/declarations/functions/invariant type parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/invariant type parameter.sdstest new file mode 100644 index 000000000..4a7c6dd89 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/invariant type parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction < T > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/functions/long parameter list.sdstest new file mode 100644 index 000000000..de6e2a7da --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/long parameter list.sdstest @@ -0,0 +1,10 @@ +fun f( a: Int , b: Int , c: Int , d: Int ) + +// ----------------------------------------------------------------------------- + +fun f( + a: Int, + b: Int, + c: Int, + d: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/long result list.sdstest b/DSL/tests/resources/formatting/declarations/functions/long result list.sdstest new file mode 100644 index 000000000..0bffa7df9 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/long result list.sdstest @@ -0,0 +1,10 @@ +fun f() -> ( x: Int , y: Int , a: Int , b: Int ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: Int, + y: Int, + a: Int, + b: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest new file mode 100644 index 000000000..bd0d55562 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/long type parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +fun f< + K, + V, + X, + Y +>() + +// ----------------------------------------------------------------------------- + +fun f< + K, + V, + X, + Y +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/long type parameter list.sdstest b/DSL/tests/resources/formatting/declarations/functions/long type parameter list.sdstest new file mode 100644 index 000000000..72648532a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/long type parameter list.sdstest @@ -0,0 +1,10 @@ +fun f< K , V , X , Y >() + +// ----------------------------------------------------------------------------- + +fun f< + K, + V, + X, + Y +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/functions/multiple parameters.sdstest new file mode 100644 index 000000000..b605bc789 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/multiple parameters.sdstest @@ -0,0 +1,32 @@ +fun myFunction ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + ) + +// ----------------------------------------------------------------------------- + +fun myFunction( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) diff --git a/DSL/tests/resources/formatting/declarations/functions/multiple results.sdstest b/DSL/tests/resources/formatting/declarations/functions/multiple results.sdstest new file mode 100644 index 000000000..f1dcf6c22 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/multiple results.sdstest @@ -0,0 +1,20 @@ +fun myFunction ( ) -> ( + + @Annotation a , + + b , + + c : Int , + + d : Int + ) + +// ----------------------------------------------------------------------------- + +fun myFunction() -> ( + @Annotation + a, + b, + c: Int, + d: Int +) diff --git a/DSL/tests/resources/formatting/declarations/functions/multiple type parameters.sdstest b/DSL/tests/resources/formatting/declarations/functions/multiple type parameters.sdstest new file mode 100644 index 000000000..4c4c4869c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/multiple type parameters.sdstest @@ -0,0 +1,10 @@ +fun myFunction < @Annotation T , in S , out U > ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction< + @Annotation + T, + in S, + out U +>() diff --git a/DSL/tests/resources/formatting/declarations/functions/no parameters and no results.sdstest b/DSL/tests/resources/formatting/declarations/functions/no parameters and no results.sdstest new file mode 100644 index 000000000..1d31063fc --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/no parameters and no results.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() diff --git a/DSL/tests/resources/formatting/declarations/functions/no results (explicit).sdstest b/DSL/tests/resources/formatting/declarations/functions/no results (explicit).sdstest new file mode 100644 index 000000000..dd682801e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/no results (explicit).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> ( ) + +// ----------------------------------------------------------------------------- + +fun myFunction() -> () diff --git a/DSL/tests/resources/formatting/declarations/functions/one typed result (in parentheses).sdstest b/DSL/tests/resources/formatting/declarations/functions/one typed result (in parentheses).sdstest new file mode 100644 index 000000000..ab4b5849f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/one typed result (in parentheses).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> ( a : Int ) + +// ----------------------------------------------------------------------------- + +fun myFunction() -> (a: Int) diff --git a/DSL/tests/resources/formatting/declarations/functions/one typed result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/functions/one typed result (no parentheses).sdstest new file mode 100644 index 000000000..64ebd576e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/one typed result (no parentheses).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> a : Int + +// ----------------------------------------------------------------------------- + +fun myFunction() -> a: Int diff --git a/DSL/tests/resources/formatting/declarations/functions/one untyped result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/functions/one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..a7d782649 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/one untyped result (no parentheses).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> a + +// ----------------------------------------------------------------------------- + +fun myFunction() -> a diff --git a/DSL/tests/resources/formatting/declarations/functions/one untyped result (with parentheses).sdstest b/DSL/tests/resources/formatting/declarations/functions/one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..b957b9ea5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/one untyped result (with parentheses).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( ) -> ( a ) + +// ----------------------------------------------------------------------------- + +fun myFunction() -> (a) diff --git a/DSL/tests/resources/formatting/declarations/functions/with multiple constraints.sdstest b/DSL/tests/resources/formatting/declarations/functions/with multiple constraints.sdstest new file mode 100644 index 000000000..5663a7805 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with multiple constraints.sdstest @@ -0,0 +1,13 @@ +fun myFunction ( ) where { + T sub Number , + + S super Number + + } + +// ----------------------------------------------------------------------------- + +fun myFunction() where { + T sub Number, + S super Number +} diff --git a/DSL/tests/resources/formatting/declarations/functions/with sub constraint.sdstest b/DSL/tests/resources/formatting/declarations/functions/with sub constraint.sdstest new file mode 100644 index 000000000..434cacbff --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with sub constraint.sdstest @@ -0,0 +1,9 @@ +fun myFunction ( ) where { + T sub Number + } + +// ----------------------------------------------------------------------------- + +fun myFunction() where { + T sub Number +} diff --git a/DSL/tests/resources/formatting/declarations/functions/with super constraint.sdstest b/DSL/tests/resources/formatting/declarations/functions/with super constraint.sdstest new file mode 100644 index 000000000..562c4796a --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with super constraint.sdstest @@ -0,0 +1,9 @@ +fun myFunction ( ) where { + T super Number + } + +// ----------------------------------------------------------------------------- + +fun myFunction() where { + T super Number +} diff --git a/DSL/tests/resources/formatting/declarations/functions/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with typed optional parameter.sdstest new file mode 100644 index 000000000..320e2d42f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +fun myFunction(a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/functions/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with typed required parameter.sdstest new file mode 100644 index 000000000..22d946074 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with typed required parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( a : Int ) + +// ----------------------------------------------------------------------------- + +fun myFunction(a: Int) diff --git a/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..2c5b6b9a7 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( vararg a : Int = 1 ) + +// ----------------------------------------------------------------------------- + +fun myFunction(vararg a: Int = 1) diff --git a/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest new file mode 100644 index 000000000..e2ed6cffb --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( vararg a : Int ) + +// ----------------------------------------------------------------------------- + +fun myFunction(vararg a: Int) diff --git a/DSL/tests/resources/formatting/declarations/functions/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with untyped optional parameter.sdstest new file mode 100644 index 000000000..5878f16cd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( a = 1 ) + +// ----------------------------------------------------------------------------- + +fun myFunction(a = 1) diff --git a/DSL/tests/resources/formatting/declarations/functions/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with untyped required parameter.sdstest new file mode 100644 index 000000000..e92311144 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( a ) + +// ----------------------------------------------------------------------------- + +fun myFunction(a) diff --git a/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..c88ff43de --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +fun myFunction ( vararg a = 1 ) + +// ----------------------------------------------------------------------------- + +fun myFunction(vararg a = 1) diff --git a/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..3d6fae2c5 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/functions/with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +fun myFunction ( vararg a ) + +// ----------------------------------------------------------------------------- + +fun myFunction(vararg a) diff --git a/DSL/tests/resources/formatting/declarations/pipelines/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/pipelines/annotation call.sdstest new file mode 100644 index 000000000..285b24295 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/pipelines/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation pipeline myPipeline { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +pipeline myPipeline {} diff --git a/DSL/tests/resources/formatting/declarations/pipelines/empty body.sdstest b/DSL/tests/resources/formatting/declarations/pipelines/empty body.sdstest new file mode 100644 index 000000000..57fb66cab --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/pipelines/empty body.sdstest @@ -0,0 +1,5 @@ +pipeline myPipeline { } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline {} diff --git a/DSL/tests/resources/formatting/declarations/pipelines/statements in body.sdstest b/DSL/tests/resources/formatting/declarations/pipelines/statements in body.sdstest new file mode 100644 index 000000000..6970f53fd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/pipelines/statements in body.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + val a = 1 ; + } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + val a = 1; +} diff --git a/DSL/tests/resources/formatting/declarations/segments/annotation call.sdstest b/DSL/tests/resources/formatting/declarations/segments/annotation call.sdstest new file mode 100644 index 000000000..6af46de14 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..105f30c51 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/complex parameter list (unchanged).sdstest @@ -0,0 +1,11 @@ +segment s( + a: A.B, + b: Int +) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: A.B, + b: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/complex parameter list.sdstest b/DSL/tests/resources/formatting/declarations/segments/complex parameter list.sdstest new file mode 100644 index 000000000..9e5065bca --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/complex parameter list.sdstest @@ -0,0 +1,8 @@ +segment s( a: A.B , b: Int ) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: A.B, + b: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest b/DSL/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest new file mode 100644 index 000000000..b91176007 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/complex result list (unchanged).sdstest @@ -0,0 +1,11 @@ +segment s() -> ( + x: A.B, + y: Int +) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: A.B, + y: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/complex result list.sdstest b/DSL/tests/resources/formatting/declarations/segments/complex result list.sdstest new file mode 100644 index 000000000..312c5ea41 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/complex result list.sdstest @@ -0,0 +1,8 @@ +segment s() -> ( x: A.B , y: Int ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: A.B, + y: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/internal segment with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/segments/internal segment with annotation call.sdstest new file mode 100644 index 000000000..9f8b3c0d2 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/internal segment with annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation internal segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +internal segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/internal segment.sdstest b/DSL/tests/resources/formatting/declarations/segments/internal segment.sdstest new file mode 100644 index 000000000..09ff8895c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/internal segment.sdstest @@ -0,0 +1,5 @@ +internal segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +internal segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/long parameter list.sdstest b/DSL/tests/resources/formatting/declarations/segments/long parameter list.sdstest new file mode 100644 index 000000000..565f47937 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/long parameter list.sdstest @@ -0,0 +1,10 @@ +segment s( a: Int , b: Int , c: Int , d: Int ) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: Int, + b: Int, + c: Int, + d: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/long result list.sdstest b/DSL/tests/resources/formatting/declarations/segments/long result list.sdstest new file mode 100644 index 000000000..97d846e55 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/long result list.sdstest @@ -0,0 +1,10 @@ +segment s() -> ( x: Int , y: Int , a: Int , b: Int ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: Int, + y: Int, + a: Int, + b: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/multiple parameters.sdstest b/DSL/tests/resources/formatting/declarations/segments/multiple parameters.sdstest new file mode 100644 index 000000000..a6ab6484b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/multiple parameters.sdstest @@ -0,0 +1,32 @@ +segment mySegment ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/multiple results.sdstest b/DSL/tests/resources/formatting/declarations/segments/multiple results.sdstest new file mode 100644 index 000000000..9755df46c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/multiple results.sdstest @@ -0,0 +1,20 @@ +segment mySegment ( ) -> ( + + @Annotation a , + + b , + + c : Int , + + d : Int + ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> ( + @Annotation + a, + b, + c: Int, + d: Int +) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/no parameters and no results and empty body.sdstest b/DSL/tests/resources/formatting/declarations/segments/no parameters and no results and empty body.sdstest new file mode 100644 index 000000000..edf487027 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/no parameters and no results and empty body.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/no results (explicit).sdstest b/DSL/tests/resources/formatting/declarations/segments/no results (explicit).sdstest new file mode 100644 index 000000000..dee2ed60c --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/no results (explicit).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> ( ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> () {} diff --git a/DSL/tests/resources/formatting/declarations/segments/one typed result (in parentheses).sdstest b/DSL/tests/resources/formatting/declarations/segments/one typed result (in parentheses).sdstest new file mode 100644 index 000000000..39e77c006 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/one typed result (in parentheses).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> ( a : Int ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> (a: Int) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/one typed result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/segments/one typed result (no parentheses).sdstest new file mode 100644 index 000000000..82099ddcd --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/one typed result (no parentheses).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> a : Int { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> a: Int {} diff --git a/DSL/tests/resources/formatting/declarations/segments/one untyped result (no parentheses).sdstest b/DSL/tests/resources/formatting/declarations/segments/one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..44f98d7ab --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/one untyped result (no parentheses).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> a { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> a {} diff --git a/DSL/tests/resources/formatting/declarations/segments/one untyped result (with parentheses).sdstest b/DSL/tests/resources/formatting/declarations/segments/one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..59ca26b2f --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/one untyped result (with parentheses).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( ) -> ( a ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment() -> (a) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/private segment with annotation call.sdstest b/DSL/tests/resources/formatting/declarations/segments/private segment with annotation call.sdstest new file mode 100644 index 000000000..e8abab52d --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/private segment with annotation call.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation private segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +private segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/private segment.sdstest b/DSL/tests/resources/formatting/declarations/segments/private segment.sdstest new file mode 100644 index 000000000..077937c9e --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/private segment.sdstest @@ -0,0 +1,5 @@ +private segment mySegment ( ) { } + +// ----------------------------------------------------------------------------- + +private segment mySegment() {} diff --git a/DSL/tests/resources/formatting/declarations/segments/statements in body.sdstest b/DSL/tests/resources/formatting/declarations/segments/statements in body.sdstest new file mode 100644 index 000000000..c1ccc34a0 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/statements in body.sdstest @@ -0,0 +1,9 @@ +private segment mySegment ( ) { + val a = 1; + } + +// ----------------------------------------------------------------------------- + +private segment mySegment() { + val a = 1; +} diff --git a/DSL/tests/resources/formatting/declarations/segments/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with typed optional parameter.sdstest new file mode 100644 index 000000000..af4508400 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with typed optional parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( a : Int = 1 ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(a: Int = 1) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with typed required parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with typed required parameter.sdstest new file mode 100644 index 000000000..0d437d58b --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with typed required parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( a : Int ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(a: Int) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..51cff7374 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( vararg a : Int = 1 ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(vararg a: Int = 1) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest new file mode 100644 index 000000000..69ef43188 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with typed variadic parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( vararg a : Int ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(vararg a: Int) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with untyped optional parameter.sdstest new file mode 100644 index 000000000..2bce54284 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with untyped optional parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( a = 1 ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(a = 1) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with untyped required parameter.sdstest new file mode 100644 index 000000000..ea0eae063 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with untyped required parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( a ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(a) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..0ee3cffd8 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,5 @@ +segment mySegment ( vararg a = 1 ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(vararg a = 1) {} diff --git a/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..111740490 --- /dev/null +++ b/DSL/tests/resources/formatting/declarations/segments/with untyped variadic parameter.sdstest @@ -0,0 +1,5 @@ +segment mySegment ( vararg a ) { } + +// ----------------------------------------------------------------------------- + +segment mySegment(vararg a) {} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/addition.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/addition.sdstest new file mode 100644 index 000000000..7e411eca9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/addition.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 + 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 + 2; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/complex example.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/complex example.sdstest new file mode 100644 index 000000000..0ca040486 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/complex example.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( 1 + 2 ) * - 3 / ( 1 - 4 ) + 5; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (1 + 2) * -3 / (1 - 4) + 5; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/division.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/division.sdstest new file mode 100644 index 000000000..a53dbe7e6 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/division.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 / 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 / 2; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/multiplication.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/multiplication.sdstest new file mode 100644 index 000000000..021a2ed15 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/multiplication.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 * 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 * 2; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/negation.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/negation.sdstest new file mode 100644 index 000000000..ef14ab5c7 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/negation.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + - 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + -1; +} diff --git a/DSL/tests/resources/formatting/expressions/arithmetic operators/subtraction.sdstest b/DSL/tests/resources/formatting/expressions/arithmetic operators/subtraction.sdstest new file mode 100644 index 000000000..57f2c8b71 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/arithmetic operators/subtraction.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 - 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 - 2; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..f0af1ad3a --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +pipeline p { + ( + a: A.B, + b: Int + ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int + ) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list.sdstest new file mode 100644 index 000000000..19b5d9d0d --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/complex parameter list.sdstest @@ -0,0 +1,12 @@ +pipeline p { + ( a: A.B , b: Int ){}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int + ) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/filled body.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/filled body.sdstest new file mode 100644 index 000000000..640c812ce --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/filled body.sdstest @@ -0,0 +1,13 @@ +pipeline myPipeline { + ( ) { + val a = 1 ; + }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () { + val a = 1; + }; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/long parameter list.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/long parameter list.sdstest new file mode 100644 index 000000000..a68c125b8 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/long parameter list.sdstest @@ -0,0 +1,14 @@ +pipeline p { + ( a: Int , b: Int , c: Int , d: Int ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: Int, + b: Int, + c: Int, + d: Int + ) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest new file mode 100644 index 000000000..4c0f151e9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/multiple parameters.sdstest @@ -0,0 +1,36 @@ +pipeline myPipeline { + ( + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + ( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/no parameters and empty body.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/no parameters and empty body.sdstest new file mode 100644 index 000000000..2e0c08ffc --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/no parameters and empty body.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with typed optional parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with typed optional parameter.sdstest new file mode 100644 index 000000000..c37e4bf97 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with typed optional parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a : Int = 1 ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a: Int = 1) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with typed required parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with typed required parameter.sdstest new file mode 100644 index 000000000..7eb4216c5 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with typed required parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a : Int ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a: Int) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..9d2adadea --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a : Int = 1 ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a: Int = 1) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest new file mode 100644 index 000000000..2c6111a39 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a : Int ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a: Int) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with untyped optional parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped optional parameter.sdstest new file mode 100644 index 000000000..b045d39aa --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a = 1 ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a = 1) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with untyped required parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped required parameter.sdstest new file mode 100644 index 000000000..8ecee2933 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped required parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..fa0340f01 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a = 1 ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a = 1) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest new file mode 100644 index 000000000..65b5c91fe --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/block lambdas/with untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a ) { }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a) {}; +} diff --git a/DSL/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest b/DSL/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest new file mode 100644 index 000000000..bf4f30fce --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/complex argument list (unchanged).sdstest @@ -0,0 +1,15 @@ +pipeline p { + f( + f(), + 2 + ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + f(), + 2 + ); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/complex argument list.sdstest b/DSL/tests/resources/formatting/expressions/calls/complex argument list.sdstest new file mode 100644 index 000000000..d34dfe563 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/complex argument list.sdstest @@ -0,0 +1,12 @@ +pipeline p { + f( f() , 2 ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + f(), + 2 + ); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/complex call.sdstest b/DSL/tests/resources/formatting/expressions/calls/complex call.sdstest new file mode 100644 index 000000000..7b50db792 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/complex call.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < * , in Number , out Number , T = Number > ( 1 , b = 2 ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f<*, in Number, out Number, T = Number>(1, b = 2); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest new file mode 100644 index 000000000..d429c4fd9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/contravariant type argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < in Int > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/covariant type argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/covariant type argument.sdstest new file mode 100644 index 000000000..755fcfe8d --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/covariant type argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < out Int > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest b/DSL/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest new file mode 100644 index 000000000..62ad87be7 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/empty type argument list and no arguments.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f<>(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/long argument list.sdstest b/DSL/tests/resources/formatting/expressions/calls/long argument list.sdstest new file mode 100644 index 000000000..38b8c4b9e --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/long argument list.sdstest @@ -0,0 +1,14 @@ +pipeline p { + f( 1 , 2 , 3 , 4 ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + 1, + 2, + 3, + 4 + ); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/named argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/named argument.sdstest new file mode 100644 index 000000000..3e727f761 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/named argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f ( b = 2 ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(b = 2); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/named type argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/named type argument.sdstest new file mode 100644 index 000000000..80d0f3be5 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/named type argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < T = Int > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest b/DSL/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest new file mode 100644 index 000000000..d89d28d64 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/nested type argument lists (named type argument).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < T = List < S > > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f>(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/no type argument list and no arguments.sdstest b/DSL/tests/resources/formatting/expressions/calls/no type argument list and no arguments.sdstest new file mode 100644 index 000000000..a8f90d697 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/no type argument list and no arguments.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/positional argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/positional argument.sdstest new file mode 100644 index 000000000..c4234d45e --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/positional argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f ( 1 ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(1); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/positional type argument.sdstest b/DSL/tests/resources/formatting/expressions/calls/positional type argument.sdstest new file mode 100644 index 000000000..8eb1593ca --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/positional type argument.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < Int > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest b/DSL/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest new file mode 100644 index 000000000..d30be06a3 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/skip-nested type argument lists (positional type argument).sdstest @@ -0,0 +1,41 @@ +pipeline myPipeline { + /* + * Once Langium supports LL(*) parsing, this should work. + * + * For now, we can either parse + * - f>() or + * - a < f() + * but not both. + * + * The problem is that the parser can't decide with finite lookahead whether + * the first < is the start of a type argument list or the operator of a + * comparison expression. + * + * We decided to only support the second case for now. The first case leads + * to a syntax error. To work around this, you can use the following syntax: + * - f>() + */ + f>(); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + /* + * Once Langium supports LL(*) parsing, this should work. + * + * For now, we can either parse + * - f>() or + * - a < f() + * but not both. + * + * The problem is that the parser can't decide with finite lookahead whether + * the first < is the start of a type argument list or the operator of a + * comparison expression. + * + * We decided to only support the second case for now. The first case leads + * to a syntax error. To work around this, you can use the following syntax: + * - f>() + */ + f>(); +} diff --git a/DSL/tests/resources/formatting/expressions/calls/star projection.sdstest b/DSL/tests/resources/formatting/expressions/calls/star projection.sdstest new file mode 100644 index 000000000..0ed8577a9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/calls/star projection.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + f < * > ( ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + f<*>(); +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/greater than or equal.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/greater than or equal.sdstest new file mode 100644 index 000000000..5f952a88d --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/greater than or equal.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 >= 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 >= 2; +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/greater than.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/greater than.sdstest new file mode 100644 index 000000000..acb064dff --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/greater than.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 > 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 > 2; +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/less than or equal.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/less than or equal.sdstest new file mode 100644 index 000000000..8ddfe3d26 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/less than or equal.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 <= 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 <= 2; +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest new file mode 100644 index 000000000..a22882b23 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/less than vs. type argument list.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 < a(); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 < a(); +} diff --git a/DSL/tests/resources/formatting/expressions/comparison operators/less than.sdstest b/DSL/tests/resources/formatting/expressions/comparison operators/less than.sdstest new file mode 100644 index 000000000..2445c4b40 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/comparison operators/less than.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 < 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 < 2; +} diff --git a/DSL/tests/resources/formatting/expressions/complex chained expression.sdstest b/DSL/tests/resources/formatting/expressions/complex chained expression.sdstest new file mode 100644 index 000000000..a1ade93ee --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/complex chained expression.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + a . member ? . f ( ) [ 1 ]; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + a.member?.f()[1]; +} diff --git a/DSL/tests/resources/formatting/expressions/equality operators/equal.sdstest b/DSL/tests/resources/formatting/expressions/equality operators/equal.sdstest new file mode 100644 index 000000000..23abb29b1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/equality operators/equal.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 == 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 == 2; +} diff --git a/DSL/tests/resources/formatting/expressions/equality operators/identical.sdstest b/DSL/tests/resources/formatting/expressions/equality operators/identical.sdstest new file mode 100644 index 000000000..f6514e25d --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/equality operators/identical.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 === 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 === 2; +} diff --git a/DSL/tests/resources/formatting/expressions/equality operators/not equal.sdstest b/DSL/tests/resources/formatting/expressions/equality operators/not equal.sdstest new file mode 100644 index 000000000..2b3c90e0a --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/equality operators/not equal.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 != 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 != 2; +} diff --git a/DSL/tests/resources/formatting/expressions/equality operators/not identical.sdstest b/DSL/tests/resources/formatting/expressions/equality operators/not identical.sdstest new file mode 100644 index 000000000..286e60291 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/equality operators/not identical.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1 !== 2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1 !== 2; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..3bf86f912 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list (unchanged).sdstest @@ -0,0 +1,15 @@ +pipeline p { + ( + a: A.B, + b: Int + ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list.sdstest new file mode 100644 index 000000000..7f08ddc55 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/complex parameter list.sdstest @@ -0,0 +1,12 @@ +pipeline p { + ( a: A.B , b: Int ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/long parameter list.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/long parameter list.sdstest new file mode 100644 index 000000000..fe3417ba9 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/long parameter list.sdstest @@ -0,0 +1,14 @@ +pipeline p { + ( a: Int , b: Int , c: Int , d: Int ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: Int, + b: Int, + c: Int, + d: Int + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest new file mode 100644 index 000000000..b47c9d17e --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/multiple parameters.sdstest @@ -0,0 +1,37 @@ +pipeline myPipeline { + ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) -> 4; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + ( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) -> 4; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/no parameters.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/no parameters.sdstest new file mode 100644 index 000000000..527e3e390 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/no parameters.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/typed optional parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/typed optional parameter.sdstest new file mode 100644 index 000000000..dc1040435 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/typed optional parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a = 1 ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a = 1) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/typed required parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/typed required parameter.sdstest new file mode 100644 index 000000000..42b89fa79 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/typed required parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a : Int ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a: Int) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..b0ad6f272 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a : Int = 1 ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a: Int = 1) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest new file mode 100644 index 000000000..17e57f8bc --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/typed variadic parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a : Int ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a: Int) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/untyped optional parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped optional parameter.sdstest new file mode 100644 index 000000000..4b7e8022c --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped optional parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a : Int = 1 ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a: Int = 1) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/untyped required parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped required parameter.sdstest new file mode 100644 index 000000000..750140cd2 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped required parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( a ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (a) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..91c5a9b78 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter (with default value).sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a = 1 ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a = 1) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest new file mode 100644 index 000000000..ae0c6e22b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/expression lambdas/untyped variadic parameter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( vararg a ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (vararg a) -> 1; +} diff --git a/DSL/tests/resources/formatting/expressions/indexed accesses/literal index.sdstest b/DSL/tests/resources/formatting/expressions/indexed accesses/literal index.sdstest new file mode 100644 index 000000000..04025cfb0 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/indexed accesses/literal index.sdstest @@ -0,0 +1,9 @@ +pipeline test { + a [ 1 ]; +} + +// ----------------------------------------------------------------------------- + +pipeline test { + a[1]; +} diff --git a/DSL/tests/resources/formatting/expressions/indexed accesses/reference index.sdstest b/DSL/tests/resources/formatting/expressions/indexed accesses/reference index.sdstest new file mode 100644 index 000000000..37f9b1407 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/indexed accesses/reference index.sdstest @@ -0,0 +1,9 @@ +pipeline test { + a [ b ]; +} + +// ----------------------------------------------------------------------------- + +pipeline test { + a[b]; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/false.sdstest b/DSL/tests/resources/formatting/expressions/literals/false.sdstest new file mode 100644 index 000000000..8c6cf3fd7 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/false.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + false; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + false; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/float/basic example.sdstest b/DSL/tests/resources/formatting/expressions/literals/float/basic example.sdstest new file mode 100644 index 000000000..1419b4982 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/float/basic example.sdstest @@ -0,0 +1,25 @@ +pipeline myPipeline { + 1.2; + 1e10; + 1e+10; + 1e-10; + 1.2e2; + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1.2; + 1e10; + 1e+10; + 1e-10; + 1.2e2; + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with lowercase e.sdstest b/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with lowercase e.sdstest new file mode 100644 index 000000000..186fb3839 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with lowercase e.sdstest @@ -0,0 +1,15 @@ +pipeline myPipeline { + 1e10; + 1e+10; + 1e-10; + 1.2e2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1e10; + 1e+10; + 1e-10; + 1.2e2; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with uppercase e.sdstest b/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with uppercase e.sdstest new file mode 100644 index 000000000..879a2538b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/float/scientific notation with uppercase e.sdstest @@ -0,0 +1,15 @@ +pipeline myPipeline { + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1E10; + 1E+10; + 1E-10; + 1.2E2; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/int/leading zero.sdstest b/DSL/tests/resources/formatting/expressions/literals/int/leading zero.sdstest new file mode 100644 index 000000000..f057e8966 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/int/leading zero.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 01; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 01; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/int/multiple digits.sdstest b/DSL/tests/resources/formatting/expressions/literals/int/multiple digits.sdstest new file mode 100644 index 000000000..a68739c25 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/int/multiple digits.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1234567890; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1234567890; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/int/one digit.sdstest b/DSL/tests/resources/formatting/expressions/literals/int/one digit.sdstest new file mode 100644 index 000000000..497f4c12a --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/int/one digit.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + 1; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + 1; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/null.sdstest b/DSL/tests/resources/formatting/expressions/literals/null.sdstest new file mode 100644 index 000000000..3407a6af1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/null.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + null; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + null; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/basic content.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/basic content.sdstest new file mode 100644 index 000000000..94a0a5fe1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/basic content.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "myString"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "myString"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/closing template expression delimiter.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/closing template expression delimiter.sdstest new file mode 100644 index 000000000..fa870d84b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/closing template expression delimiter.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "}}"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "}}"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/curly braces separated by space.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/curly braces separated by space.sdstest new file mode 100644 index 000000000..ee0f4f4b8 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/curly braces separated by space.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{ {"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{ {"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/empty template expression.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/empty template expression.sdstest new file mode 100644 index 000000000..ca55879dd --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/empty template expression.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{{ }}"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{{ }}"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/empty.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/empty.sdstest new file mode 100644 index 000000000..eb036b803 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/empty.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ""; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + ""; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/escaped curly brace.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/escaped curly brace.sdstest new file mode 100644 index 000000000..235321a04 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/escaped curly brace.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "\{{"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "\{{"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/multiple lines.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/multiple lines.sdstest new file mode 100644 index 000000000..070e3bfeb --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/multiple lines.sdstest @@ -0,0 +1,17 @@ +pipeline myPipeline { + " + multi + line + string + "; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + " + multi + line + string + "; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/newline escape sequence.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/newline escape sequence.sdstest new file mode 100644 index 000000000..abb639863 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/newline escape sequence.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "\n"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "\n"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/single curly brace.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/single curly brace.sdstest new file mode 100644 index 000000000..4e3a0fa36 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/single curly brace.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/single quote.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/single quote.sdstest new file mode 100644 index 000000000..710cd6a04 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/single quote.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "'"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "'"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/template string with basic expression.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/template string with basic expression.sdstest new file mode 100644 index 000000000..d8f58815a --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/template string with basic expression.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{{ 1 }}"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{{ 1 }}"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/template string with two expressions.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/template string with two expressions.sdstest new file mode 100644 index 000000000..36fba2cf1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/template string with two expressions.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "{{ 1 }} {{ 2 }}"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "{{ 1 }} {{ 2 }}"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/string/unicode escape sequence.sdstest b/DSL/tests/resources/formatting/expressions/literals/string/unicode escape sequence.sdstest new file mode 100644 index 000000000..3aa4313b0 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/string/unicode escape sequence.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + "\u000c"; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + "\u000c"; +} diff --git a/DSL/tests/resources/formatting/expressions/literals/true.sdstest b/DSL/tests/resources/formatting/expressions/literals/true.sdstest new file mode 100644 index 000000000..b9138ad5b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/literals/true.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + true; +} diff --git a/DSL/tests/resources/formatting/expressions/logical operations/complex example.sdstest b/DSL/tests/resources/formatting/expressions/logical operations/complex example.sdstest new file mode 100644 index 000000000..cc04409e1 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/logical operations/complex example.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + not true and false or true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + not true and false or true; +} diff --git a/DSL/tests/resources/formatting/expressions/logical operations/conjunction.sdstest b/DSL/tests/resources/formatting/expressions/logical operations/conjunction.sdstest new file mode 100644 index 000000000..69d9a9ebf --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/logical operations/conjunction.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + false and true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + false and true; +} diff --git a/DSL/tests/resources/formatting/expressions/logical operations/disjunction.sdstest b/DSL/tests/resources/formatting/expressions/logical operations/disjunction.sdstest new file mode 100644 index 000000000..84ecb6558 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/logical operations/disjunction.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + true or true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + true or true; +} diff --git a/DSL/tests/resources/formatting/expressions/logical operations/negation.sdstest b/DSL/tests/resources/formatting/expressions/logical operations/negation.sdstest new file mode 100644 index 000000000..41a736c35 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/logical operations/negation.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + not true; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + not true; +} diff --git a/DSL/tests/resources/formatting/expressions/member accesses/not nullable.sdstest b/DSL/tests/resources/formatting/expressions/member accesses/not nullable.sdstest new file mode 100644 index 000000000..e2a09dbd2 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/member accesses/not nullable.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + a . member; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + a.member; +} diff --git a/DSL/tests/resources/formatting/expressions/member accesses/nullable.sdstest b/DSL/tests/resources/formatting/expressions/member accesses/nullable.sdstest new file mode 100644 index 000000000..a7a86ad12 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/member accesses/nullable.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + a ? . member; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + a?.member; +} diff --git a/DSL/tests/resources/formatting/expressions/parenthesized expressions/nested.sdstest b/DSL/tests/resources/formatting/expressions/parenthesized expressions/nested.sdstest new file mode 100644 index 000000000..87550654b --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/parenthesized expressions/nested.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( ( 1 + 2 ) ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + ((1 + 2)); +} diff --git a/DSL/tests/resources/formatting/expressions/parenthesized expressions/one level.sdstest b/DSL/tests/resources/formatting/expressions/parenthesized expressions/one level.sdstest new file mode 100644 index 000000000..c277e146f --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/parenthesized expressions/one level.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + ( 1 + 2 ); +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + (1 + 2); +} diff --git a/DSL/tests/resources/formatting/expressions/reference.sdstest b/DSL/tests/resources/formatting/expressions/reference.sdstest new file mode 100644 index 000000000..62fad2d65 --- /dev/null +++ b/DSL/tests/resources/formatting/expressions/reference.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + a; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + a; +} diff --git a/DSL/tests/resources/formatting/modules/annotation call and declaration.sdstest b/DSL/tests/resources/formatting/modules/annotation call and declaration.sdstest new file mode 100644 index 000000000..a9aafef79 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and declaration.sdstest @@ -0,0 +1,11 @@ + +@Annotation1 + + +class C + +// ----------------------------------------------------------------------------- + +@Annotation1 + +class C diff --git a/DSL/tests/resources/formatting/modules/annotation call and import and declaration.sdstest b/DSL/tests/resources/formatting/modules/annotation call and import and declaration.sdstest new file mode 100644 index 000000000..2667a5e11 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and import and declaration.sdstest @@ -0,0 +1,16 @@ + +@Annotation1 + + +import myPackage . MyClass + + +class C + +// ----------------------------------------------------------------------------- + +@Annotation1 + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/formatting/modules/annotation call and import.sdstest b/DSL/tests/resources/formatting/modules/annotation call and import.sdstest new file mode 100644 index 000000000..ab9fca0f1 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and import.sdstest @@ -0,0 +1,11 @@ + +@Annotation1 + + +import myPackage . MyClass + +// ----------------------------------------------------------------------------- + +@Annotation1 + +import myPackage.MyClass diff --git a/DSL/tests/resources/formatting/modules/annotation call and package name and declaration.sdstest b/DSL/tests/resources/formatting/modules/annotation call and package name and declaration.sdstest new file mode 100644 index 000000000..b3473cf4f --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and package name and declaration.sdstest @@ -0,0 +1,16 @@ + +@Annotation1 + + +package myPackage + + +class C + +// ----------------------------------------------------------------------------- + +@Annotation1 + +package myPackage + +class C diff --git a/DSL/tests/resources/formatting/modules/annotation call and package name and import and declaration.sdstest b/DSL/tests/resources/formatting/modules/annotation call and package name and import and declaration.sdstest new file mode 100644 index 000000000..55441b8bf --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and package name and import and declaration.sdstest @@ -0,0 +1,21 @@ + +@Annotation1 + + +package myPackage + + +import myPackage . MyClass + + +class C + +// ----------------------------------------------------------------------------- + +@Annotation1 + +package myPackage + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/formatting/modules/annotation call and package name and import.sdstest b/DSL/tests/resources/formatting/modules/annotation call and package name and import.sdstest new file mode 100644 index 000000000..ea40f8d3e --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and package name and import.sdstest @@ -0,0 +1,16 @@ + +@Annotation1 + + +package myPackage + + +import myPackage . MyClass + +// ----------------------------------------------------------------------------- + +@Annotation1 + +package myPackage + +import myPackage.MyClass diff --git a/DSL/tests/resources/formatting/modules/annotation call and package name.sdstest b/DSL/tests/resources/formatting/modules/annotation call and package name.sdstest new file mode 100644 index 000000000..c2e552b60 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call and package name.sdstest @@ -0,0 +1,11 @@ + +@Annotation1 + + +package myPackage + +// ----------------------------------------------------------------------------- + +@Annotation1 + +package myPackage diff --git a/DSL/tests/resources/formatting/modules/annotation call.sdstest b/DSL/tests/resources/formatting/modules/annotation call.sdstest new file mode 100644 index 000000000..ba2bf9361 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation call.sdstest @@ -0,0 +1,6 @@ + +@Annotation1 + +// ----------------------------------------------------------------------------- + +@Annotation1 diff --git a/DSL/tests/resources/formatting/modules/annotation calls and declarations.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and declarations.sdstest new file mode 100644 index 000000000..4cf4f4086 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and declarations.sdstest @@ -0,0 +1,19 @@ + +@Annotation1 + +@Annotation2 + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/annotation calls and imports and declarations.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and imports and declarations.sdstest new file mode 100644 index 000000000..bce326581 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and imports and declarations.sdstest @@ -0,0 +1,30 @@ + +@Annotation1 + +@Annotation2 + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/annotation calls and imports.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and imports.sdstest new file mode 100644 index 000000000..25697f1ee --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and imports.sdstest @@ -0,0 +1,20 @@ + +@Annotation1 + +@Annotation2 + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/formatting/modules/annotation calls and package name and declarations.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and package name and declarations.sdstest new file mode 100644 index 000000000..fa0f1b5b8 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and package name and declarations.sdstest @@ -0,0 +1,24 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/annotation calls and package name and imports and declarations.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and package name and imports and declarations.sdstest new file mode 100644 index 000000000..864e1d890 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and package name and imports and declarations.sdstest @@ -0,0 +1,35 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/annotation calls and package name and imports.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and package name and imports.sdstest new file mode 100644 index 000000000..ee0919194 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and package name and imports.sdstest @@ -0,0 +1,25 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/formatting/modules/annotation calls and package name.sdstest b/DSL/tests/resources/formatting/modules/annotation calls and package name.sdstest new file mode 100644 index 000000000..d06688d34 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls and package name.sdstest @@ -0,0 +1,14 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage diff --git a/DSL/tests/resources/formatting/modules/annotation calls.sdstest b/DSL/tests/resources/formatting/modules/annotation calls.sdstest new file mode 100644 index 000000000..875e804be --- /dev/null +++ b/DSL/tests/resources/formatting/modules/annotation calls.sdstest @@ -0,0 +1,9 @@ + +@Annotation1 + +@Annotation2 + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 diff --git a/DSL/tests/resources/formatting/modules/declaration.sdstest b/DSL/tests/resources/formatting/modules/declaration.sdstest new file mode 100644 index 000000000..d0cb6c93f --- /dev/null +++ b/DSL/tests/resources/formatting/modules/declaration.sdstest @@ -0,0 +1,6 @@ + +class C + +// ----------------------------------------------------------------------------- + +class C diff --git a/DSL/tests/resources/formatting/modules/declarations.sdstest b/DSL/tests/resources/formatting/modules/declarations.sdstest new file mode 100644 index 000000000..b35b30a38 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/declarations.sdstest @@ -0,0 +1,11 @@ + +class C + + +class D + +// ----------------------------------------------------------------------------- + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/empty.sdstest b/DSL/tests/resources/formatting/modules/empty.sdstest new file mode 100644 index 000000000..2acf4e336 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/empty.sdstest @@ -0,0 +1,5 @@ +// $TEST$ no_syntax_error + +// ----------------------------------------------------------------------------- + +// $TEST$ no_syntax_error diff --git a/DSL/tests/resources/formatting/modules/full.sdstest b/DSL/tests/resources/formatting/modules/full.sdstest new file mode 100644 index 000000000..2ee8e0626 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/full.sdstest @@ -0,0 +1,102 @@ + +@Annotation1 + +@Annotation2 + + +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +@Annotation1 + +@Annotation2 + +annotation A + + +@Annotation1 + +@Annotation2 + +class C + + +@Annotation1 + +@Annotation2 + +enum E {} + + +@Annotation1 + +@Annotation2 + +fun f() + + +@Annotation1 + +@Annotation2 + +pipeline p {} + + +@Annotation1 + +@Annotation2 + +segment s() {} + + +@Annotation1 + +@Annotation2 + +schema S {} + +// ----------------------------------------------------------------------------- + +@Annotation1 +@Annotation2 + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +@Annotation1 +@Annotation2 +annotation A + +@Annotation1 +@Annotation2 +class C + +@Annotation1 +@Annotation2 +enum E {} + +@Annotation1 +@Annotation2 +fun f() + +@Annotation1 +@Annotation2 +pipeline p {} + +@Annotation1 +@Annotation2 +segment s() {} + +@Annotation1 +@Annotation2 +schema S {} diff --git a/DSL/tests/resources/formatting/modules/import and declaration.sdstest b/DSL/tests/resources/formatting/modules/import and declaration.sdstest new file mode 100644 index 000000000..9699a087c --- /dev/null +++ b/DSL/tests/resources/formatting/modules/import and declaration.sdstest @@ -0,0 +1,11 @@ + +import myPackage . MyClass + + +class C + +// ----------------------------------------------------------------------------- + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/formatting/modules/import.sdstest b/DSL/tests/resources/formatting/modules/import.sdstest new file mode 100644 index 000000000..14c49da8b --- /dev/null +++ b/DSL/tests/resources/formatting/modules/import.sdstest @@ -0,0 +1,6 @@ + +import myPackage . MyClass + +// ----------------------------------------------------------------------------- + +import myPackage.MyClass diff --git a/DSL/tests/resources/formatting/modules/imports and declarations.sdstest b/DSL/tests/resources/formatting/modules/imports and declarations.sdstest new file mode 100644 index 000000000..32e4f01fe --- /dev/null +++ b/DSL/tests/resources/formatting/modules/imports and declarations.sdstest @@ -0,0 +1,22 @@ + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/imports.sdstest b/DSL/tests/resources/formatting/modules/imports.sdstest new file mode 100644 index 000000000..419960c3f --- /dev/null +++ b/DSL/tests/resources/formatting/modules/imports.sdstest @@ -0,0 +1,12 @@ + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + +// ----------------------------------------------------------------------------- + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/formatting/modules/package name and declaration.sdstest b/DSL/tests/resources/formatting/modules/package name and declaration.sdstest new file mode 100644 index 000000000..66fccfb48 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and declaration.sdstest @@ -0,0 +1,11 @@ + +package myPackage + + +class C + +// ----------------------------------------------------------------------------- + +package myPackage + +class C diff --git a/DSL/tests/resources/formatting/modules/package name and declarations.sdstest b/DSL/tests/resources/formatting/modules/package name and declarations.sdstest new file mode 100644 index 000000000..b12ede61e --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and declarations.sdstest @@ -0,0 +1,16 @@ + +package myPackage + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +package myPackage + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/package name and import and declaration.sdstest b/DSL/tests/resources/formatting/modules/package name and import and declaration.sdstest new file mode 100644 index 000000000..1ec659baf --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and import and declaration.sdstest @@ -0,0 +1,16 @@ + +package myPackage + + +import myPackage . MyClass + + +class C + +// ----------------------------------------------------------------------------- + +package myPackage + +import myPackage.MyClass + +class C diff --git a/DSL/tests/resources/formatting/modules/package name and import.sdstest b/DSL/tests/resources/formatting/modules/package name and import.sdstest new file mode 100644 index 000000000..0a6982a88 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and import.sdstest @@ -0,0 +1,11 @@ + +package myPackage + + +import myPackage . MyClass + +// ----------------------------------------------------------------------------- + +package myPackage + +import myPackage.MyClass diff --git a/DSL/tests/resources/formatting/modules/package name and imports and declarations.sdstest b/DSL/tests/resources/formatting/modules/package name and imports and declarations.sdstest new file mode 100644 index 000000000..85bdca3a1 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and imports and declarations.sdstest @@ -0,0 +1,26 @@ +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + + +class C + + +class D + +// ----------------------------------------------------------------------------- + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* + +class C + +class D diff --git a/DSL/tests/resources/formatting/modules/package name and imports.sdstest b/DSL/tests/resources/formatting/modules/package name and imports.sdstest new file mode 100644 index 000000000..03bb11054 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name and imports.sdstest @@ -0,0 +1,17 @@ + +package myPackage + + +import myPackage . MyClass + +import myPackage . MyClass as Class + +import myPackage . * + +// ----------------------------------------------------------------------------- + +package myPackage + +import myPackage.MyClass +import myPackage.MyClass as Class +import myPackage.* diff --git a/DSL/tests/resources/formatting/modules/package name.sdstest b/DSL/tests/resources/formatting/modules/package name.sdstest new file mode 100644 index 000000000..b2f23bf37 --- /dev/null +++ b/DSL/tests/resources/formatting/modules/package name.sdstest @@ -0,0 +1,6 @@ + +package myPackage + +// ----------------------------------------------------------------------------- + +package myPackage diff --git a/DSL/tests/resources/formatting/schema/annotationCall.sdstest b/DSL/tests/resources/formatting/schema/annotationCall.sdstest new file mode 100644 index 000000000..0870a5553 --- /dev/null +++ b/DSL/tests/resources/formatting/schema/annotationCall.sdstest @@ -0,0 +1,10 @@ +package test + +@Annotation schema MySchema { } + +// ----------------------------------------------------------------------------- + +package test + +@Annotation +schema MySchema {} diff --git a/DSL/tests/resources/formatting/schema/empty schema.sdstest b/DSL/tests/resources/formatting/schema/empty schema.sdstest new file mode 100644 index 000000000..5a0689a3b --- /dev/null +++ b/DSL/tests/resources/formatting/schema/empty schema.sdstest @@ -0,0 +1,5 @@ +schema MySchema { } + +// ----------------------------------------------------------------------------- + +schema MySchema {} diff --git a/DSL/tests/resources/formatting/schema/one column.sdstest b/DSL/tests/resources/formatting/schema/one column.sdstest new file mode 100644 index 000000000..fb9a45b6f --- /dev/null +++ b/DSL/tests/resources/formatting/schema/one column.sdstest @@ -0,0 +1,9 @@ +schema MySchema { + "column1" : Int + } + +// ----------------------------------------------------------------------------- + +schema MySchema { + "column1": Int +} diff --git a/DSL/tests/resources/formatting/schema/two columns.sdstest b/DSL/tests/resources/formatting/schema/two columns.sdstest new file mode 100644 index 000000000..ff79b0674 --- /dev/null +++ b/DSL/tests/resources/formatting/schema/two columns.sdstest @@ -0,0 +1,13 @@ +schema MySchema { + + "column1" : Int , + + "column2" : String + } + +// ----------------------------------------------------------------------------- + +schema MySchema { + "column1": Int, + "column2": String +} diff --git a/DSL/tests/resources/formatting/statements/assignments/in block lambda.sdstest b/DSL/tests/resources/formatting/statements/assignments/in block lambda.sdstest new file mode 100644 index 000000000..6c131b15b --- /dev/null +++ b/DSL/tests/resources/formatting/statements/assignments/in block lambda.sdstest @@ -0,0 +1,15 @@ +pipeline myPipeline { + () { + val a = 0 ; + val a , _ , yield b = call() ; + }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () { + val a = 0; + val a, _, yield b = call(); + }; +} diff --git a/DSL/tests/resources/formatting/statements/assignments/in pipeline.sdstest b/DSL/tests/resources/formatting/statements/assignments/in pipeline.sdstest new file mode 100644 index 000000000..c0fcc6099 --- /dev/null +++ b/DSL/tests/resources/formatting/statements/assignments/in pipeline.sdstest @@ -0,0 +1,11 @@ +pipeline myPipeline { + val a = 0 ; + val a , _ , yield b = call() ; + } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + val a = 0; + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/formatting/statements/assignments/in segment.sdstest b/DSL/tests/resources/formatting/statements/assignments/in segment.sdstest new file mode 100644 index 000000000..10cf1440b --- /dev/null +++ b/DSL/tests/resources/formatting/statements/assignments/in segment.sdstest @@ -0,0 +1,11 @@ +segment mySegment() { + val a = 0 ; + val a , _ , yield b = call() ; + } + +// ----------------------------------------------------------------------------- + +segment mySegment() { + val a = 0; + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/formatting/statements/expression statements/in block lambda.sdstest b/DSL/tests/resources/formatting/statements/expression statements/in block lambda.sdstest new file mode 100644 index 000000000..625725d3a --- /dev/null +++ b/DSL/tests/resources/formatting/statements/expression statements/in block lambda.sdstest @@ -0,0 +1,13 @@ +pipeline myPipeline { + () { + call() ; + }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () { + call(); + }; +} diff --git a/DSL/tests/resources/formatting/statements/expression statements/in pipeline.sdstest b/DSL/tests/resources/formatting/statements/expression statements/in pipeline.sdstest new file mode 100644 index 000000000..3163f8172 --- /dev/null +++ b/DSL/tests/resources/formatting/statements/expression statements/in pipeline.sdstest @@ -0,0 +1,9 @@ +pipeline myPipeline { + call() ; + } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + call(); +} diff --git a/DSL/tests/resources/formatting/statements/expression statements/in segment.sdstest b/DSL/tests/resources/formatting/statements/expression statements/in segment.sdstest new file mode 100644 index 000000000..1e362798d --- /dev/null +++ b/DSL/tests/resources/formatting/statements/expression statements/in segment.sdstest @@ -0,0 +1,9 @@ +segment mySegment() { + call() ; +} + +// ----------------------------------------------------------------------------- + +segment mySegment() { + call(); +} diff --git a/DSL/tests/resources/formatting/statements/flexible new lines/in block lambda.sdstest b/DSL/tests/resources/formatting/statements/flexible new lines/in block lambda.sdstest new file mode 100644 index 000000000..650daa99e --- /dev/null +++ b/DSL/tests/resources/formatting/statements/flexible new lines/in block lambda.sdstest @@ -0,0 +1,20 @@ +pipeline myPipeline { + () { + + val a = 0 ; + + val a , _ , yield b = call() ; + + }; +} + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + () { + + val a = 0; + + val a, _, yield b = call(); + }; +} diff --git a/DSL/tests/resources/formatting/statements/flexible new lines/in pipeline.sdstest b/DSL/tests/resources/formatting/statements/flexible new lines/in pipeline.sdstest new file mode 100644 index 000000000..8b7384544 --- /dev/null +++ b/DSL/tests/resources/formatting/statements/flexible new lines/in pipeline.sdstest @@ -0,0 +1,16 @@ +pipeline myPipeline { + + val a = 0 ; + + val a , _ , yield b = call() ; + + } + +// ----------------------------------------------------------------------------- + +pipeline myPipeline { + + val a = 0; + + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/formatting/statements/flexible new lines/in segment.sdstest b/DSL/tests/resources/formatting/statements/flexible new lines/in segment.sdstest new file mode 100644 index 000000000..76bd75c71 --- /dev/null +++ b/DSL/tests/resources/formatting/statements/flexible new lines/in segment.sdstest @@ -0,0 +1,16 @@ +segment mySegment() { + + val a = 0 ; + + val a , _ , yield b = call() ; + + } + +// ----------------------------------------------------------------------------- + +segment mySegment() { + + val a = 0; + + val a, _, yield b = call(); +} diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (complex).sdstest new file mode 100644 index 000000000..ac01c901b --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (complex).sdstest @@ -0,0 +1,8 @@ +@A(f() , 2 , ) + +// ----------------------------------------------------------------------------- + +@A( + f(), + 2, +) diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (long).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (long).sdstest new file mode 100644 index 000000000..f64182ffa --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (long).sdstest @@ -0,0 +1,10 @@ +@A(1 , 2 , 3 , 4 , ) + +// ----------------------------------------------------------------------------- + +@A( + 1, + 2, + 3, + 4, +) diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest new file mode 100644 index 000000000..073b2004f --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call (unchanged).sdstest @@ -0,0 +1,5 @@ +@A(1, 2,) + +// ----------------------------------------------------------------------------- + +@A(1, 2,) diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of annotation call.sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call.sdstest new file mode 100644 index 000000000..de6693cd4 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of annotation call.sdstest @@ -0,0 +1,5 @@ +@A(1 , 2 , ) + +// ----------------------------------------------------------------------------- + +@A(1, 2,) diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of call (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of call (complex).sdstest new file mode 100644 index 000000000..3e03439ff --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of call (complex).sdstest @@ -0,0 +1,12 @@ +pipeline p { + f(f() , 2 , ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + f(), + 2, + ); +} diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of call (long).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of call (long).sdstest new file mode 100644 index 000000000..dcb67ee49 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of call (long).sdstest @@ -0,0 +1,14 @@ +pipeline p { + f(1 , 2 , 3 , 4 , ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f( + 1, + 2, + 3, + 4, + ); +} diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest new file mode 100644 index 000000000..32c925f9a --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of call (unchanged).sdstest @@ -0,0 +1,9 @@ +pipeline p { + f(1, 2,); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f(1, 2,); +} diff --git a/DSL/tests/resources/formatting/trailing commas/argument list of call.sdstest b/DSL/tests/resources/formatting/trailing commas/argument list of call.sdstest new file mode 100644 index 000000000..c7a0b4059 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/argument list of call.sdstest @@ -0,0 +1,9 @@ +pipeline p { + f(1 , 2 , ); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f(1, 2,); +} diff --git a/DSL/tests/resources/formatting/trailing commas/assignee list of assignment in block lambda.sdstest b/DSL/tests/resources/formatting/trailing commas/assignee list of assignment in block lambda.sdstest new file mode 100644 index 000000000..06d540949 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/assignee list of assignment in block lambda.sdstest @@ -0,0 +1,13 @@ +pipeline p { + () { + val a , val b , = f(); + }; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + () { + val a, val b, = f(); + }; +} diff --git a/DSL/tests/resources/formatting/trailing commas/assignee list of assignment.sdstest b/DSL/tests/resources/formatting/trailing commas/assignee list of assignment.sdstest new file mode 100644 index 000000000..8a96454f5 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/assignee list of assignment.sdstest @@ -0,0 +1,9 @@ +pipeline p { + val a , val b , = f(); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + val a, val b, = f(); +} diff --git a/DSL/tests/resources/formatting/trailing commas/column list of schema.sdstest b/DSL/tests/resources/formatting/trailing commas/column list of schema.sdstest new file mode 100644 index 000000000..a1e22dc97 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/column list of schema.sdstest @@ -0,0 +1,11 @@ +schema MySchemaWithTrailingComma { + "column1" : Int , + "column2" : String , + } + +// ----------------------------------------------------------------------------- + +schema MySchemaWithTrailingComma { + "column1": Int, + "column2": String, +} diff --git a/DSL/tests/resources/formatting/trailing commas/constraint list of annotation.sdstest b/DSL/tests/resources/formatting/trailing commas/constraint list of annotation.sdstest new file mode 100644 index 000000000..688bbadc4 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/constraint list of annotation.sdstest @@ -0,0 +1,11 @@ +annotation A where { + T sub Any , + T super Int , + } + +// ----------------------------------------------------------------------------- + +annotation A where { + T sub Any, + T super Int, +} diff --git a/DSL/tests/resources/formatting/trailing commas/constraint list of class.sdstest b/DSL/tests/resources/formatting/trailing commas/constraint list of class.sdstest new file mode 100644 index 000000000..049700527 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/constraint list of class.sdstest @@ -0,0 +1,11 @@ +class C where { + T sub Any , + T super Int , + } + +// ----------------------------------------------------------------------------- + +class C where { + T sub Any, + T super Int, +} diff --git a/DSL/tests/resources/formatting/trailing commas/constraint list of enum variant.sdstest b/DSL/tests/resources/formatting/trailing commas/constraint list of enum variant.sdstest new file mode 100644 index 000000000..9119d4e3d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/constraint list of enum variant.sdstest @@ -0,0 +1,15 @@ +enum E { + A where { + T sub Any , + T super Int , + } +} + +// ----------------------------------------------------------------------------- + +enum E { + A where { + T sub Any, + T super Int, + } +} diff --git a/DSL/tests/resources/formatting/trailing commas/constraint list of function.sdstest b/DSL/tests/resources/formatting/trailing commas/constraint list of function.sdstest new file mode 100644 index 000000000..59e36e1b7 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/constraint list of function.sdstest @@ -0,0 +1,11 @@ +fun f() where { + T sub Any , + T super Int , + } + +// ----------------------------------------------------------------------------- + +fun f() where { + T sub Any, + T super Int, +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (complex).sdstest new file mode 100644 index 000000000..6dccd04e5 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (complex).sdstest @@ -0,0 +1,8 @@ +annotation A(a: A.B , b: Int , ) + +// ----------------------------------------------------------------------------- + +annotation A( + a: A.B, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (long).sdstest new file mode 100644 index 000000000..ed2c59cb6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (long).sdstest @@ -0,0 +1,10 @@ +annotation A(a: Int , b: Int , c: Int , d: Int , ) + +// ----------------------------------------------------------------------------- + +annotation A( + a: Int, + b: Int, + c: Int, + d: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest new file mode 100644 index 000000000..c1f7357d5 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (unchanged).sdstest @@ -0,0 +1,5 @@ +annotation A(a: Int, b: Int,) + +// ----------------------------------------------------------------------------- + +annotation A(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (with annotation).sdstest new file mode 100644 index 000000000..ecf5740c1 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation (with annotation).sdstest @@ -0,0 +1,9 @@ +annotation A(@Annotation a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +annotation A( + @Annotation + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of annotation.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation.sdstest new file mode 100644 index 000000000..b1a4ece00 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of annotation.sdstest @@ -0,0 +1,5 @@ +annotation A(a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +annotation A(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (complex).sdstest new file mode 100644 index 000000000..6866a86d9 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (complex).sdstest @@ -0,0 +1,12 @@ +pipeline p { + (a: A.B , b: Int , ){}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int, + ) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (long).sdstest new file mode 100644 index 000000000..84eee0439 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (long).sdstest @@ -0,0 +1,14 @@ +pipeline p { + (a: Int , b: Int , c: Int , d: Int , ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: Int, + b: Int, + c: Int, + d: Int, + ) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest new file mode 100644 index 000000000..60c557af2 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (unchanged).sdstest @@ -0,0 +1,9 @@ +pipeline p { + (first, second,) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + (first, second,) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (with annotation).sdstest new file mode 100644 index 000000000..66f19f9ff --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda (with annotation).sdstest @@ -0,0 +1,13 @@ +pipeline p { + (@Annotation a: Int , b: Int , ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + @Annotation + a: Int, + b: Int, + ) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda.sdstest new file mode 100644 index 000000000..bdfa93249 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of block lambda.sdstest @@ -0,0 +1,9 @@ +pipeline p { + (first , second , ) {}; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + (first, second,) {}; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (complex).sdstest new file mode 100644 index 000000000..428c48c1e --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (complex).sdstest @@ -0,0 +1,12 @@ +segment s( + f: (a: A.B , b: Int , ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: A.B, + b: Int, + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (long).sdstest new file mode 100644 index 000000000..334943780 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (long).sdstest @@ -0,0 +1,14 @@ +segment s( + f: (a: Int , b: Int , c: Int , d: Int , ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: Int, + b: Int, + c: Int, + d: Int, + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest new file mode 100644 index 000000000..27e465733 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (unchanged).sdstest @@ -0,0 +1,9 @@ +segment s( + f: (x: Int, y: Int,) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: (x: Int, y: Int,) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (with annotation).sdstest new file mode 100644 index 000000000..68af11066 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type (with annotation).sdstest @@ -0,0 +1,13 @@ +segment s( + f: (@Annotation a: Int , b: Int , ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + @Annotation + a: Int, + b: Int, + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of callable type.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type.sdstest new file mode 100644 index 000000000..d546c2292 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of callable type.sdstest @@ -0,0 +1,9 @@ +segment s( + f: (x: Int , y: Int , ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: (x: Int, y: Int,) -> () +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class (complex).sdstest new file mode 100644 index 000000000..507457eb4 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class (complex).sdstest @@ -0,0 +1,8 @@ +class C(a: A.B , b: Int , ) + +// ----------------------------------------------------------------------------- + +class C( + a: A.B, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class (long).sdstest new file mode 100644 index 000000000..184a9a2ba --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class (long).sdstest @@ -0,0 +1,10 @@ +class C(a: Int , b: Int , c: Int , d: Int , ) + +// ----------------------------------------------------------------------------- + +class C( + a: Int, + b: Int, + c: Int, + d: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest new file mode 100644 index 000000000..e9450d923 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class (unchanged).sdstest @@ -0,0 +1,5 @@ +class C(a: Int, b: Int,) + +// ----------------------------------------------------------------------------- + +class C(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class (with annotation).sdstest new file mode 100644 index 000000000..5bdb796c7 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class (with annotation).sdstest @@ -0,0 +1,9 @@ +class C(@Annotation a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +class C( + @Annotation + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of class.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of class.sdstest new file mode 100644 index 000000000..42908183c --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of class.sdstest @@ -0,0 +1,5 @@ +class C(a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +class C(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (complex).sdstest new file mode 100644 index 000000000..bcae9764a --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (complex).sdstest @@ -0,0 +1,12 @@ +enum E { + A(a: A.B , b: Int , ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: A.B, + b: Int, + ) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (long).sdstest new file mode 100644 index 000000000..b313a9558 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (long).sdstest @@ -0,0 +1,14 @@ +enum E { + A(a: Int , b: Int , c: Int , d: Int , ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + a: Int, + b: Int, + c: Int, + d: Int, + ) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest new file mode 100644 index 000000000..b4e40c6b6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (unchanged).sdstest @@ -0,0 +1,9 @@ +enum E { + A(a: Int, b: Int,) +} + +// ----------------------------------------------------------------------------- + +enum E { + A(a: Int, b: Int,) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (with annotation).sdstest new file mode 100644 index 000000000..58496e85d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant (with annotation).sdstest @@ -0,0 +1,13 @@ +enum E { + A(@Annotation a: Int , b: Int , ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A( + @Annotation + a: Int, + b: Int, + ) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant.sdstest new file mode 100644 index 000000000..c09fd65b9 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of enum variant.sdstest @@ -0,0 +1,9 @@ +enum E { + A(a: Int , b: Int , ) +} + +// ----------------------------------------------------------------------------- + +enum E { + A(a: Int, b: Int,) +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (complex).sdstest new file mode 100644 index 000000000..7c7a05e8b --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (complex).sdstest @@ -0,0 +1,12 @@ +pipeline p { + (a: A.B , b: Int , ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: A.B, + b: Int, + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (long).sdstest new file mode 100644 index 000000000..9eb0b6977 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (long).sdstest @@ -0,0 +1,14 @@ +pipeline p { + (a: Int , b: Int , c: Int , d: Int , ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + a: Int, + b: Int, + c: Int, + d: Int, + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest new file mode 100644 index 000000000..9a9cc4825 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (unchanged).sdstest @@ -0,0 +1,9 @@ +pipeline p { + (first, second,) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + (first, second,) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (with annotation).sdstest new file mode 100644 index 000000000..c296f492a --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda (with annotation).sdstest @@ -0,0 +1,13 @@ +pipeline p { + (@Annotation a: Int , b: Int , ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + ( + @Annotation + a: Int, + b: Int, + ) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda.sdstest new file mode 100644 index 000000000..a6d19261e --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of expression lambda.sdstest @@ -0,0 +1,9 @@ +pipeline p { + (first , second , ) -> 1; +} + +// ----------------------------------------------------------------------------- + +pipeline p { + (first, second,) -> 1; +} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function (complex).sdstest new file mode 100644 index 000000000..86dc4df2d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function (complex).sdstest @@ -0,0 +1,8 @@ +fun f(a: A.B , b: Int , ) + +// ----------------------------------------------------------------------------- + +fun f( + a: A.B, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function (long).sdstest new file mode 100644 index 000000000..c51b2d7c0 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function (long).sdstest @@ -0,0 +1,10 @@ +fun f(a: Int , b: Int , c: Int , d: Int , ) + +// ----------------------------------------------------------------------------- + +fun f( + a: Int, + b: Int, + c: Int, + d: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest new file mode 100644 index 000000000..094ebfb17 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function (unchanged).sdstest @@ -0,0 +1,5 @@ +fun f(a: Int, b: Int,) + +// ----------------------------------------------------------------------------- + +fun f(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function (with annotation).sdstest new file mode 100644 index 000000000..e5711472f --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function (with annotation).sdstest @@ -0,0 +1,9 @@ +fun f(@Annotation a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +fun f( + @Annotation + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of function.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of function.sdstest new file mode 100644 index 000000000..be4f8e33f --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of function.sdstest @@ -0,0 +1,5 @@ +fun f(a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +fun f(a: Int, b: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (complex).sdstest new file mode 100644 index 000000000..c17890192 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (complex).sdstest @@ -0,0 +1,8 @@ +segment s(a: A.B , b: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: A.B, + b: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment (long).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (long).sdstest new file mode 100644 index 000000000..49407f811 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (long).sdstest @@ -0,0 +1,10 @@ +segment s(a: Int , b: Int , c: Int , d: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s( + a: Int, + b: Int, + c: Int, + d: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest new file mode 100644 index 000000000..50846c18c --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (unchanged).sdstest @@ -0,0 +1,5 @@ +segment s(a: Int, b: Int,) {} + +// ----------------------------------------------------------------------------- + +segment s(a: Int, b: Int,) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (with annotation).sdstest new file mode 100644 index 000000000..562e88312 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment (with annotation).sdstest @@ -0,0 +1,9 @@ +segment s(@Annotation a: Int , b: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s( + @Annotation + a: Int, + b: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parameter list of segment.sdstest b/DSL/tests/resources/formatting/trailing commas/parameter list of segment.sdstest new file mode 100644 index 000000000..d54279f27 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parameter list of segment.sdstest @@ -0,0 +1,5 @@ +segment s(a: Int , b: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s(a: Int, b: Int,) {} diff --git a/DSL/tests/resources/formatting/trailing commas/parent type list of class.sdstest b/DSL/tests/resources/formatting/trailing commas/parent type list of class.sdstest new file mode 100644 index 000000000..548bce999 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/parent type list of class.sdstest @@ -0,0 +1,5 @@ +class C sub D , E , {} + +// ----------------------------------------------------------------------------- + +class C sub D, E, {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type (complex).sdstest new file mode 100644 index 000000000..bf97ef7d4 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type (complex).sdstest @@ -0,0 +1,12 @@ +segment s( + f: () -> (x: A.B , y: Int , ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: A.B, + y: Int, + ) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type (long).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type (long).sdstest new file mode 100644 index 000000000..5d6ac81a9 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type (long).sdstest @@ -0,0 +1,14 @@ +segment s( + f: () -> (x: Int , y: Int , a: Int , b: Int , ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: Int, + y: Int, + a: Int, + b: Int, + ) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest new file mode 100644 index 000000000..529a56f3b --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type (unchanged).sdstest @@ -0,0 +1,9 @@ +segment s( + f: () -> (x: Int, y: Int,) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> (x: Int, y: Int,) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type (with annotation).sdstest new file mode 100644 index 000000000..ce274a107 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type (with annotation).sdstest @@ -0,0 +1,13 @@ +segment s( + f: () -> (@Annotation x: Int , y: Int , ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + @Annotation + x: Int, + y: Int, + ) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of callable type.sdstest b/DSL/tests/resources/formatting/trailing commas/result list of callable type.sdstest new file mode 100644 index 000000000..c0f2822e2 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of callable type.sdstest @@ -0,0 +1,9 @@ +segment s( + f: () -> (x: Int , y: Int , ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> (x: Int, y: Int,) +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function (complex).sdstest new file mode 100644 index 000000000..e3df3a4a6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function (complex).sdstest @@ -0,0 +1,8 @@ +fun f() -> (x: A.B , y: Int , ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: A.B, + y: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function (long).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function (long).sdstest new file mode 100644 index 000000000..aad0f52a1 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function (long).sdstest @@ -0,0 +1,10 @@ +fun f() -> (x: Int , y: Int , a: Int , b: Int , ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + x: Int, + y: Int, + a: Int, + b: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest new file mode 100644 index 000000000..919b400d6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function (unchanged).sdstest @@ -0,0 +1,5 @@ +fun f() -> (first: Int, second: Int,) + +// ----------------------------------------------------------------------------- + +fun f() -> (first: Int, second: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function (with annotation).sdstest new file mode 100644 index 000000000..a7922ce4a --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function (with annotation).sdstest @@ -0,0 +1,9 @@ +fun f() -> (@Annotation x: Int , y: Int , ) + +// ----------------------------------------------------------------------------- + +fun f() -> ( + @Annotation + x: Int, + y: Int, +) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of function.sdstest b/DSL/tests/resources/formatting/trailing commas/result list of function.sdstest new file mode 100644 index 000000000..4f38d6dcb --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of function.sdstest @@ -0,0 +1,5 @@ +fun f() -> (first: Int , second: Int , ) + +// ----------------------------------------------------------------------------- + +fun f() -> (first: Int, second: Int,) diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment (complex).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment (complex).sdstest new file mode 100644 index 000000000..b0d72246c --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment (complex).sdstest @@ -0,0 +1,8 @@ +segment s() -> (x: A.B , y: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: A.B, + y: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment (long).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment (long).sdstest new file mode 100644 index 000000000..4ff55165c --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment (long).sdstest @@ -0,0 +1,10 @@ +segment s() -> (x: Int , y: Int , a: Int , b: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + x: Int, + y: Int, + a: Int, + b: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest new file mode 100644 index 000000000..42646bfc2 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment (unchanged).sdstest @@ -0,0 +1,5 @@ +segment s() -> (first: Int, second: Int,) {} + +// ----------------------------------------------------------------------------- + +segment s() -> (first: Int, second: Int,) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment (with annotation).sdstest new file mode 100644 index 000000000..e35e5c8f0 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment (with annotation).sdstest @@ -0,0 +1,9 @@ +segment s() -> (@Annotation x: Int , y: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> ( + @Annotation + x: Int, + y: Int, +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/result list of segment.sdstest b/DSL/tests/resources/formatting/trailing commas/result list of segment.sdstest new file mode 100644 index 000000000..2f92b8c23 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/result list of segment.sdstest @@ -0,0 +1,5 @@ +segment s() -> (first: Int , second: Int , ) {} + +// ----------------------------------------------------------------------------- + +segment s() -> (first: Int, second: Int,) {} diff --git a/DSL/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest new file mode 100644 index 000000000..ede5ed5e2 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type argument list of call (unchanged).sdstest @@ -0,0 +1,9 @@ +pipeline p { + f(); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f(); +} diff --git a/DSL/tests/resources/formatting/trailing commas/type argument list of call.sdstest b/DSL/tests/resources/formatting/trailing commas/type argument list of call.sdstest new file mode 100644 index 000000000..1364593ec --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type argument list of call.sdstest @@ -0,0 +1,9 @@ +pipeline p { + f(); +} + +// ----------------------------------------------------------------------------- + +pipeline p { + f(); +} diff --git a/DSL/tests/resources/formatting/trailing commas/type argument list of named type.sdstest b/DSL/tests/resources/formatting/trailing commas/type argument list of named type.sdstest new file mode 100644 index 000000000..bb34ddc33 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type argument list of named type.sdstest @@ -0,0 +1,9 @@ +segment s( + f: Type +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: Type +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/type argument list of union type.sdstest b/DSL/tests/resources/formatting/trailing commas/type argument list of union type.sdstest new file mode 100644 index 000000000..75b5f27c3 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type argument list of union type.sdstest @@ -0,0 +1,9 @@ +segment s( + f: union +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: union +) {} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of class (long).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (long).sdstest new file mode 100644 index 000000000..0de4c7272 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (long).sdstest @@ -0,0 +1,10 @@ +class C + +// ----------------------------------------------------------------------------- + +class C< + K, + V, + X, + Y, +> diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest new file mode 100644 index 000000000..ef0e962a3 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (unchanged).sdstest @@ -0,0 +1,5 @@ +class C + +// ----------------------------------------------------------------------------- + +class C diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of class (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (with annotation).sdstest new file mode 100644 index 000000000..44e9b2db1 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of class (with annotation).sdstest @@ -0,0 +1,9 @@ +class C<@Annotation K , V , > + +// ----------------------------------------------------------------------------- + +class C< + @Annotation + K, + V, +> diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of class.sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of class.sdstest new file mode 100644 index 000000000..a82487c6d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of class.sdstest @@ -0,0 +1,5 @@ +class C + +// ----------------------------------------------------------------------------- + +class C diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (long).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (long).sdstest new file mode 100644 index 000000000..88a49c0c9 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (long).sdstest @@ -0,0 +1,14 @@ +enum E { + A +} + +// ----------------------------------------------------------------------------- + +enum E { + A< + K, + V, + X, + Y, + > +} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest new file mode 100644 index 000000000..46d78026d --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (unchanged).sdstest @@ -0,0 +1,9 @@ +enum E { + A +} + +// ----------------------------------------------------------------------------- + +enum E { + A +} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (with annotation).sdstest new file mode 100644 index 000000000..77c7ebe73 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant (with annotation).sdstest @@ -0,0 +1,13 @@ +enum E { + A<@Annotation K , V , > +} + +// ----------------------------------------------------------------------------- + +enum E { + A< + @Annotation + K, + V, + > +} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant.sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant.sdstest new file mode 100644 index 000000000..0b83fbb40 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of enum variant.sdstest @@ -0,0 +1,9 @@ +enum E { + A +} + +// ----------------------------------------------------------------------------- + +enum E { + A +} diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of function (long).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (long).sdstest new file mode 100644 index 000000000..019809b1b --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (long).sdstest @@ -0,0 +1,10 @@ +fun f() + +// ----------------------------------------------------------------------------- + +fun f< + K, + V, + X, + Y, +>() diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest new file mode 100644 index 000000000..58cc04190 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (unchanged).sdstest @@ -0,0 +1,5 @@ +fun f() + +// ----------------------------------------------------------------------------- + +fun f() diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of function (with annotation).sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (with annotation).sdstest new file mode 100644 index 000000000..83d95a2d6 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of function (with annotation).sdstest @@ -0,0 +1,9 @@ +fun f<@Annotation K , V , >() + +// ----------------------------------------------------------------------------- + +fun f< + @Annotation + K, + V, +>() diff --git a/DSL/tests/resources/formatting/trailing commas/type parameter list of function.sdstest b/DSL/tests/resources/formatting/trailing commas/type parameter list of function.sdstest new file mode 100644 index 000000000..1120f5121 --- /dev/null +++ b/DSL/tests/resources/formatting/trailing commas/type parameter list of function.sdstest @@ -0,0 +1,5 @@ +fun f() + +// ----------------------------------------------------------------------------- + +fun f() diff --git a/DSL/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest b/DSL/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest new file mode 100644 index 000000000..b6762571b --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with complex parameter list (unchanged).sdstest @@ -0,0 +1,16 @@ +segment s( + f: ( + a: A.B, + b: Int + ) -> () +) {} + + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: A.B, + b: Int + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with complex parameter list.sdstest b/DSL/tests/resources/formatting/types/callable types/with complex parameter list.sdstest new file mode 100644 index 000000000..6d03adefb --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with complex parameter list.sdstest @@ -0,0 +1,12 @@ +segment s( + f: ( a: A.B , b: Int ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: A.B, + b: Int + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest b/DSL/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest new file mode 100644 index 000000000..a3965cf66 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with complex result list (unchanged).sdstest @@ -0,0 +1,15 @@ +segment s( + f: () -> ( + x: A.B, + y: Int + ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: A.B, + y: Int + ) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with complex result list.sdstest b/DSL/tests/resources/formatting/types/callable types/with complex result list.sdstest new file mode 100644 index 000000000..8622e3b1d --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with complex result list.sdstest @@ -0,0 +1,12 @@ +segment s( + f: () -> ( x: A.B , y: Int ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: A.B, + y: Int + ) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with long parameter list.sdstest b/DSL/tests/resources/formatting/types/callable types/with long parameter list.sdstest new file mode 100644 index 000000000..0494c077b --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with long parameter list.sdstest @@ -0,0 +1,14 @@ +segment s( + f: ( a: Int , b: Int , c: Int , d: Int ) -> () +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: ( + a: Int, + b: Int, + c: Int, + d: Int + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with long result list.sdstest b/DSL/tests/resources/formatting/types/callable types/with long result list.sdstest new file mode 100644 index 000000000..742b41b13 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with long result list.sdstest @@ -0,0 +1,14 @@ +segment s( + f: () -> ( x: Int , y: Int , a: Int , b: Int ) +) {} + +// ----------------------------------------------------------------------------- + +segment s( + f: () -> ( + x: Int, + y: Int, + a: Int, + b: Int + ) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with multiple parameters.sdstest b/DSL/tests/resources/formatting/types/callable types/with multiple parameters.sdstest new file mode 100644 index 000000000..e48bda244 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with multiple parameters.sdstest @@ -0,0 +1,37 @@ +segment mySegment( + f: ( + + @Annotation a , + + b = 0 , + + vararg c , + + vararg d : Int = 1 , + + e : Int , + + f : Int = 2 , + + vararg g : Int , + + vararg h : Int = 3 + + ) -> ( ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: ( + @Annotation + a, + b = 0, + vararg c, + vararg d: Int = 1, + e: Int, + f: Int = 2, + vararg g: Int, + vararg h: Int = 3 + ) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with multiple results.sdstest b/DSL/tests/resources/formatting/types/callable types/with multiple results.sdstest new file mode 100644 index 000000000..4d3d9d323 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with multiple results.sdstest @@ -0,0 +1,20 @@ +segment mySegment( + f: ( ) -> ( + @Annotation a , + b , + c : Int , + d : Int + ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> ( + @Annotation + a, + b, + c: Int, + d: Int + ) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one typed parameter.sdstest b/DSL/tests/resources/formatting/types/callable types/with one typed parameter.sdstest new file mode 100644 index 000000000..b6bd6dfea --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one typed parameter.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( param : Int ) -> ( ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: (param: Int) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one typed result (in parentheses).sdstest b/DSL/tests/resources/formatting/types/callable types/with one typed result (in parentheses).sdstest new file mode 100644 index 000000000..90b959f5c --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one typed result (in parentheses).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> ( result : Int ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> (result: Int) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one typed result (no parentheses).sdstest b/DSL/tests/resources/formatting/types/callable types/with one typed result (no parentheses).sdstest new file mode 100644 index 000000000..4ed503955 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one typed result (no parentheses).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> result : Int +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> result: Int +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one untyped parameter.sdstest b/DSL/tests/resources/formatting/types/callable types/with one untyped parameter.sdstest new file mode 100644 index 000000000..9694b039d --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one untyped parameter.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( param ) -> ( ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: (param) -> () +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one untyped result (in parentheses).sdstest b/DSL/tests/resources/formatting/types/callable types/with one untyped result (in parentheses).sdstest new file mode 100644 index 000000000..e70161c60 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one untyped result (in parentheses).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> ( result ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> (result) +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/with one untyped result (no parentheses).sdstest b/DSL/tests/resources/formatting/types/callable types/with one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..a0341b6c6 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/with one untyped result (no parentheses).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> result +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> result +) {} diff --git a/DSL/tests/resources/formatting/types/callable types/without parameters or results.sdstest b/DSL/tests/resources/formatting/types/callable types/without parameters or results.sdstest new file mode 100644 index 000000000..cf40016d6 --- /dev/null +++ b/DSL/tests/resources/formatting/types/callable types/without parameters or results.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + f: ( ) -> ( ) +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + f: () -> () +) {} diff --git a/DSL/tests/resources/formatting/types/member types/long complex chain.sdstest b/DSL/tests/resources/formatting/types/member types/long complex chain.sdstest new file mode 100644 index 000000000..755bcf1df --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/long complex chain.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < > . MiddleClass < C , D > ? . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union<>.MiddleClass?.InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (not nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (not nullable).sdstest new file mode 100644 index 000000000..cabc86476 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (not nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: ( ) -> ( ) . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: () -> ().InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (nullable).sdstest new file mode 100644 index 000000000..ee3526f1c --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (callable) and member (nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: ( ) -> ( ) . InnerClass ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: () -> ().InnerClass? +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (not nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (not nullable).sdstest new file mode 100644 index 000000000..0533da552 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (not nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: OuterClass . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: OuterClass.InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (nullable).sdstest new file mode 100644 index 000000000..c5bcfcda7 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (named, not nullable) and member (nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: OuterClass . InnerClass ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: OuterClass.InnerClass? +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (not nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (not nullable).sdstest new file mode 100644 index 000000000..d00fe49e5 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (not nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: OuterClass ? . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: OuterClass?.InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (nullable).sdstest new file mode 100644 index 000000000..c5bcfcda7 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (named, nullable) and member (nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: OuterClass . InnerClass ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: OuterClass.InnerClass? +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (union) and member (not nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (union) and member (not nullable).sdstest new file mode 100644 index 000000000..8d71c4f5f --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (union) and member (not nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < > . InnerClass +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union<>.InnerClass +) {} diff --git a/DSL/tests/resources/formatting/types/member types/receiver (union) and member (nullable).sdstest b/DSL/tests/resources/formatting/types/member types/receiver (union) and member (nullable).sdstest new file mode 100644 index 000000000..9c91c4b40 --- /dev/null +++ b/DSL/tests/resources/formatting/types/member types/receiver (union) and member (nullable).sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < > . InnerClass ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union<>.InnerClass? +) {} diff --git a/DSL/tests/resources/formatting/types/named types/no type arguments and not nullable.sdstest b/DSL/tests/resources/formatting/types/named types/no type arguments and not nullable.sdstest new file mode 100644 index 000000000..b67a6f346 --- /dev/null +++ b/DSL/tests/resources/formatting/types/named types/no type arguments and not nullable.sdstest @@ -0,0 +1,5 @@ +segment mySegment(x: Int) {} + +// ----------------------------------------------------------------------------- + +segment mySegment(x: Int) {} diff --git a/DSL/tests/resources/formatting/types/named types/no type arguments and nullable.sdstest b/DSL/tests/resources/formatting/types/named types/no type arguments and nullable.sdstest new file mode 100644 index 000000000..aeb316775 --- /dev/null +++ b/DSL/tests/resources/formatting/types/named types/no type arguments and nullable.sdstest @@ -0,0 +1,5 @@ +segment mySegment(x: Int ?) {} + +// ----------------------------------------------------------------------------- + +segment mySegment(x: Int?) {} diff --git a/DSL/tests/resources/formatting/types/named types/type argument and nullable.sdstest b/DSL/tests/resources/formatting/types/named types/type argument and nullable.sdstest new file mode 100644 index 000000000..306c15d72 --- /dev/null +++ b/DSL/tests/resources/formatting/types/named types/type argument and nullable.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: Int < * , in Number , out Number , T = Number > ? +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: Int<*, in Number, out Number, T = Number>? +) {} diff --git a/DSL/tests/resources/formatting/types/named types/type arguments and not nullable.sdstest b/DSL/tests/resources/formatting/types/named types/type arguments and not nullable.sdstest new file mode 100644 index 000000000..93adc76b3 --- /dev/null +++ b/DSL/tests/resources/formatting/types/named types/type arguments and not nullable.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: Int < * , in Number , out Number , T = Number> +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: Int<*, in Number, out Number, T = Number> +) {} diff --git a/DSL/tests/resources/formatting/types/union types/empty.sdstest b/DSL/tests/resources/formatting/types/union types/empty.sdstest new file mode 100644 index 000000000..c8bdf7bb3 --- /dev/null +++ b/DSL/tests/resources/formatting/types/union types/empty.sdstest @@ -0,0 +1,5 @@ +segment mySegment(x: union < >) {} + +// ----------------------------------------------------------------------------- + +segment mySegment(x: union<>) {} diff --git a/DSL/tests/resources/formatting/types/union types/nested.sdstest b/DSL/tests/resources/formatting/types/union types/nested.sdstest new file mode 100644 index 000000000..850c44b69 --- /dev/null +++ b/DSL/tests/resources/formatting/types/union types/nested.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < union < > > +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union> +) {} diff --git a/DSL/tests/resources/formatting/types/union types/with type arguments.sdstest b/DSL/tests/resources/formatting/types/union types/with type arguments.sdstest new file mode 100644 index 000000000..d9a68fa6e --- /dev/null +++ b/DSL/tests/resources/formatting/types/union types/with type arguments.sdstest @@ -0,0 +1,9 @@ +segment mySegment( + x: union < Int , String > +) {} + +// ----------------------------------------------------------------------------- + +segment mySegment( + x: union +) {} diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/bad-unclosed argument list.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/bad-unclosed argument list.sdstest index 2e72e475f..8e537c4ca 100644 --- a/DSL/tests/resources/grammar/declarations/annotation calls/bad-unclosed argument list.sdstest +++ b/DSL/tests/resources/grammar/declarations/annotation calls/bad-unclosed argument list.sdstest @@ -1,4 +1,3 @@ // $TEST$ syntax_error @Annotation( -class MyClass diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-empty argument list.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-empty argument list.sdstest index 32a125ad9..af0cf4067 100644 --- a/DSL/tests/resources/grammar/declarations/annotation calls/good-empty argument list.sdstest +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-empty argument list.sdstest @@ -1,4 +1,3 @@ // $TEST$ no_syntax_error @Annotation() -class MyClass diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-multiple arguments.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-multiple arguments.sdstest index b7391f53f..7c510cf61 100644 --- a/DSL/tests/resources/grammar/declarations/annotation calls/good-multiple arguments.sdstest +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-multiple arguments.sdstest @@ -1,4 +1,3 @@ // $TEST$ no_syntax_error @Annotation(1, a = 2) -class MyClass diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-named argument.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-named argument.sdstest index 4ddff2870..ba1993365 100644 --- a/DSL/tests/resources/grammar/declarations/annotation calls/good-named argument.sdstest +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-named argument.sdstest @@ -1,4 +1,3 @@ // $TEST$ no_syntax_error @Annotation(b = 2) -class MyClass diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-no argument list.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-no argument list.sdstest index 1b54f3ab5..b0f0c5981 100644 --- a/DSL/tests/resources/grammar/declarations/annotation calls/good-no argument list.sdstest +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-no argument list.sdstest @@ -1,4 +1,3 @@ // $TEST$ no_syntax_error @Annotation -class MyClass diff --git a/DSL/tests/resources/grammar/declarations/annotation calls/good-positional argument.sdstest b/DSL/tests/resources/grammar/declarations/annotation calls/good-positional argument.sdstest index e9dfcdb5e..319c6983c 100644 --- a/DSL/tests/resources/grammar/declarations/annotation calls/good-positional argument.sdstest +++ b/DSL/tests/resources/grammar/declarations/annotation calls/good-positional argument.sdstest @@ -1,4 +1,3 @@ // $TEST$ no_syntax_error @Annotation(1) -class MyClass diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-annotation call.sdstest index 47a6c6955..d867f6cbf 100644 --- a/DSL/tests/resources/grammar/declarations/annotations/good-annotation call.sdstest +++ b/DSL/tests/resources/grammar/declarations/annotations/good-annotation call.sdstest @@ -1,4 +1,6 @@ // $TEST$ no_syntax_error +package test + @Annotation annotation MyAnnotation diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with sub constraint.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with sub constraint.sdstest index 069228496..a58135efb 100644 --- a/DSL/tests/resources/grammar/declarations/annotations/good-with sub constraint.sdstest +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with sub constraint.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -annotation MyAnnotation() where { +annotation MyAnnotation where { T sub Number } diff --git a/DSL/tests/resources/grammar/declarations/annotations/good-with super constraint.sdstest b/DSL/tests/resources/grammar/declarations/annotations/good-with super constraint.sdstest index 7ab1f6aea..cc9f5c23d 100644 --- a/DSL/tests/resources/grammar/declarations/annotations/good-with super constraint.sdstest +++ b/DSL/tests/resources/grammar/declarations/annotations/good-with super constraint.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -annotation MyAnnotation() where { +annotation MyAnnotation where { T super Number } diff --git a/DSL/tests/resources/grammar/declarations/classes/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/classes/good-annotation call.sdstest index 1b54f3ab5..c86c9b5b8 100644 --- a/DSL/tests/resources/grammar/declarations/classes/good-annotation call.sdstest +++ b/DSL/tests/resources/grammar/declarations/classes/good-annotation call.sdstest @@ -1,4 +1,6 @@ // $TEST$ no_syntax_error +package test + @Annotation class MyClass diff --git a/DSL/tests/resources/grammar/declarations/enums/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/enums/good-annotation call.sdstest index 4be876772..f4e602fe5 100644 --- a/DSL/tests/resources/grammar/declarations/enums/good-annotation call.sdstest +++ b/DSL/tests/resources/grammar/declarations/enums/good-annotation call.sdstest @@ -1,4 +1,6 @@ // $TEST$ no_syntax_error +package test + @Annotation enum MyEnum diff --git a/DSL/tests/resources/grammar/declarations/functions/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/functions/good-annotation call.sdstest index 2a4d67f0c..1fcd9ca3f 100644 --- a/DSL/tests/resources/grammar/declarations/functions/good-annotation call.sdstest +++ b/DSL/tests/resources/grammar/declarations/functions/good-annotation call.sdstest @@ -1,4 +1,6 @@ // $TEST$ no_syntax_error +package test + @Annotation fun myFunction() diff --git a/DSL/tests/resources/grammar/declarations/pipelines/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/pipelines/good-annotation call.sdstest index 4e0e63fb6..b6c69990a 100644 --- a/DSL/tests/resources/grammar/declarations/pipelines/good-annotation call.sdstest +++ b/DSL/tests/resources/grammar/declarations/pipelines/good-annotation call.sdstest @@ -1,4 +1,6 @@ // $TEST$ no_syntax_error +package test + @Annotation pipeline myPipeline {} diff --git a/DSL/tests/resources/grammar/declarations/steps/bad-missing parameter list.sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-missing body.sdstest similarity index 54% rename from DSL/tests/resources/grammar/declarations/steps/bad-missing parameter list.sdstest rename to DSL/tests/resources/grammar/declarations/segments/bad-missing body.sdstest index 2f821f3f3..e37a29d51 100644 --- a/DSL/tests/resources/grammar/declarations/steps/bad-missing parameter list.sdstest +++ b/DSL/tests/resources/grammar/declarations/segments/bad-missing body.sdstest @@ -1,3 +1,3 @@ // $TEST$ syntax_error -step myStep {} +segment mySegment() diff --git a/DSL/tests/resources/grammar/declarations/steps/bad-unclosed body.sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-missing parameter list.sdstest similarity index 53% rename from DSL/tests/resources/grammar/declarations/steps/bad-unclosed body.sdstest rename to DSL/tests/resources/grammar/declarations/segments/bad-missing parameter list.sdstest index 1f1003d27..c10c4ad18 100644 --- a/DSL/tests/resources/grammar/declarations/steps/bad-unclosed body.sdstest +++ b/DSL/tests/resources/grammar/declarations/segments/bad-missing parameter list.sdstest @@ -1,3 +1,3 @@ // $TEST$ syntax_error -step myStep() { +segment mySegment {} diff --git a/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (internal, private).sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (internal, private).sdstest new file mode 100644 index 000000000..27047c8d9 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (internal, private).sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +internal private segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (private, internal).sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (private, internal).sdstest new file mode 100644 index 000000000..797a58dcb --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/bad-two visibilities (private, internal).sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +private internal segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/bad-unclosed body.sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-unclosed body.sdstest new file mode 100644 index 000000000..1ba29b8f7 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/bad-unclosed body.sdstest @@ -0,0 +1,3 @@ +// $TEST$ syntax_error + +segment mySegment() { diff --git a/DSL/tests/resources/grammar/declarations/steps/bad-unclosed parameter list.sdstest b/DSL/tests/resources/grammar/declarations/segments/bad-unclosed parameter list.sdstest similarity index 52% rename from DSL/tests/resources/grammar/declarations/steps/bad-unclosed parameter list.sdstest rename to DSL/tests/resources/grammar/declarations/segments/bad-unclosed parameter list.sdstest index b47930ba1..4312edd16 100644 --- a/DSL/tests/resources/grammar/declarations/steps/bad-unclosed parameter list.sdstest +++ b/DSL/tests/resources/grammar/declarations/segments/bad-unclosed parameter list.sdstest @@ -1,3 +1,3 @@ // $TEST$ syntax_error -step myStep( {} +segment mySegment( {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-annotation call.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-annotation call.sdstest new file mode 100644 index 000000000..9d5ef9094 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-annotation call.sdstest @@ -0,0 +1,6 @@ +// $TEST$ no_syntax_error + +package test + +@Annotation +segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-internal segment.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-internal segment.sdstest new file mode 100644 index 000000000..974c3aa4a --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-internal segment.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +internal segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-multiple parameters.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest similarity index 89% rename from DSL/tests/resources/grammar/declarations/steps/good-multiple parameters.sdstest rename to DSL/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest index 2b310ba7f..0b6c721ad 100644 --- a/DSL/tests/resources/grammar/declarations/steps/good-multiple parameters.sdstest +++ b/DSL/tests/resources/grammar/declarations/segments/good-multiple parameters.sdstest @@ -1,6 +1,6 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( @Annotation a, b = 0, vararg c, diff --git a/DSL/tests/resources/grammar/declarations/steps/good-multiple results.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-multiple results.sdstest similarity index 76% rename from DSL/tests/resources/grammar/declarations/steps/good-multiple results.sdstest rename to DSL/tests/resources/grammar/declarations/segments/good-multiple results.sdstest index 602cf818c..e2979aa68 100644 --- a/DSL/tests/resources/grammar/declarations/steps/good-multiple results.sdstest +++ b/DSL/tests/resources/grammar/declarations/segments/good-multiple results.sdstest @@ -1,6 +1,6 @@ // $TEST$ no_syntax_error -step myStep() -> ( +segment mySegment() -> ( @Annotation a, b, c: Int, diff --git a/DSL/tests/resources/grammar/declarations/steps/good-no parameters and no results and empty body.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-no parameters and no results and empty body.sdstest similarity index 54% rename from DSL/tests/resources/grammar/declarations/steps/good-no parameters and no results and empty body.sdstest rename to DSL/tests/resources/grammar/declarations/segments/good-no parameters and no results and empty body.sdstest index 94b676d6f..538c2b170 100644 --- a/DSL/tests/resources/grammar/declarations/steps/good-no parameters and no results and empty body.sdstest +++ b/DSL/tests/resources/grammar/declarations/segments/good-no parameters and no results and empty body.sdstest @@ -1,3 +1,3 @@ // $TEST$ no_syntax_error -step myStep() {} +segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-no results (explicit).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-no results (explicit).sdstest new file mode 100644 index 000000000..8a30512c0 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-no results (explicit).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> () {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-one typed result (in parentheses).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-one typed result (in parentheses).sdstest new file mode 100644 index 000000000..9a3802129 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-one typed result (in parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> (a: Int) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-one typed result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-one typed result (no parentheses).sdstest new file mode 100644 index 000000000..13940ca85 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-one typed result (no parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> a: Int {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (no parentheses).sdstest new file mode 100644 index 000000000..f001e7a30 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (no parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> a {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (with parentheses).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (with parentheses).sdstest new file mode 100644 index 000000000..dfc4ac345 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-one untyped result (with parentheses).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment() -> (a) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-private segment.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-private segment.sdstest new file mode 100644 index 000000000..de021652e --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-private segment.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +private segment mySegment() {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-statements in body.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-statements in body.sdstest similarity index 58% rename from DSL/tests/resources/grammar/declarations/steps/good-statements in body.sdstest rename to DSL/tests/resources/grammar/declarations/segments/good-statements in body.sdstest index fe4b455e4..0fcc81aad 100644 --- a/DSL/tests/resources/grammar/declarations/steps/good-statements in body.sdstest +++ b/DSL/tests/resources/grammar/declarations/segments/good-statements in body.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -private step myComplexStep() { +private segment mySegment() { val a = 1; } diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with typed optional parameter.sdstest new file mode 100644 index 000000000..bf2f1eaf9 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with typed optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(a: Int = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with typed required parameter.sdstest new file mode 100644 index 000000000..a8712ae07 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with typed required parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(a: Int) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest new file mode 100644 index 000000000..4402e600f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(vararg a: Int = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest new file mode 100644 index 000000000..2b844d017 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with typed variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(vararg a: Int) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with untyped optional parameter.sdstest new file mode 100644 index 000000000..43ce98ee4 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with untyped optional parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(a = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-with untyped required parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with untyped required parameter.sdstest similarity index 52% rename from DSL/tests/resources/grammar/declarations/steps/good-with untyped required parameter.sdstest rename to DSL/tests/resources/grammar/declarations/segments/good-with untyped required parameter.sdstest index bbac35831..b7218414e 100644 --- a/DSL/tests/resources/grammar/declarations/steps/good-with untyped required parameter.sdstest +++ b/DSL/tests/resources/grammar/declarations/segments/good-with untyped required parameter.sdstest @@ -1,3 +1,3 @@ // $TEST$ no_syntax_error -step myStep(a) {} +segment mySegment(a) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest new file mode 100644 index 000000000..d784ac69f --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter (with default value).sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(vararg a = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest new file mode 100644 index 000000000..024349109 --- /dev/null +++ b/DSL/tests/resources/grammar/declarations/segments/good-with untyped variadic parameter.sdstest @@ -0,0 +1,3 @@ +// $TEST$ no_syntax_error + +segment mySegment(vararg a) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest b/DSL/tests/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest deleted file mode 100644 index 490eefca7..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/bad-two visibilities (internal, private).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -internal private step myStep() {} diff --git a/DSL/tests/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest b/DSL/tests/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest deleted file mode 100644 index 10d20514c..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/bad-two visibilities (private, internal).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -private internal step myStep() {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-internal step.sdstest b/DSL/tests/resources/grammar/declarations/steps/good-internal step.sdstest deleted file mode 100644 index 39c9b9699..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-internal step.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -internal step myStep() {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-no results (explicit).sdstest b/DSL/tests/resources/grammar/declarations/steps/good-no results (explicit).sdstest deleted file mode 100644 index ed1d9bf40..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-no results (explicit).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep() -> () {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-one typed result (in parentheses).sdstest b/DSL/tests/resources/grammar/declarations/steps/good-one typed result (in parentheses).sdstest deleted file mode 100644 index 37bbacb4f..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-one typed result (in parentheses).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep() -> (a: Int) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-one typed result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/steps/good-one typed result (no parentheses).sdstest deleted file mode 100644 index 8ff7019d1..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-one typed result (no parentheses).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep() -> a: Int {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-one untyped result (no parentheses).sdstest b/DSL/tests/resources/grammar/declarations/steps/good-one untyped result (no parentheses).sdstest deleted file mode 100644 index 67d6d5810..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-one untyped result (no parentheses).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep() -> a {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-one untyped result (with parentheses).sdstest b/DSL/tests/resources/grammar/declarations/steps/good-one untyped result (with parentheses).sdstest deleted file mode 100644 index 06e788102..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-one untyped result (with parentheses).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep() -> (a) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-private step.sdstest b/DSL/tests/resources/grammar/declarations/steps/good-private step.sdstest deleted file mode 100644 index c8150c488..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-private step.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -private step myStep() {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-with typed optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/steps/good-with typed optional parameter.sdstest deleted file mode 100644 index 0c6d181ac..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-with typed optional parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep(a: Int = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-with typed required parameter.sdstest b/DSL/tests/resources/grammar/declarations/steps/good-with typed required parameter.sdstest deleted file mode 100644 index 6ce90ba3d..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-with typed required parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep(a: Int) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-with typed variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/steps/good-with typed variadic parameter (with default value).sdstest deleted file mode 100644 index 7b2e2a9cd..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-with typed variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep(vararg a: Int = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-with typed variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/steps/good-with typed variadic parameter.sdstest deleted file mode 100644 index ec3001739..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-with typed variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep(vararg a: Int) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-with untyped optional parameter.sdstest b/DSL/tests/resources/grammar/declarations/steps/good-with untyped optional parameter.sdstest deleted file mode 100644 index 4e56841cb..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-with untyped optional parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep(a = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-with untyped variadic parameter (with default value).sdstest b/DSL/tests/resources/grammar/declarations/steps/good-with untyped variadic parameter (with default value).sdstest deleted file mode 100644 index a245cc26c..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-with untyped variadic parameter (with default value).sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep(vararg a = 1) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/good-with untyped variadic parameter.sdstest b/DSL/tests/resources/grammar/declarations/steps/good-with untyped variadic parameter.sdstest deleted file mode 100644 index f317c8582..000000000 --- a/DSL/tests/resources/grammar/declarations/steps/good-with untyped variadic parameter.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ no_syntax_error - -step myStep(vararg a) {} diff --git a/DSL/tests/resources/grammar/declarations/steps/bad-missing body.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped segment.sdstest similarity index 63% rename from DSL/tests/resources/grammar/declarations/steps/bad-missing body.sdstest rename to DSL/tests/resources/grammar/keywords as names/bad-unescaped segment.sdstest index 0ec84c398..5327bb382 100644 --- a/DSL/tests/resources/grammar/declarations/steps/bad-missing body.sdstest +++ b/DSL/tests/resources/grammar/keywords as names/bad-unescaped segment.sdstest @@ -1,3 +1,3 @@ // $TEST$ syntax_error -step myStep() +class segment diff --git a/DSL/tests/resources/grammar/keywords as names/bad-unescaped step.sdstest b/DSL/tests/resources/grammar/keywords as names/bad-unescaped step.sdstest deleted file mode 100644 index a786139de..000000000 --- a/DSL/tests/resources/grammar/keywords as names/bad-unescaped step.sdstest +++ /dev/null @@ -1,3 +0,0 @@ -// $TEST$ syntax_error - -class step diff --git a/DSL/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest b/DSL/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest index 3f5f1b988..5dcc16ee7 100644 --- a/DSL/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest +++ b/DSL/tests/resources/grammar/keywords as names/good-escapedKeywords.sdstest @@ -22,7 +22,7 @@ class `private` class `protocol` class `schema` class `static` -class `step` +class `segment` class `sub` class `subterm` class `super` diff --git a/DSL/tests/resources/grammar/declarations/steps/good-annotation call.sdstest b/DSL/tests/resources/grammar/schema/good-annotation call.sdstest similarity index 54% rename from DSL/tests/resources/grammar/declarations/steps/good-annotation call.sdstest rename to DSL/tests/resources/grammar/schema/good-annotation call.sdstest index f9064ba1f..6d802b733 100644 --- a/DSL/tests/resources/grammar/declarations/steps/good-annotation call.sdstest +++ b/DSL/tests/resources/grammar/schema/good-annotation call.sdstest @@ -1,4 +1,6 @@ // $TEST$ no_syntax_error +package test + @Annotation -step myStep() {} +schema MySchema {} diff --git a/DSL/tests/resources/grammar/schema/good-one column.sdstest b/DSL/tests/resources/grammar/schema/good-one column.sdstest index 366c0bbe6..bea79ca35 100644 --- a/DSL/tests/resources/grammar/schema/good-one column.sdstest +++ b/DSL/tests/resources/grammar/schema/good-one column.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error schema MySchema { - "column1" : Int + "column1": Int } diff --git a/DSL/tests/resources/grammar/schema/good-two columns.sdstest b/DSL/tests/resources/grammar/schema/good-two columns.sdstest index a96bad2f9..5cd16453f 100644 --- a/DSL/tests/resources/grammar/schema/good-two columns.sdstest +++ b/DSL/tests/resources/grammar/schema/good-two columns.sdstest @@ -1,6 +1,6 @@ // $TEST$ no_syntax_error schema MySchema { - "column1" : Int, - "column2" : String + "column1": Int, + "column2": String } diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in step without assignees.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without assignees.sdstest similarity index 61% rename from DSL/tests/resources/grammar/statements/assignments/bad-in step without assignees.sdstest rename to DSL/tests/resources/grammar/statements/assignments/bad-in segment without assignees.sdstest index b8126dc8b..886632c65 100644 --- a/DSL/tests/resources/grammar/statements/assignments/bad-in step without assignees.sdstest +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without assignees.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep() { +segment mySegment() { = 0; } diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in step without expression.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without expression.sdstest similarity index 63% rename from DSL/tests/resources/grammar/statements/assignments/bad-in step without expression.sdstest rename to DSL/tests/resources/grammar/statements/assignments/bad-in segment without expression.sdstest index f549e849f..0d7b52fd9 100644 --- a/DSL/tests/resources/grammar/statements/assignments/bad-in step without expression.sdstest +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without expression.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep() { +segment mySegment() { val a =; } diff --git a/DSL/tests/resources/grammar/statements/assignments/bad-in step without semicolon.sdstest b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without semicolon.sdstest similarity index 64% rename from DSL/tests/resources/grammar/statements/assignments/bad-in step without semicolon.sdstest rename to DSL/tests/resources/grammar/statements/assignments/bad-in segment without semicolon.sdstest index fae0a7b89..350dbd7d8 100644 --- a/DSL/tests/resources/grammar/statements/assignments/bad-in step without semicolon.sdstest +++ b/DSL/tests/resources/grammar/statements/assignments/bad-in segment without semicolon.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep() { +segment mySegment() { val a = 0 } diff --git a/DSL/tests/resources/grammar/statements/assignments/good-in step.sdstest b/DSL/tests/resources/grammar/statements/assignments/good-in segment.sdstest similarity index 77% rename from DSL/tests/resources/grammar/statements/assignments/good-in step.sdstest rename to DSL/tests/resources/grammar/statements/assignments/good-in segment.sdstest index 0987d9c52..334f15ef9 100644 --- a/DSL/tests/resources/grammar/statements/assignments/good-in step.sdstest +++ b/DSL/tests/resources/grammar/statements/assignments/good-in segment.sdstest @@ -1,6 +1,6 @@ // $TEST$ no_syntax_error -step myStep() { +segment mySegment() { val a = 0; val a, _, yield b = call(); } diff --git a/DSL/tests/resources/grammar/statements/bad-empty statement in step.sdstest b/DSL/tests/resources/grammar/statements/bad-empty statement in segment.sdstest similarity index 59% rename from DSL/tests/resources/grammar/statements/bad-empty statement in step.sdstest rename to DSL/tests/resources/grammar/statements/bad-empty statement in segment.sdstest index 069d110b0..ab3a700b6 100644 --- a/DSL/tests/resources/grammar/statements/bad-empty statement in step.sdstest +++ b/DSL/tests/resources/grammar/statements/bad-empty statement in segment.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep() { +segment mySegment() { ; } diff --git a/DSL/tests/resources/grammar/statements/expression statements/bad-in step without semicolon.sdstest b/DSL/tests/resources/grammar/statements/expression statements/bad-in segment without semicolon.sdstest similarity index 62% rename from DSL/tests/resources/grammar/statements/expression statements/bad-in step without semicolon.sdstest rename to DSL/tests/resources/grammar/statements/expression statements/bad-in segment without semicolon.sdstest index 54f343400..8e9345f9f 100644 --- a/DSL/tests/resources/grammar/statements/expression statements/bad-in step without semicolon.sdstest +++ b/DSL/tests/resources/grammar/statements/expression statements/bad-in segment without semicolon.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep() { +segment mySegment() { call() } diff --git a/DSL/tests/resources/grammar/statements/expression statements/good-in step.sdstest b/DSL/tests/resources/grammar/statements/expression statements/good-in segment.sdstest similarity index 65% rename from DSL/tests/resources/grammar/statements/expression statements/good-in step.sdstest rename to DSL/tests/resources/grammar/statements/expression statements/good-in segment.sdstest index 310bc29c7..57c294205 100644 --- a/DSL/tests/resources/grammar/statements/expression statements/good-in step.sdstest +++ b/DSL/tests/resources/grammar/statements/expression statements/good-in segment.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep() { +segment mySegment() { call(); } diff --git a/DSL/tests/resources/grammar/trailing commas/good-argument list of annotation call.sdstest b/DSL/tests/resources/grammar/trailing commas/good-argument list of annotation call.sdstest index 34d750cd4..f8be6908c 100644 --- a/DSL/tests/resources/grammar/trailing commas/good-argument list of annotation call.sdstest +++ b/DSL/tests/resources/grammar/trailing commas/good-argument list of annotation call.sdstest @@ -1,3 +1,3 @@ // $TEST$ no_syntax_error -@A(1, 2, ) class C +@A(1, 2, ) diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of callable type.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of callable type.sdstest index 6c6179c9c..e1d85571f 100644 --- a/DSL/tests/resources/grammar/trailing commas/good-parameter list of callable type.sdstest +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of callable type.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step s( +segment s( f: (x: Int, y: Int, ) -> () ) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-parameter list of step.sdstest b/DSL/tests/resources/grammar/trailing commas/good-parameter list of segment.sdstest similarity index 65% rename from DSL/tests/resources/grammar/trailing commas/good-parameter list of step.sdstest rename to DSL/tests/resources/grammar/trailing commas/good-parameter list of segment.sdstest index 367cf0fa3..47f644888 100644 --- a/DSL/tests/resources/grammar/trailing commas/good-parameter list of step.sdstest +++ b/DSL/tests/resources/grammar/trailing commas/good-parameter list of segment.sdstest @@ -1,6 +1,6 @@ // $TEST$ no_syntax_error -step s( +segment s( a: Int, - b: Int, + b: Int, ) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-result list of callable type.sdstest b/DSL/tests/resources/grammar/trailing commas/good-result list of callable type.sdstest index 354a1a81f..e06ea8975 100644 --- a/DSL/tests/resources/grammar/trailing commas/good-result list of callable type.sdstest +++ b/DSL/tests/resources/grammar/trailing commas/good-result list of callable type.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step s( +segment s( f: () -> (x: Int, y: Int, ) ) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-result list of step.sdstest b/DSL/tests/resources/grammar/trailing commas/good-result list of segment.sdstest similarity index 79% rename from DSL/tests/resources/grammar/trailing commas/good-result list of step.sdstest rename to DSL/tests/resources/grammar/trailing commas/good-result list of segment.sdstest index 7d8d08203..64c7b4b22 100644 --- a/DSL/tests/resources/grammar/trailing commas/good-result list of step.sdstest +++ b/DSL/tests/resources/grammar/trailing commas/good-result list of segment.sdstest @@ -1,6 +1,6 @@ // $TEST$ no_syntax_error -step s() -> ( +segment s() -> ( first: Int, second: Int, ) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-type argument list of named type.sdstest b/DSL/tests/resources/grammar/trailing commas/good-type argument list of named type.sdstest index 025fc2dea..c4d43d35d 100644 --- a/DSL/tests/resources/grammar/trailing commas/good-type argument list of named type.sdstest +++ b/DSL/tests/resources/grammar/trailing commas/good-type argument list of named type.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step s( +segment s( f: Type ) {} diff --git a/DSL/tests/resources/grammar/trailing commas/good-type argument list of union type.sdstest b/DSL/tests/resources/grammar/trailing commas/good-type argument list of union type.sdstest index 7cf987db7..83b717569 100644 --- a/DSL/tests/resources/grammar/trailing commas/good-type argument list of union type.sdstest +++ b/DSL/tests/resources/grammar/trailing commas/good-type argument list of union type.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step s( +segment s( f: union ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/bad-with missing arrow.sdstest b/DSL/tests/resources/grammar/types/callable types/bad-with missing arrow.sdstest index 3432c3221..5674be225 100644 --- a/DSL/tests/resources/grammar/types/callable types/bad-with missing arrow.sdstest +++ b/DSL/tests/resources/grammar/types/callable types/bad-with missing arrow.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( f: () () ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/bad-with missing parameter list.sdstest b/DSL/tests/resources/grammar/types/callable types/bad-with missing parameter list.sdstest index eba2fa108..739276971 100644 --- a/DSL/tests/resources/grammar/types/callable types/bad-with missing parameter list.sdstest +++ b/DSL/tests/resources/grammar/types/callable types/bad-with missing parameter list.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( f: -> () ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/bad-with missing result list.sdstest b/DSL/tests/resources/grammar/types/callable types/bad-with missing result list.sdstest index 7516b31b0..89bb1850e 100644 --- a/DSL/tests/resources/grammar/types/callable types/bad-with missing result list.sdstest +++ b/DSL/tests/resources/grammar/types/callable types/bad-with missing result list.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( f: () -> ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest b/DSL/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest index cf151d175..fd772f0fc 100644 --- a/DSL/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest +++ b/DSL/tests/resources/grammar/types/callable types/good-with multiple parameters.sdstest @@ -1,6 +1,6 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( f: ( @Annotation a, b = 0, diff --git a/DSL/tests/resources/grammar/types/callable types/good-with multiple results.sdstest b/DSL/tests/resources/grammar/types/callable types/good-with multiple results.sdstest index 3f560a477..b6496d7cb 100644 --- a/DSL/tests/resources/grammar/types/callable types/good-with multiple results.sdstest +++ b/DSL/tests/resources/grammar/types/callable types/good-with multiple results.sdstest @@ -1,6 +1,6 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( f: () -> ( @Annotation a, b, diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one typed parameter.sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one typed parameter.sdstest index ebe1177da..d96db7f9e 100644 --- a/DSL/tests/resources/grammar/types/callable types/good-with one typed parameter.sdstest +++ b/DSL/tests/resources/grammar/types/callable types/good-with one typed parameter.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( f: (param: Int) -> () ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one typed result (in parentheses).sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one typed result (in parentheses).sdstest index 67397963d..c4096ac70 100644 --- a/DSL/tests/resources/grammar/types/callable types/good-with one typed result (in parentheses).sdstest +++ b/DSL/tests/resources/grammar/types/callable types/good-with one typed result (in parentheses).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( f: () -> (result: Int) ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one typed result (no parentheses).sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one typed result (no parentheses).sdstest index 4cdb662b0..c6ab4cde7 100644 --- a/DSL/tests/resources/grammar/types/callable types/good-with one typed result (no parentheses).sdstest +++ b/DSL/tests/resources/grammar/types/callable types/good-with one typed result (no parentheses).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( f: () -> result: Int ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one untyped parameter.sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one untyped parameter.sdstest index 8c94658c7..a0a171320 100644 --- a/DSL/tests/resources/grammar/types/callable types/good-with one untyped parameter.sdstest +++ b/DSL/tests/resources/grammar/types/callable types/good-with one untyped parameter.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( f: (param) -> () ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (in parentheses).sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (in parentheses).sdstest index 69f7c44c3..0309a51bf 100644 --- a/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (in parentheses).sdstest +++ b/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (in parentheses).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( f: () -> (result) ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (no parentheses).sdstest b/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (no parentheses).sdstest index 7e2dcdbdd..af858505d 100644 --- a/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (no parentheses).sdstest +++ b/DSL/tests/resources/grammar/types/callable types/good-with one untyped result (no parentheses).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( f: () -> result ) {} diff --git a/DSL/tests/resources/grammar/types/callable types/good-without parameters or results.sdstest b/DSL/tests/resources/grammar/types/callable types/good-without parameters or results.sdstest index d2f83fb1c..2baa7ff05 100644 --- a/DSL/tests/resources/grammar/types/callable types/good-without parameters or results.sdstest +++ b/DSL/tests/resources/grammar/types/callable types/good-without parameters or results.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( f: () -> () ) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-callable type as member.sdstest b/DSL/tests/resources/grammar/types/member types/bad-callable type as member.sdstest index 654395e34..11f5aba32 100644 --- a/DSL/tests/resources/grammar/types/member types/bad-callable type as member.sdstest +++ b/DSL/tests/resources/grammar/types/member types/bad-callable type as member.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( x: OuterClass.() -> () ) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-missing member.sdstest b/DSL/tests/resources/grammar/types/member types/bad-missing member.sdstest index 49cdcafae..9f4517d3e 100644 --- a/DSL/tests/resources/grammar/types/member types/bad-missing member.sdstest +++ b/DSL/tests/resources/grammar/types/member types/bad-missing member.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( x: OuterClass. ) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-missing receiver.sdstest b/DSL/tests/resources/grammar/types/member types/bad-missing receiver.sdstest index eeefc9211..36d39ad51 100644 --- a/DSL/tests/resources/grammar/types/member types/bad-missing receiver.sdstest +++ b/DSL/tests/resources/grammar/types/member types/bad-missing receiver.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( x: .InnerClass ) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-unclosed angle bracket.sdstest b/DSL/tests/resources/grammar/types/member types/bad-unclosed angle bracket.sdstest index 2e7244f96..b69e017ba 100644 --- a/DSL/tests/resources/grammar/types/member types/bad-unclosed angle bracket.sdstest +++ b/DSL/tests/resources/grammar/types/member types/bad-unclosed angle bracket.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( x: OuterClass.InnerClass< ) {} diff --git a/DSL/tests/resources/grammar/types/member types/bad-union type as member.sdstest b/DSL/tests/resources/grammar/types/member types/bad-union type as member.sdstest index 9176a8ed3..bdbd80757 100644 --- a/DSL/tests/resources/grammar/types/member types/bad-union type as member.sdstest +++ b/DSL/tests/resources/grammar/types/member types/bad-union type as member.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( x: OuterClass.union<> ) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-long complex chain.sdstest b/DSL/tests/resources/grammar/types/member types/good-long complex chain.sdstest index 62e0b9ee2..1a3867f8e 100644 --- a/DSL/tests/resources/grammar/types/member types/good-long complex chain.sdstest +++ b/DSL/tests/resources/grammar/types/member types/good-long complex chain.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: union<>.MiddleClass?.InnerClass ) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (not nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (not nullable).sdstest index c0e665457..4867643c1 100644 --- a/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (not nullable).sdstest +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (not nullable).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: () -> ().InnerClass ) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (nullable).sdstest index 217c03613..5cfef9a17 100644 --- a/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (nullable).sdstest +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (callable) and member (nullable).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: () -> ().InnerClass? ) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (not nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (not nullable).sdstest index b25379c87..56b6bf481 100644 --- a/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (not nullable).sdstest +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (not nullable).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: OuterClass.InnerClass ) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (nullable).sdstest index 6fc6442ad..118f8783b 100644 --- a/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (nullable).sdstest +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (named, not nullable) and member (nullable).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: OuterClass.InnerClass? ) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (not nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (not nullable).sdstest index b2e49bf71..f74fa6e45 100644 --- a/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (not nullable).sdstest +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (not nullable).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: OuterClass?.InnerClass ) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (nullable).sdstest index 6fc6442ad..118f8783b 100644 --- a/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (nullable).sdstest +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (named, nullable) and member (nullable).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: OuterClass.InnerClass? ) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (not nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (not nullable).sdstest index ea0bee530..5d1d53216 100644 --- a/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (not nullable).sdstest +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (not nullable).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: union<>.InnerClass ) {} diff --git a/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (nullable).sdstest b/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (nullable).sdstest index 341d65f09..04ad20cc6 100644 --- a/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (nullable).sdstest +++ b/DSL/tests/resources/grammar/types/member types/good-receiver (union) and member (nullable).sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: union<>.InnerClass? ) {} diff --git a/DSL/tests/resources/grammar/types/named types/bad-unclosed angle bracket.sdstest b/DSL/tests/resources/grammar/types/named types/bad-unclosed angle bracket.sdstest index 956e664be..77d80695e 100644 --- a/DSL/tests/resources/grammar/types/named types/bad-unclosed angle bracket.sdstest +++ b/DSL/tests/resources/grammar/types/named types/bad-unclosed angle bracket.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( x: OuterClass< ) {} diff --git a/DSL/tests/resources/grammar/types/named types/good-no type arguments and not nullable.sdstest b/DSL/tests/resources/grammar/types/named types/good-no type arguments and not nullable.sdstest index 464ab964f..880fb7dde 100644 --- a/DSL/tests/resources/grammar/types/named types/good-no type arguments and not nullable.sdstest +++ b/DSL/tests/resources/grammar/types/named types/good-no type arguments and not nullable.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: Int ) {} diff --git a/DSL/tests/resources/grammar/types/named types/good-no type arguments and nullable.sdstest b/DSL/tests/resources/grammar/types/named types/good-no type arguments and nullable.sdstest index 963bc6f0d..9da0abc28 100644 --- a/DSL/tests/resources/grammar/types/named types/good-no type arguments and nullable.sdstest +++ b/DSL/tests/resources/grammar/types/named types/good-no type arguments and nullable.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: Int? ) {} diff --git a/DSL/tests/resources/grammar/types/named types/good-type argument and nullable.sdstest b/DSL/tests/resources/grammar/types/named types/good-type argument and nullable.sdstest index df1550c7a..ca572847d 100644 --- a/DSL/tests/resources/grammar/types/named types/good-type argument and nullable.sdstest +++ b/DSL/tests/resources/grammar/types/named types/good-type argument and nullable.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: Int<*, in Number, out Number, T = Number>? ) {} diff --git a/DSL/tests/resources/grammar/types/named types/good-type arguments and not nullable.sdstest b/DSL/tests/resources/grammar/types/named types/good-type arguments and not nullable.sdstest index bd692f196..26f9b9b20 100644 --- a/DSL/tests/resources/grammar/types/named types/good-type arguments and not nullable.sdstest +++ b/DSL/tests/resources/grammar/types/named types/good-type arguments and not nullable.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: Int<*, in Number, out Number, T = Number> ) {} diff --git a/DSL/tests/resources/grammar/types/union types/bad-unclosed angle bracket.sdstest b/DSL/tests/resources/grammar/types/union types/bad-unclosed angle bracket.sdstest index b18e3189d..05a407afb 100644 --- a/DSL/tests/resources/grammar/types/union types/bad-unclosed angle bracket.sdstest +++ b/DSL/tests/resources/grammar/types/union types/bad-unclosed angle bracket.sdstest @@ -1,5 +1,5 @@ // $TEST$ syntax_error -step myStep( +segment mySegment( x: union< ) {} diff --git a/DSL/tests/resources/grammar/types/union types/good-empty.sdstest b/DSL/tests/resources/grammar/types/union types/good-empty.sdstest index 097a6c062..0d4de6156 100644 --- a/DSL/tests/resources/grammar/types/union types/good-empty.sdstest +++ b/DSL/tests/resources/grammar/types/union types/good-empty.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: union<> ) {} diff --git a/DSL/tests/resources/grammar/types/union types/good-nested.sdstest b/DSL/tests/resources/grammar/types/union types/good-nested.sdstest index 5cfdbe211..9fbe2261d 100644 --- a/DSL/tests/resources/grammar/types/union types/good-nested.sdstest +++ b/DSL/tests/resources/grammar/types/union types/good-nested.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: union> ) {} diff --git a/DSL/tests/resources/grammar/types/union types/good-with type arguments.sdstest b/DSL/tests/resources/grammar/types/union types/good-with type arguments.sdstest index 8e351850c..0d9fc7757 100644 --- a/DSL/tests/resources/grammar/types/union types/good-with type arguments.sdstest +++ b/DSL/tests/resources/grammar/types/union types/good-with type arguments.sdstest @@ -1,5 +1,5 @@ // $TEST$ no_syntax_error -step myStep( +segment mySegment( x: union ) {} diff --git a/DSL/tsconfig.json b/DSL/tsconfig.json index 577644349..798a85ade 100644 --- a/DSL/tsconfig.json +++ b/DSL/tsconfig.json @@ -6,9 +6,7 @@ "sourceMap": true, "outDir": "out", "strict": true, - "noUnusedLocals": true, - "noImplicitReturns": true, - "noImplicitOverride": true, + "strictPropertyInitialization": false, "moduleResolution": "node", "esModuleInterop": true, "skipLibCheck": true, diff --git a/docs/development/formatting-testing.md b/docs/development/formatting-testing.md new file mode 100644 index 000000000..cc5b72200 --- /dev/null +++ b/docs/development/formatting-testing.md @@ -0,0 +1,20 @@ +# Formatting Testing + +Formatting tests are data driven instead of being specified explicitly. This document explains how to add a new formatting test. + +## Adding a formatting test + +1. Create a new file with extension `.sdstest` in the `DSL/tests/resources/formatting` directory or any + subdirectory. Give the file a descriptive name, since the file name becomes part of the test name. + + !!! tip "Skipping a test" + + If you want to skip a test, add the prefix `skip-` to the file name. + +2. Add the original unformatted Safe-DS code to the top of the file. The code must be syntactically valid. +3. Add the following separator to the file: + ```txt + // ----------------------------------------------------------------------------- + ``` +4. Add the expected formatted Safe-DS code to the file below the separator. +5. Run the tests. The test runner will automatically pick up the new test. diff --git a/docs/language/common/parameters.md b/docs/language/common/parameters.md index 77d7cffb2..15308aecd 100644 --- a/docs/language/common/parameters.md +++ b/docs/language/common/parameters.md @@ -53,10 +53,10 @@ Let us break down the syntax: ## Complete Example -Let us now look at a full example of a [step][steps] called `doSomething` with one [required parameter](#required-parameters) and one [optional parameter](#optional-parameters): +Let us now look at a full example of a [segment][segments] called `doSomething` with one [required parameter](#required-parameters) and one [optional parameter](#optional-parameters): ```txt -step doSomething(requiredParameter: Int, optionalParameter: Boolean = false) { +segment doSomething(requiredParameter: Int, optionalParameter: Boolean = false) { // ... } ``` @@ -192,7 +192,7 @@ Most commonly, default values in Python are literals, since default values are o [types]: types.md [types-python]: types.md#corresponding-python-code -[steps]: ../pipeline-language/steps.md +[segments]: ../pipeline-language/segments.md [calls]: ../pipeline-language/expressions.md#calls [stub-language]: ../stub-language/README.md [int-literals]: ../pipeline-language/expressions.md#int-literals diff --git a/docs/language/common/results.md b/docs/language/common/results.md index 31eece3ec..8b755d333 100644 --- a/docs/language/common/results.md +++ b/docs/language/common/results.md @@ -14,10 +14,10 @@ Here is a breakdown of the syntax: ## Complete Example -Let us now look at a full example of a [step][steps] called `doSomething` with two results: +Let us now look at a full example of a [segment][segments] called `doSomething` with two results: ```txt -step doSomething() -> (result1: Int, result2: Boolean) { +segment doSomething() -> (result1: Int, result2: Boolean) { // ... } ``` @@ -34,11 +34,11 @@ The interesting part is the list of results, which uses the following syntactic In case that the callable produces only a single result, we can omit the parentheses. The following two declarations are, hence, equivalent: ```txt -step doSomething1() -> (result: Int) {} +segment doSomething1() -> (result: Int) {} ``` ```txt -step doSomething2() -> result: Int {} +segment doSomething2() -> result: Int {} ``` ## Shorthand Version: No Results @@ -46,11 +46,11 @@ step doSomething2() -> result: Int {} In case that the callable produces no results, we can usually omit the entire results list. The following two declarations are, hence equivalent: ```txt -step doSomething1() -> () {} +segment doSomething1() -> () {} ``` ```txt -step doSomething2() {} +segment doSomething2() {} ``` The notable exception are [callable types][callable-types], where the result list must always be specified even when it is empty. @@ -67,5 +67,5 @@ Since Python results do not have a name, the names of Safe-DS results can be arb [types]: types.md [types-python]: types.md#corresponding-python-code [callable-types]: types.md#callable-type -[steps]: ../pipeline-language/steps.md +[segments]: ../pipeline-language/segments.md [calls]: ../pipeline-language/expressions.md#calls diff --git a/docs/language/common/types.md b/docs/language/common/types.md index 94a2679c6..b14e59346 100644 --- a/docs/language/common/types.md +++ b/docs/language/common/types.md @@ -298,7 +298,7 @@ A _callable type_ denotes that only values that can be [called][calls] are accep - [constructors of enum variants][enum-variant-constructors] - [methods][methods] - [global functions][global-functions] -- [steps][steps] +- [segments][segments] - [lambdas][lambdas] Additionally, a callable types specifies the names and types of parameters and results. Here is the most basic callable type that expects neither parameters nor results: @@ -423,7 +423,7 @@ Getting the ` depends on the number of results. If there is only a [member-accesses]: ../pipeline-language/expressions.md#member-access-of-enum-variants [null-literal]: ../pipeline-language/expressions.md#null-literal [calls]: ../pipeline-language/expressions.md#calls -[steps]: ../pipeline-language/steps.md +[segments]: ../pipeline-language/segments.md [lambdas]: ../pipeline-language/expressions.md#lambdas [mypy]: http://mypy-lang.org/ [type-hints]: https://docs.python.org/3/library/typing.html diff --git a/docs/language/pipeline-language/README.md b/docs/language/pipeline-language/README.md index 31e802841..1a672233c 100644 --- a/docs/language/pipeline-language/README.md +++ b/docs/language/pipeline-language/README.md @@ -5,8 +5,8 @@ The pipeline language is the part of the Safe-DS DSL that is designed to solve s - [Packages][packages] help avoid conflicts that could arise if two declarations have the same name. - [Imports][imports] make declarations in other packages accessible. - [Pipelines][pipelines] define the entry point of a data science program. -- [Steps][steps] encapsulate parts of a data science program and make them reusable. -- [Statements][statements] are the instructions that are executed as part of a [pipeline][pipelines], [step][steps], or [block lambda][block-lambdas]. +- [Segments][segments] encapsulate parts of a data science program and make them reusable. +- [Statements][statements] are the instructions that are executed as part of a [pipeline][pipelines], [segment][segments], or [block lambda][block-lambdas]. - [Expressions][expressions] are computations that produce some value. - [Comments][comments] document the code. @@ -15,7 +15,7 @@ Files that use the pipeline language must have the extension `.sdspipe`. [packages]: ../common/packages.md [imports]: ../common/imports.md [pipelines]: pipelines.md -[steps]: steps.md +[segments]: segments.md [statements]: statements.md [expressions]: expressions.md [block-lambdas]: expressions.md#block-lambdas diff --git a/docs/language/pipeline-language/expressions.md b/docs/language/pipeline-language/expressions.md index 0e070dbb3..5a19a7f09 100644 --- a/docs/language/pipeline-language/expressions.md +++ b/docs/language/pipeline-language/expressions.md @@ -149,27 +149,27 @@ In order to refer to global declarations in other [packages][packages], we first ## Calls -Calls are used to trigger the execution of a specific action, which can, for example, be the creation of an instance of a [class][classes] or executing the code in a [step][steps]. Let's look at an example: +Calls are used to trigger the execution of a specific action, which can, for example, be the creation of an instance of a [class][classes] or executing the code in a [segment][segments]. Let's look at an example: -First, we show the code of the [step][steps] that we want to call. +First, we show the code of the [segment][segments] that we want to call. ```txt -step createDecisionTree(maxDepth: Int = 10) { +segment createDecisionTree(maxDepth: Int = 10) { // ... do something ... } ``` -This [step][steps] has a single [parameter][parameters] `maxDepth`, which must have [type][types] `Int`, and has the default value `10`. Since it has a default value, we are not required to specify a value when we call this [step][steps]. The most basic legal call of the [step][steps] is, thus, this: +This [segment][segments] has a single [parameter][parameters] `maxDepth`, which must have [type][types] `Int`, and has the default value `10`. Since it has a default value, we are not required to specify a value when we call this [segment][segments]. The most basic legal call of the [segment][segments] is, thus, this: ```txt createDecisionTree() ``` -This calls the [step][steps] `createDecisionTree`, using the default `maxDepth` of `10`. +This calls the [segment][segments] `createDecisionTree`, using the default `maxDepth` of `10`. The syntax consists of these elements: -- The _callee_ of the call, which is the expression to call (here a [reference](#references) to the [step][steps] `createDecisionTree`) +- The _callee_ of the call, which is the expression to call (here a [reference](#references) to the [segment][segments] `createDecisionTree`) - The list of arguments, which is delimited by parentheses. In this case the list is empty, so no arguments are passed. If we want to override the default value of an optional [parameter][parameters] or if the callee has required [parameters][parameters], we need to pass arguments. We can either use _positional arguments_ or _named arguments_. @@ -196,10 +196,10 @@ These are the syntactic elements: ### Passing Multiple Arguments -We now add another parameter to the `createDecisionTree` [step][steps]: +We now add another parameter to the `createDecisionTree` [segment][segments]: ```txt -step createDecisionTree(isBinary: Boolean, maxDepth: Int = 10) { +segment createDecisionTree(isBinary: Boolean, maxDepth: Int = 10) { // ... do something ... } ``` @@ -231,7 +231,7 @@ Depending on the callee, a call can do different things. The following table lis | [Enum Variant][enum-variants] | Creates a new instance of the enum variant. Enum variants are always callable. The call evaluates to this new instance. | | [Global Function][global-functions] | Invokes the function and runs the associated Python code. The call evaluates to the result record of the function. | | [Method][methods] | Invokes the method and runs the associated Python code. The call evaluates to the result record of the method. | -| [Step][steps] | Invokes the step and runs the Safe-DS code in its body. The call evaluates to the result record of the step. | +| [Segment][segments] | Invokes the segment and runs the Safe-DS code in its body. The call evaluates to the result record of the segment. | | [Block Lambda](#block-lambdas) | Invokes the lambda and runs the Safe-DS code in its body. The call evaluates to the result record of the lambda. | | [Expression Lambda](#expression-lambdas) | Invokes the lambda and runs the Safe-DS code in its body. The call evaluates to the result record of the lambda. | | Declaration with [Callable Type][callable-types] | Call whatever the value of the declaration is. | @@ -242,7 +242,7 @@ The term _result record_ warrants further explanation: A result record maps [res - [global function][global-functions], - [method][methods], -- [step][steps], or +- [segment][segments], or - [lambda](#lambdas) to their computed values. @@ -402,10 +402,10 @@ createValueWrapper() ## Indexed Accesses -An indexed access is currently only used to access one value assigned to a [variadic parameter][variadic-parameters]. In the following example, we use an index access to retrieve the first value that is assigned to the [variadic parameter][variadic-parameters] `values` of the step `printFirst`: +An indexed access is currently only used to access one value assigned to a [variadic parameter][variadic-parameters]. In the following example, we use an index access to retrieve the first value that is assigned to the [variadic parameter][variadic-parameters] `values` of the segment `printFirst`: ```txt -step printFirst(vararg values: Int) { +segment printFirst(vararg values: Int) { print(values[0]); } ``` @@ -431,17 +431,17 @@ class LinearRegression() { This is a [class][classes] `LinearRegression`, which has a constructor and an instance [method][methods] called `drawAsGraph`. -We can then use those declarations in a [step][steps]: +We can then use those declarations in a [segment][segments]: ```txt -step myStep(vararg regressions: LinearRegression) { +segment mySegment(vararg regressions: LinearRegression) { regressions[0].drawAsGraph(); } ``` -This step is called `myStep` and has a [variadic parameter][variadic-parameters] `regressions` of type `LinearRegression`. This means we can pass an arbitrary number of instances of `LinearRegression` to the step when we [call](#calls) it. +This segment is called `mySegment` and has a [variadic parameter][variadic-parameters] `regressions` of type `LinearRegression`. This means we can pass an arbitrary number of instances of `LinearRegression` to the segment when we [call](#calls) it. -In the body of the step we then +In the body of the segment we then 1. access the first instance that was pass using an [indexed access](#indexed-accesses), 2. access the instance method `drawAsGraph` of this instance using a [member access](#member-accesses), @@ -449,7 +449,7 @@ In the body of the step we then ## Lambdas -If you want to write reusable blocks of code, use a [step][steps]. However, sometimes you need to create a highly application-specific callable that can be passed as argument to some function or returned as the result of a [step][steps]. We will explain this concept by filtering a list. Here are the relevant declarations: +If you want to write reusable blocks of code, use a [segment][segments]. However, sometimes you need to create a highly application-specific callable that can be passed as argument to some function or returned as the result of a [segment][segments]. We will explain this concept by filtering a list. Here are the relevant declarations: ```txt class IntList { @@ -463,27 +463,27 @@ First, we declare a [class][classes] `IntList`, which has a single [method][meth Second, we declare a [global function][global-functions] `intListOf` that is supposed to wrap `elements` into an `IntList`. -Say, we now want to keep only the elements in the list that are less than `10`. We can do this by declaring a [step][steps]: +Say, we now want to keep only the elements in the list that are less than `10`. We can do this by declaring a [segment][segments]: ```txt -step keepLessThan10(a: Int) -> shouldKeep: Boolean { +segment keepLessThan10(a: Int) -> shouldKeep: Boolean { yield shouldKeep = a < 10; } ``` -Here is how to solve the task of keeping only elements below `10` with this [step][steps]: +Here is how to solve the task of keeping only elements below `10` with this [segment][segments]: ```txt intListOf(1, 4, 11).filter(keepLessThan10) ``` -The [call](#calls) to `intListOf` is just there to create an `IntList` that we can use for filtering. The interesting part is the argument we pass to the `filter` [method][methods], which is simply a reference to the [step][steps] we declared above. +The [call](#calls) to `intListOf` is just there to create an `IntList` that we can use for filtering. The interesting part is the argument we pass to the `filter` [method][methods], which is simply a reference to the [segment][segments] we declared above. -The problem here is that this solution is very cumbersome and verbose. We need to come up with a name for a [step][steps] that we will likely use only once. Moreover, the step must declare the [types][types] of its [parameters][parameters] and its [results][results] in its header. Finally, the declaration of the step has to happen in a separate location then its use. We can solve those issues with lambdas. +The problem here is that this solution is very cumbersome and verbose. We need to come up with a name for a [segment][segments] that we will likely use only once. Moreover, the segment must declare the [types][types] of its [parameters][parameters] and its [results][results] in its header. Finally, the declaration of the segment has to happen in a separate location then its use. We can solve those issues with lambdas. ### Block Lambdas -We will first rewrite the above solution using a _block lambda_, which is essentially a [step][steps] without a name and more concise syntax that can be declared where it is needed: +We will first rewrite the above solution using a _block lambda_, which is essentially a [segment][segments] without a name and more concise syntax that can be declared where it is needed: ```txt intListOf(1, 4, 11).filter( @@ -491,7 +491,7 @@ intListOf(1, 4, 11).filter( ) ``` -While this appears longer than the solution with [steps][steps], note that it replaces both the declaration of the [step][steps] as well as the [reference](#references) to it. +While this appears longer than the solution with [segments][segments], note that it replaces both the declaration of the [segment][segments] as well as the [reference](#references) to it. Here are the syntactic elements: @@ -523,12 +523,12 @@ These are the syntactic elements: Both [block lambdas](#block-lambdas) and [expression lambdas](#expression-lambdas) are closures, which means they remember the values of [placeholders][placeholders] and [parameters][parameters] that can be accessed within their body at the time of their creation. Here is an example: ```txt -step lazyValue(value: Int) -> result: () -> storedValue: Int { +segment lazyValue(value: Int) -> result: () -> storedValue: Int { yield result = () -> value } ``` -This deserves further explanation: We declare a [step][steps] `lazyValue`. It takes a single [required parameter][required-parameters] `value` with type `Int`. It produces a single [result][results] called `result`, which has a [callable type][callable-types] that takes no [parameters] and produces a single [result][results] called `storedValue` with type `Int`. In the [body][step-body] of the [step][steps] we then [assign][assignments-to-step-results] an [expression lambda](#expression-lambdas) to the [result][results] `result`. +This deserves further explanation: We declare a [segment][segments] `lazyValue`. It takes a single [required parameter][required-parameters] `value` with type `Int`. It produces a single [result][results] called `result`, which has a [callable type][callable-types] that takes no [parameters] and produces a single [result][results] called `storedValue` with type `Int`. In the [body][segment-body] of the [segment][segments] we then [assign][assignments-to-segment-results] an [expression lambda](#expression-lambdas) to the [result][results] `result`. The interesting part here is that we [refer to](#references) to the [parameter][parameters] `value` within the expression of the lambda. Since lambdas are closures, this means the current `value` is stored when the lambda is created. When we later call this lambda, exactly this value is returned. @@ -537,8 +537,8 @@ The interesting part here is that we [refer to](#references) to the [parameter][ At the moment, lambdas can only be used if the context determines the type of its parameters. Concretely, this means we can use lambdas in these two places: - As an argument that is assigned to a [parameter][parameters] with a [type][types] in a [call](#calls). -- As the value that is [assigned to a result of a step][assignments-to-step-results]. - In other cases, declare a step instead and use a [reference](#references) to this step where you would write the lambda. +- As the value that is [assigned to a result of a segment][assignments-to-segment-results]. + In other cases, declare a segment instead and use a [reference](#references) to this segment where you would write the lambda. ## Precedence @@ -579,8 +579,8 @@ If the default precedence of operators is not sufficient, parentheses can be use [pipeline-language]: README.md [statements]: statements.md [assignment-multiple-assignees]: statements.md#multiple-assignees -[assignments-to-step-results]: statements.md#yielding-results-of-steps +[assignments-to-segment-results]: statements.md#yielding-results-of-segments [assignments-to-block-lambda-results]: statements.md#declare-results-of-block-lambdas [placeholders]: statements.md#declaring-placeholders -[steps]: steps.md -[step-body]: steps.md#statements +[segments]: segments.md +[segment-body]: segments.md#statements diff --git a/docs/language/pipeline-language/pipelines.md b/docs/language/pipeline-language/pipelines.md index 402d13992..ca92df416 100644 --- a/docs/language/pipeline-language/pipelines.md +++ b/docs/language/pipeline-language/pipelines.md @@ -1,6 +1,6 @@ # Pipelines -Pipelines are data science programs designed to solve a specific task. They act as the entry point to start execution. Pipelines are not meant to be reusable, instead extract reusable code into a [step][steps]. +Pipelines are data science programs designed to solve a specific task. They act as the entry point to start execution. Pipelines are not meant to be reusable, instead extract reusable code into a [segment][segments]. ## Syntax @@ -33,5 +33,5 @@ pipeline predictSpeed { More information about statements can be found in the [linked document][statements]. Note particularly, that all statements must end with a semicolon. -[steps]: steps.md +[segments]: segments.md [statements]: statements.md diff --git a/docs/language/pipeline-language/segments.md b/docs/language/pipeline-language/segments.md new file mode 100644 index 000000000..029c46631 --- /dev/null +++ b/docs/language/pipeline-language/segments.md @@ -0,0 +1,136 @@ +# Segments + +Segments are used to extract a sequence of [statements][statements] from a data science program to give the sequence a name and make it reusable. In the following discussion we explain how to [declare a segment](#declaring-a-segment) and how to [call it](#calling-a-segment). + +## Declaring a Segment + +### Minimal Example + +Let's look at a minimal example of a segment: + +```txt +segment loadMovieRatingsSample() {} +``` + +This declaration of a segment has the following syntactic elements: + +- The keyword `segment`. +- The name of the segment, here `loadMovieRatingsSample`. This can be any combination of upper- and lowercase letters, underscores, and numbers, as long as it does not start with a number. However, we suggest to use `lowerCamelCase` for the names of segments. +- The list of parameters (i.e. inputs) of the segment. This is delimited by parentheses. In the example above, the segment has no parameters. +- The _body_ of the segment, which contains the [statements][statements] that should be run when the segment is [called](#calling-a-segment). The body is delimited by curly braces. In this example, the body is empty, so running this segment does nothing. + +### Parameters + +To make a segment configurable, add [parameters][parameters] (inputs). We will first show how to [declare parameters](#parameter-declaration) and afterwards how to [refer to them](#references-to-parameters) in the body of the segment. + +#### Parameter Declaration + +Parameters must be declared in the header of the segment so [callers](#calling-a-segment) know they are expected to pass them as an argument, and so we can [use them](#references-to-parameters) in the body of the segment. + +In the following example, we give the segment a single parameters with name `nInstances` and [type][types] `Int`. + +```txt +segment loadMovieRatingsSample(nInstances: Int) {} +``` + +More information about parameters can be found in the [linked document][parameters]. + +#### References to Parameters + +Within the segment we can access the value of a parameter using a [reference][references]. Here is a basic example where we print the value of the `nInstances` parameter to the console: + +```txt +segment loadMovieRatingsSample(nInstances: Int) { + print(nInstances); +} +``` + +More information about references can be found in the [linked document][references]. + +### Statements + +In order to describe what should be done when the segment is executed, we need to add [statements][statements] to its body. The previous example in the section ["References to Parameters"](#references-to-parameters) already contained a statement - an [expression statement][expression-statements] to be precise. Here is another example, this time showing an [assignment][assignments]: + +```txt +segment loadMovieRatingsSample(nInstances: Int) { + val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); +} +``` + +More information about statements can be found in the [linked document][statements]. Note particularly, that all statements must end with a semicolon. + +### Results + +[Results][results] (outputs) are used to return values that are produced inside the segment back to the caller. First, we show how to [declare the available results](#result-declaration) of the segment and then how to [assign a value to them](#assigning-to-results). + +#### Result Declaration + +As with [parameters](#parameters) we first need to declare the available results in the headed. This tells [callers](#calling-a-segment) that they can use these results and reminds us to [assign a value to them](#assigning-to-results) in the body of the segment. Let's look at an example: + +```txt +segment loadMovieRatingsSample(nInstances: Int) -> (features: Dataset, target: Dataset) { + val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); +} +``` + +We added two results to the segment: The first one is called `features` and has type `Dataset`, while the second one is called `target` and also has type `Dataset`. + +More information about the declaration of results can be found in the [linked document][results]. + +#### Assigning to Results + +Currently, the program will not compile since we never assigned a value to these results. This can be done with an [assignment][assignments] and the `yield` keyword: + +```txt +segment loadMovieRatingsSample(nInstances: Int) -> (features: Dataset, target: Dataset) { + val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); + yield features = movieRatingsSample.keepAttributes( + "leadingActor", + "genre", + "length" + ); + yield target = movieRatingsSample.keepAttributes( + "rating" + ); +} +``` + +In the assignment beginning with `yield features =` we specify the value of the result called `features`, while the next assignment beginning with `yield target =` assigns a value to the `target` result. + +The order of the [result declarations](#result-declaration) does not need to match the order of assignment. However, **each result musts be assigned exactly once**. Note that unlike the `return` in other programming languages, `yield` does not stop the execution of the segment, which allows [assignments][assignments] to different results to be split across multiple [statements][statements]. + +## Visibility + +By default, a segment can be [imported][imports] in any other file and reused there. We say they have `public` visibility. However, it is possible to restrict the visibility of a segment with modifiers: + +```txt +internal segment internalSegment() {} + +private segment privateSegment() {} +``` + +The segment `internalSegment` is only visible in files with the same [package][packages]. The segment `privateSegment` is only visible in the file it is declared in. + +## Calling a Segment + +Inside a [pipeline][pipelines], another segment, or a [lambda][lambdas] we can then [call][calls] a segment, which means the segment is executed when the call is reached: The results of a segment can then be used as needed. In the following example, where we call the segment `loadMovieRatingsSample` that we defined above, we [assign the results to placeholders][assignments-to-placeholders]: + +```txt +val features, val target = loadMovieRatingsSample(nInstances = 1000); +``` + +More information about calls can be found in the [linked document][calls]. + +[imports]: ../common/imports.md +[parameters]: ../common/parameters.md +[results]: ../common/results.md +[types]: ../common/types.md +[packages]: ../common/packages.md +[statements]: statements.md +[assignments]: statements.md#assignments +[assignments-to-placeholders]: statements.md#assigning-placeholders +[expression-statements]: statements.md#expression-statements +[calls]: expressions.md#calls +[lambdas]: expressions.md#lambdas +[references]: expressions.md#references +[pipelines]: pipelines.md diff --git a/docs/language/pipeline-language/statements.md b/docs/language/pipeline-language/statements.md index 654a60de1..d8f3307eb 100644 --- a/docs/language/pipeline-language/statements.md +++ b/docs/language/pipeline-language/statements.md @@ -49,10 +49,10 @@ This assignment to a placeholder has the following syntactic elements: #### References to Placeholder -We can access the value of a placeholder in any statement that follows the assignment of that placeholder in the closest containing [pipeline][pipelines], [step][steps], or [block lambda][block-lambdas] using a [reference][references]. Here is a basic example, where we print the value of the `one` placeholder (here `1`) to the console: +We can access the value of a placeholder in any statement that follows the assignment of that placeholder in the closest containing [pipeline][pipelines], [segment][segments], or [block lambda][block-lambdas] using a [reference][references]. Here is a basic example, where we print the value of the `one` placeholder (here `1`) to the console: ```txt -step loadMovieRatingsSample(nInstances: Int) { +segment loadMovieRatingsSample(nInstances: Int) { val one = 1; print(one); } @@ -62,14 +62,14 @@ More information about references can be found in the [linked document][referenc ### Yielding Results -In addition to the [declaration of placeholders](#declaring-placeholders), assignments are used to assign a value to a [result of a step](#yielding-results-of-steps) or declare [results of a block lambda](#declare-results-of-block-lambdas). +In addition to the [declaration of placeholders](#declaring-placeholders), assignments are used to assign a value to a [result of a segment](#yielding-results-of-segments) or declare [results of a block lambda](#declare-results-of-block-lambdas). -#### Yielding Results of Steps +#### Yielding Results of Segments -The following snippet shows how we can assign a value to a declared [result][results] of a [step][steps]: +The following snippet shows how we can assign a value to a declared [result][results] of a [segment][segments]: ```txt -step trulyRandomInt() -> result: Int { +segment trulyRandomInt() -> result: Int { yield result = 1; } ``` @@ -77,14 +77,14 @@ step trulyRandomInt() -> result: Int { The assignment here has the following syntactic elements: - The keyword `yield`, which indicates that we want to assign to a result. -- The name of the result, here `greeting`. This must be identical to one of the names of a declared result in the header of the step. +- The name of the result, here `greeting`. This must be identical to one of the names of a declared result in the header of the segment. - An `=` sign. - The expression to evaluate (right-hand side). - A semicolon at the end. #### Declare Results of Block Lambdas -Similar syntax is used to yield results of [block lambdas][block-lambdas]. The difference to steps is that block lambdas do not declare their results in their header. Instead the results are declared within the assignments, just like [placeholders](#declaring-placeholders). The block lambda in the following snippet has a single result called `greeting`, which gets the value `"Hello, world!"`: +Similar syntax is used to yield results of [block lambdas][block-lambdas]. The difference to segments is that block lambdas do not declare their results in their header. Instead the results are declared within the assignments, just like [placeholders](#declaring-placeholders). The block lambda in the following snippet has a single result called `greeting`, which gets the value `"Hello, world!"`: ```txt () -> { @@ -115,7 +115,7 @@ So far, the left-hand side of the assignment always had a single assignee. Howev For example, the `split` method in the next example splits a large dataset into two datasets according to a given ratio. We then ignore the first dataset using a [wildcard](#ignoring-results) and [assign the second result to a placeholder](#declaring-placeholders) called `trainingDataset`. Afterwards, we train a `DecisionTree` using the `trainingDataset` and yield the trained model as a result: ```txt -step createModel(fullDataset: Dataset) -> trainedModel: Model { +segment createModel(fullDataset: Dataset) -> trainedModel: Model { _, val trainingDataset = fullDataset.split(0.2); yield trainedModel = DecisionTree().fit(trainingDataset); } @@ -142,5 +142,5 @@ Assignment happens by index, so the first result is assigned to the first assign [block-lambdas]: expressions.md#block-lambdas [calls]: expressions.md#calls [references]: expressions.md#references -[steps]: steps.md +[segments]: segments.md [pipelines]: pipelines.md diff --git a/docs/language/pipeline-language/steps.md b/docs/language/pipeline-language/steps.md deleted file mode 100644 index c2b3926e4..000000000 --- a/docs/language/pipeline-language/steps.md +++ /dev/null @@ -1,136 +0,0 @@ -# Steps - -Steps are used to extract a sequence of [statements][statements] from a data science program to give the sequence a name and make it reusable. In the following discussion we explain how to [declare a step](#declaring-a-step) and how to [call it](#calling-a-step). - -## Declaring a Step - -### Minimal Example - -Let's look at a minimal example of a step: - -```txt -step loadMovieRatingsSample() {} -``` - -This declaration of a step has the following syntactic elements: - -- The keyword `step`. -- The name of the step, here `loadMovieRatingsSample`. This can be any combination of upper- and lowercase letters, underscores, and numbers, as long as it does not start with a number. However, we suggest to use `lowerCamelCase` for the names of steps. -- The list of parameters (i.e. inputs) of the step. This is delimited by parentheses. In the example above, the step has no parameters. -- The _body_ of the step, which contains the [statements][statements] that should be run when the step is [called](#calling-a-step). The body is delimited by curly braces. In this example, the body is empty, so running this step does nothing. - -### Parameters - -To make a step configurable, add [parameters][parameters] (inputs). We will first show how to [declare parameters](#parameter-declaration) and afterwards how to [refer to them](#references-to-parameters) in the body of the step. - -#### Parameter Declaration - -Parameters must be declared in the header of the step so [callers](#calling-a-step) know they are expected to pass them as an argument, and so we can [use them](#references-to-parameters) in the body of the step. - -In the following example, we give the step a single parameters with name `nInstances` and [type][types] `Int`. - -```txt -step loadMovieRatingsSample(nInstances: Int) {} -``` - -More information about parameters can be found in the [linked document][parameters]. - -#### References to Parameters - -Within the step we can access the value of a parameter using a [reference][references]. Here is a basic example where we print the value of the `nInstances` parameter to the console: - -```txt -step loadMovieRatingsSample(nInstances: Int) { - print(nInstances); -} -``` - -More information about references can be found in the [linked document][references]. - -### Statements - -In order to describe what should be done when the step is executed, we need to add [statements][statements] to its body. The previous example in the section ["References to Parameters"](#references-to-parameters) already contained a statement - an [expression statement][expression-statements] to be precise. Here is another example, this time showing an [assignment][assignments]: - -```txt -step loadMovieRatingsSample(nInstances: Int) { - val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); -} -``` - -More information about statements can be found in the [linked document][statements]. Note particularly, that all statements must end with a semicolon. - -### Results - -[Results][results] (outputs) are used to return values that are produced inside the step back to the caller. First, we show how to [declare the available results](#result-declaration) of the step and then how to [assign a value to them](#assigning-to-results). - -#### Result Declaration - -As with [parameters](#parameters) we first need to declare the available results in the headed. This tells [callers](#calling-a-step) that they can use these results and reminds us to [assign a value to them](#assigning-to-results) in the body of the step. Let's look at an example: - -```txt -step loadMovieRatingsSample(nInstances: Int) -> (features: Dataset, target: Dataset) { - val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); -} -``` - -We added two results to the step: The first one is called `features` and has type `Dataset`, while the second one is called `target` and also has type `Dataset`. - -More information about the declaration of results can be found in the [linked document][results]. - -#### Assigning to Results - -Currently, the program will not compile since we never assigned a value to these results. This can be done with an [assignment][assignments] and the `yield` keyword: - -```txt -step loadMovieRatingsSample(nInstances: Int) -> (features: Dataset, target: Dataset) { - val movieRatingsSample = loadDataset("movieRatings").sample(nInstances = 1000); - yield features = movieRatingsSample.keepAttributes( - "leadingActor", - "genre", - "length" - ); - yield target = movieRatingsSample.keepAttributes( - "rating" - ); -} -``` - -In the assignment beginning with `yield features =` we specify the value of the result called `features`, while the next assignment beginning with `yield target =` assigns a value to the `target` result. - -The order of the [result declarations](#result-declaration) does not need to match the order of assignment. However, **each result musts be assigned exactly once**. Note that unlike the `return` in other programming languages, `yield` does not stop the execution of the step, which allows [assignments][assignments] to different results to be split across multiple [statements][statements]. - -## Visibility - -By default, a step can be [imported][imports] in any other file and reused there. We say they have `public` visibility. However, it is possible to restrict the visibility of a step with modifiers: - -```txt -internal step internalStep() {} - -private step privateStep() {} -``` - -The step `internalStep` is only visible in files with the same [package][packages]. The step `privateStep` is only visible in the file it is declared in. - -## Calling a Step - -Inside a [pipeline][pipelines], another step, or a [lambda][lambdas] we can then [call][calls] a step, which means the step is executed when the call is reached: The results of a step can then be used as needed. In the following example, where we call the step `loadMovieRatingsSample` that we defined above, we [assign the results to placeholders][assignments-to-placeholders]: - -```txt -val features, val target = loadMovieRatingsSample(nInstances = 1000); -``` - -More information about calls can be found in the [linked document][calls]. - -[imports]: ../common/imports.md -[parameters]: ../common/parameters.md -[results]: ../common/results.md -[types]: ../common/types.md -[packages]: ../common/packages.md -[statements]: statements.md -[assignments]: statements.md#assignments -[assignments-to-placeholders]: statements.md#assigning-placeholders -[expression-statements]: statements.md#expression-statements -[calls]: expressions.md#calls -[lambdas]: expressions.md#lambdas -[references]: expressions.md#references -[pipelines]: pipelines.md diff --git a/docs/language/stub-language/annotations.md b/docs/language/stub-language/annotations.md index 25aefe288..c65e0a7a8 100644 --- a/docs/language/stub-language/annotations.md +++ b/docs/language/stub-language/annotations.md @@ -1,6 +1,6 @@ # Annotations -Annotations attach additional metainformation to declarations. Annotations must first be [declared](#declaring-an-annotation), so Safe-DS knows the annotation exists and which inputs are expected. Afterwards, annotations can be [called](#calling-an-annotation), which is the step that truly attaches metainformation to declarations. +Annotations attach additional metainformation to declarations. Annotations must first be [declared](#declaring-an-annotation), so Safe-DS knows the annotation exists and which inputs are expected. Afterwards, annotations can be [called](#calling-an-annotation), which is the segment that truly attaches metainformation to declarations. ## Declaring an Annotation @@ -49,7 +49,7 @@ To attach metainformation to a declaration, the annotation must be called on tha - [Global functions][global-functions] / [methods][methods] - [Parameters][parameters] - [Results][results] -- [Steps][steps] +- [Segments][segments] - [Type parameters][type-parameters] - [Pipelines][pipelines] @@ -101,7 +101,7 @@ The package `safeds.lang` contains several annotations that are processed by Saf [global-functions]: global-functions.md [methods]: classes.md#defining-methods [results]: ../common/parameters.md -[steps]: ../pipeline-language/steps.md +[segments]: ../pipeline-language/segments.md [type-parameters]: type-parameters.md [pipelines]: ../pipeline-language/pipelines.md [safeds-lang]: ../../stdlib/safeds_lang.md diff --git a/docs/stdlib/safeds_lang.md b/docs/stdlib/safeds_lang.md index 0bf975390..4f98b5827 100644 --- a/docs/stdlib/safeds_lang.md +++ b/docs/stdlib/safeds_lang.md @@ -118,8 +118,8 @@ The annotation can be called on results. **Parameters:** _None expected._ -### Enum Variant `Step` -The annotation can be called on steps. +### Enum Variant `Segment` +The annotation can be called on segments. **Parameters:** _None expected._ @@ -158,7 +158,7 @@ The declaration should no longer be used. * Function * Parameter * Result -* Step +* Segment * TypeParameter ## Annotation `Description` @@ -180,7 +180,7 @@ The purpose of a declaration. * Parameter * Pipeline * Result -* Step +* Segment * TypeParameter ## Annotation `Experimental` @@ -196,7 +196,7 @@ The declaration might change without a major version bump. * Function * Parameter * Result -* Step +* Segment * TypeParameter ## Annotation `Expert` @@ -247,7 +247,7 @@ The name of the corresponding API element in Python (default is the name of the * Function * Parameter * Pipeline -* Step +* Segment ## Annotation `Repeatable` The annotation can be called multiple times for the same declaration. @@ -275,7 +275,7 @@ The version in which a declaration was added. * Parameter * Pipeline * Result -* Step +* Segment * TypeParameter ## Annotation `Target` @@ -288,4 +288,3 @@ The annotation can target these declaration types. If the @Target annotation is **Valid targets:** * Annotation - diff --git a/mkdocs.yml b/mkdocs.yml index 2138381a0..6ccfa4e9e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -10,7 +10,7 @@ nav: - Pipeline Language: - language/pipeline-language/README.md - Pipelines: language/pipeline-language/pipelines.md - - Steps: language/pipeline-language/steps.md + - Segments: language/pipeline-language/segments.md - Statements: language/pipeline-language/statements.md - Expressions: language/pipeline-language/expressions.md - Common: @@ -34,6 +34,7 @@ nav: - safeds.lang: stdlib/safeds_lang.md - Development: - Grammar Testing: development/grammar-testing.md + - Formatting Testing: development/formatting-testing.md # Configuration of MkDocs & Material for MkDocs --------------------------------