Skip to content

Commit

Permalink
Merge branch 'move-usable-expr' into 'dev'
Browse files Browse the repository at this point in the history
remove ExtType extension points

See merge request monticore/monticore!905
  • Loading branch information
SE-FDr committed Jan 11, 2024
2 parents 3cc1324 + 917749b commit af2d5d7
Show file tree
Hide file tree
Showing 28 changed files with 123 additions and 2,499 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ component grammar JavaLight extends AssignmentExpressions,
MCArrayStatements,
MCReturnStatements {

external ExtTypeParameters;

interface ClassBodyDeclaration;

interface InterfaceBodyDeclaration;
Expand All @@ -47,12 +45,12 @@ symbolrule JavaMethod =
isDefault: boolean;

MethodDeclaration implements JavaMethod, ClassBodyDeclaration, InterfaceBodyDeclaration
= MCModifier* ExtTypeParameters?
= MCModifier* ("<"(MCTypeArgument||",")+">")?
MCReturnType Name FormalParameters (dim:"[" "]")*
("throws" Throws)? (MCJavaBlock | ";");

ConstructorDeclaration implements JavaMethod, ClassBodyDeclaration
= MCModifier* ExtTypeParameters? Name FormalParameters
= MCModifier* ("<"(MCTypeArgument||",")+">")? Name FormalParameters
("throws" Throws)? MCJavaBlock;

ConstDeclaration extends LocalVariableDeclarationStatement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package de.monticore.expressions;

import de.monticore.expressions.*;
import de.monticore.statements.*;
import de.monticore.types.*;

/**
* This grammar defines Java specific class expressions like super,
Expand Down Expand Up @@ -35,26 +36,9 @@ import de.monticore.statements.*;
*/

component grammar JavaClassExpressions
extends CommonExpressions, MCVarDeclarationStatements {


/*=================================================================*/

/*
* The following are several extension points that allow to fill in the
* the desired type system:
* e.g. the complete type system of java (extending MCFullGenericType)
* or any smaller variant
*/

// Types
external ExtType;

// Types including a void return type
external ExtReturnType;

// Type arguments
external ExtTypeArgument;
extends CommonExpressions,
MCVarDeclarationStatements,
MCFullGenericTypes {

/*=================================================================*/

Expand All @@ -75,7 +59,7 @@ component grammar JavaClassExpressions

// casting expression uses a type
TypeCastExpression implements Expression <230> =
"(" ExtType ")" Expression;
"(" MCType ")" Expression;

PrimarySuperExpression implements Expression <330> =
"super";
Expand All @@ -86,10 +70,10 @@ component grammar JavaClassExpressions
interface Creator ;

AnonymousClass implements Creator
= ExtType Arguments;
= MCType Arguments;

ArrayCreator implements Creator
= ExtType ArrayDimensionSpecifier;
= MCType ArrayDimensionSpecifier;

interface ArrayDimensionSpecifier ;

Expand All @@ -101,11 +85,11 @@ component grammar JavaClassExpressions

// access of class object uses a type
ClassExpression implements Expression <360> =
ExtReturnType "." "class";
MCReturnType "." "class";

// generic invocation may specify type arguments
PrimaryGenericInvocationExpression implements Expression <370> =
"<"(ExtTypeArgument||",")+">" GenericInvocationSuffix;
"<"(MCTypeArgument||",")+">" GenericInvocationSuffix;

GenericInvocationSuffix
= ["super"] SuperSuffix
Expand All @@ -115,14 +99,14 @@ component grammar JavaClassExpressions

SuperSuffix
= Arguments
| "." ("<"(ExtTypeArgument||",")+">")? Name Arguments?
| "." ("<"(MCTypeArgument||",")+">")? Name Arguments?
;

/*=================================================================*/

// instance of needs a type or pattern as argument
InstanceofExpression implements Expression <140> =
Expression "instanceof" (ExtType | Pattern);
Expression "instanceof" (MCType | Pattern);

interface Pattern;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ mlc JavaClassExpressions {

promote {
mlc "de.monticore.expressions.CommonExpressions";
mlc "de.monticore.types.MCFullGenericTypes"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,4 @@ grammar Grammar_WithConcepts extends

JavaCode = ClassBodyDeclaration*;

ExtType = MCType;

ExtReturnType = MCReturnType;

ExtTypeArgument = "<" (MCTypeArgument || ",")+ ">"*;

// Empty TypeParameters
ExtTypeParameters = ;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,5 @@ package de.monticore.tf;
component grammar TFBasisExts extends de.monticore.JavaLight,
de.monticore.types.MCSimpleGenericTypes,
de.monticore.literals.MCCommonLiterals {
@Override
ExtType = MCType;
@Override
ExtReturnType = MCReturnType;
@Override
ExtTypeArgument = MCTypeArgument;
@Override
ExtTypeParameters = MCType;

}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit af2d5d7

Please sign in to comment.