Skip to content

Commit

Permalink
refactor: add SdsObject super-interface again
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Sep 6, 2023
1 parent c8e067e commit e44cf2b
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions src/language/grammar/safe-ds.langium
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ grammar SafeDs
// Base interfaces
// -----------------------------------------------------------------------------

interface SdsAnnotatedObject {
interface SdsObject {}

interface SdsAnnotatedObject extends SdsObject {
annotationCalls?: SdsAnnotationCall[]
}

interface SdsAbstractCall {
interface SdsAbstractCall extends SdsObject {
argumentList: SdsArgumentList
}

Expand Down Expand Up @@ -45,7 +47,7 @@ entry SdsModule returns SdsModule:
)?
;

interface SdsImport {
interface SdsImport extends SdsObject {
importedNamespace: string;
alias?: SdsImportAlias;
}
Expand All @@ -56,7 +58,7 @@ SdsImport returns SdsImport:
alias=SdsImportAlias?
;

interface SdsImportAlias {
interface SdsImportAlias extends SdsObject {
name: string;
}

Expand Down Expand Up @@ -156,7 +158,7 @@ fragment SdsClassFragment:
body=SdsClassBody?
;

interface SdsParentTypeList {
interface SdsParentTypeList extends SdsObject {
parentTypes: SdsType[]
}

Expand All @@ -167,7 +169,7 @@ SdsParentTypeList returns SdsParentTypeList:
','?
;

interface SdsClassBody {
interface SdsClassBody extends SdsObject {
members: SdsAnnotatedObject[]
}

Expand Down Expand Up @@ -238,7 +240,7 @@ fragment SdsEnumFragment:
body=SdsEnumBody?
;

interface SdsEnumBody {
interface SdsEnumBody extends SdsObject {
variants: SdsEnumVariant[]
}

Expand Down Expand Up @@ -328,7 +330,7 @@ SdsAnnotationCallArgument returns SdsArgument:
// Constraints
// -----------------------------------------------------------------------------

interface SdsConstraintList {
interface SdsConstraintList extends SdsObject {
constraints: SdsConstraint[]
}

Expand All @@ -343,7 +345,7 @@ SdsConstraintList returns SdsConstraintList:
'}'
;

interface SdsConstraint {}
interface SdsConstraint extends SdsObject {}

SdsConstraint returns SdsConstraint:
SdsTypeParameterConstraint
Expand All @@ -370,11 +372,11 @@ SdsTypeParameterConstraintOperator returns string:
// Callables, parameters, and results
// -----------------------------------------------------------------------------

interface SdsCallable {
interface SdsCallable extends SdsObject {
parameterList: SdsParameterList
}

interface SdsParameterList {
interface SdsParameterList extends SdsObject {
parameters: SdsParameter[]
}

Expand Down Expand Up @@ -416,7 +418,7 @@ SdsParameter returns SdsParameter:
('=' defaultValue=SdsExpression)?
;

interface SdsResultList {
interface SdsResultList extends SdsObject {
results: SdsResult[]
}

Expand All @@ -442,9 +444,9 @@ SdsResult returns SdsResult:
// Statements
// -----------------------------------------------------------------------------

interface SdsStatement {}
interface SdsStatement extends SdsObject {}

interface SdsBlock {
interface SdsBlock extends SdsObject {
statements: SdsStatement[]
}

Expand All @@ -466,15 +468,15 @@ SdsAssignment returns SdsAssignment:
assigneeList=SdsAssigneeList '=' expression=SdsExpression ';'
;

interface SdsAssigneeList {
interface SdsAssigneeList extends SdsObject {
assignees: SdsAssignee[]
}

SdsAssigneeList returns SdsAssigneeList:
assignees+=SdsAssignee (',' assignees+=SdsAssignee )* ','?
;

interface SdsAssignee {}
interface SdsAssignee extends SdsObject {}

interface SdsPlaceholder extends SdsAssignee, SdsLocalVariable {}

Expand Down Expand Up @@ -503,7 +505,7 @@ SdsExpressionStatement returns SdsExpressionStatement:
// Expressions
// -----------------------------------------------------------------------------

interface SdsExpression {}
interface SdsExpression extends SdsObject {}

SdsExpression returns SdsExpression:
SdsLambda | SdsOrExpression
Expand Down Expand Up @@ -685,7 +687,7 @@ SdsChainedExpression returns SdsExpression:
)*
;

interface SdsArgumentList {
interface SdsArgumentList extends SdsObject {
arguments: SdsArgument[]
}

Expand Down Expand Up @@ -824,7 +826,7 @@ SdsTemplateStringEnd returns SdsExpression:
// Types
// -----------------------------------------------------------------------------

interface SdsType {}
interface SdsType extends SdsObject {}

interface SdsNamedTypeDeclaration extends SdsDeclaration {}

Expand Down Expand Up @@ -861,7 +863,7 @@ SdsLiteralType returns SdsLiteralType:
'literal' literalList=SdsLiteralList
;

interface SdsLiteralList {
interface SdsLiteralList extends SdsObject {
literals: SdsLiteral[]
}

Expand Down Expand Up @@ -919,7 +921,7 @@ SdsParentType returns SdsType:
SdsNamedType ({SdsMemberType.receiver=current} '.' member=SdsNamedType)*
;

interface SdsTypeParameterList {
interface SdsTypeParameterList extends SdsObject {
typeParameters: SdsTypeParameter[]
}

Expand Down Expand Up @@ -948,7 +950,7 @@ SdsTypeParameterVariance returns string:
'in' | 'out'
;

interface SdsTypeArgumentList {
interface SdsTypeArgumentList extends SdsObject {
typeArguments: SdsTypeArgument[]
}

Expand All @@ -966,7 +968,7 @@ SdsCallTypeArgumentList returns SdsTypeArgumentList:
'>'
;

interface SdsTypeArgument {
interface SdsTypeArgument extends SdsObject {
typeParameter?: @SdsTypeParameter
value: SdsTypeArgumentValue
}
Expand All @@ -976,7 +978,7 @@ SdsTypeArgument returns SdsTypeArgument:
value=SdsTypeArgumentValue
;

interface SdsTypeArgumentValue {}
interface SdsTypeArgumentValue extends SdsObject {}

interface SdsStarProjection extends SdsTypeArgumentValue {}

Expand Down Expand Up @@ -1005,15 +1007,15 @@ fragment SdsSchemaFragment:
columnList=SdsColumnList
;

interface SdsColumnList {
interface SdsColumnList extends SdsObject {
columns: SdsColumn[]
}

SdsColumnList returns SdsColumnList:
{SdsColumnList} '{' (columns+=SdsColumn (',' columns+=SdsColumn )* ','? )? '}'
;

interface SdsColumn {
interface SdsColumn extends SdsObject {
columnName: SdsString
columnType: SdsType
}
Expand Down

0 comments on commit e44cf2b

Please sign in to comment.