Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ assertj_version = 3.21.0
junit_version = 5.8.2

# Version of published artifacts
version = 7.8.97
version = 7.8.98
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import de.monticore.lang.sysmlv2._lsp.LanguageServerCLI;

import de.monticore.lang.sysmlbasis._symboltable.SysMLBasisScope;
import de.monticore.lang.sysmlbasis._symboltable.SysMLTypeSymbol;
import de.monticore.lang.sysmlbasis._symboltable.SysMLDefinitionSymbol;
import de.monticore.lang.sysmlparts._ast.ASTPartDef;
import de.monticore.lang.sysmlv2._symboltable.ISysMLv2Scope;
import org.eclipse.lsp4j.*;
Expand Down Expand Up @@ -68,10 +68,10 @@ public List<CodeAction> createFixesFor(TextDocumentItem document, Diagnostic dia
return res;
}

private static void traverse(ISysMLv2Scope scope, Consumer<SysMLTypeSymbol> f) {
private static void traverse(ISysMLv2Scope scope, Consumer<SysMLDefinitionSymbol> f) {
if (scope != null) {
if (scope instanceof SysMLBasisScope) {
scope.getSysMLTypeSymbols().entries().forEach(entry -> f.accept(entry.getValue()));
scope.getSysMLDefinitionSymbols().entries().forEach(entry -> f.accept(entry.getValue()));
}
scope.getSubScopes().forEach(s -> traverse(s, f));
}
Expand Down
4 changes: 2 additions & 2 deletions language/src/main/grammars/de/monticore/lang/SysMLActions.mc4
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package de.monticore.lang;
component grammar SysMLActions
extends de.monticore.lang.SysMLBasis {

symbol scope ActionDef implements SysMLType =
symbol scope ActionDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "action" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand Down Expand Up @@ -218,7 +218,7 @@ component grammar SysMLActions
* Calculations
* ================================================================================================================ */

symbol scope CalcDef implements SysMLType =
symbol scope CalcDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "calc" "def" Name SysMLCardinality? Specialization*
("{"
SysMLElement*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ component grammar SysMLBasis
interface SysMLElement;

/** Element mit eigenem Symbol für resolve (zB. für ReqDef) */
interface symbol SysMLType extends SysMLElement;
interface symbol SysMLDefinition extends SysMLElement;

SysMLCardinality =
Cardinality (["ordered"] | ["nonunique"])* | (["ordered"] | ["nonunique"])+;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ component grammar SysMLConstraints
extends SysMLBasis,
SysMLActions {

symbol scope ConstraintDef implements SysMLType =
symbol scope ConstraintDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "constraint" "def"
Name SysMLCardinality? Specialization* ("(" (SysMLParameter || ",")* ")")?
("{"
Expand Down Expand Up @@ -36,7 +36,7 @@ component grammar SysMLConstraints
Expression?
"}" | ";") ;

symbol scope RequirementDef implements SysMLType =
symbol scope RequirementDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "requirement" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("(" (SysMLParameter || ",")* ")")?
Expand Down Expand Up @@ -107,7 +107,7 @@ component grammar SysMLConstraints
SysMLElement*
"}" | ";") ;

symbol scope ConcernDef implements SysMLType =
symbol scope ConcernDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "concern" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("(" (SysMLParameter || ",")* ")")?
Expand Down
38 changes: 19 additions & 19 deletions language/src/main/grammars/de/monticore/lang/SysMLParts.mc4
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ component grammar SysMLParts
* ##################################################################
*/

symbol scope PartDef implements SysMLType =
symbol scope PartDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "part" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -32,14 +32,14 @@ component grammar SysMLParts
directRefinements:de.monticore.types.check.SymTypeExpression*
requirementType:SysMLReqType;

symbol scope AttributeDef implements SysMLType =
symbol scope AttributeDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "attribute" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
SysMLElement*
"}" | ";") ;

symbol scope EnumDef implements SysMLType =
symbol scope EnumDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "enum" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -62,7 +62,7 @@ component grammar SysMLParts
SysMLElement*
"}" | ";") ;

symbol scope PortDef implements SysMLType =
symbol scope PortDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "port" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand Down Expand Up @@ -218,7 +218,7 @@ component grammar SysMLParts
SysMLElement*
"}" | ";") ;

symbol scope ConnectionDef implements SysMLType =
symbol scope ConnectionDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "connection" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -240,7 +240,7 @@ component grammar SysMLParts
* interface usage are restricted to be port usages.
* ================================================================================================================ */

symbol scope InterfaceDef implements SysMLType =
symbol scope InterfaceDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "interface" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("(" (SysMLParameter || ",")* ")")?
Expand All @@ -259,7 +259,7 @@ component grammar SysMLParts
SysMLElement*
"}" | ";") ;

symbol scope FlowDef implements SysMLType =
symbol scope FlowDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "flow" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -271,7 +271,7 @@ component grammar SysMLParts
* Allocations
* ================================================================================================================ */

symbol scope AllocationDef implements SysMLType =
symbol scope AllocationDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "allocation" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand Down Expand Up @@ -307,7 +307,7 @@ component grammar SysMLParts
* OCCURRENCES
* ##################################################################
*/
symbol scope OccurrenceDef implements SysMLType =
symbol scope OccurrenceDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "occurrence" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -329,7 +329,7 @@ component grammar SysMLParts
"}" | ";") ;

// IndividualUsages are parsed as AnonymousReferences with Modifier UserDefinedKeyword* "individual"
symbol scope IndividualDef implements SysMLType =
symbol scope IndividualDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "individual" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -342,7 +342,7 @@ component grammar SysMLParts
* more item definitions.
* ================================================================================================================ */

symbol scope ItemDef implements SysMLType =
symbol scope ItemDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "item" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("(" (SysMLParameter || ",")* ")")?
Expand Down Expand Up @@ -379,7 +379,7 @@ component grammar SysMLParts
* regard (i.e., having an Expression), they are not explicitly related.
*/

symbol scope AnalysisDef implements SysMLType =
symbol scope AnalysisDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "analysis" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -401,7 +401,7 @@ component grammar SysMLParts
Expression?
"}" | ";") ;

symbol scope VerificationDef implements SysMLType =
symbol scope VerificationDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "verification" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -417,7 +417,7 @@ component grammar SysMLParts
Expression?
"}" | ";") ;

symbol scope UseCaseDef implements SysMLType =
symbol scope UseCaseDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "use" "case" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand Down Expand Up @@ -454,7 +454,7 @@ component grammar SysMLParts
Expression?
"}" | ";") ;

symbol scope CaseDef implements SysMLType =
symbol scope CaseDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "case" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand Down Expand Up @@ -515,7 +515,7 @@ component grammar SysMLParts
* Metadata is additional data that can be used to annotate
* the elements of a model.
*/
symbol scope SysMLMetaDataDefinition implements SysMLType, SysMLElement =
symbol scope SysMLMetaDataDefinition implements SysMLDefinition, SysMLElement =
Modifier UserDefinedKeyword* "metadata" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -539,7 +539,7 @@ component grammar SysMLParts
* Viewpoints
* ======================================================================== */

symbol scope ViewpointDef implements SysMLType =
symbol scope ViewpointDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "viewpoint" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand All @@ -557,7 +557,7 @@ component grammar SysMLParts
* Views
* ======================================================================== */

symbol scope ViewDef implements SysMLType =
symbol scope ViewDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "view" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand Down Expand Up @@ -589,7 +589,7 @@ component grammar SysMLParts
* Renderings
* ======================================================================== */

symbol scope RenderingDef implements SysMLType =
symbol scope RenderingDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "rendering" "def"
SysMLIdentifier? Name SysMLCardinality? Specialization*
("{"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package de.monticore.lang;

component grammar SysMLStates extends SysMLActions {

symbol scope StateDef implements SysMLType =
symbol scope StateDef implements SysMLDefinition =
Modifier UserDefinedKeyword* "state" "def" SysMLIdentifier? Name
SysMLCardinality? Specialization* ("(" (SysMLParameter || ",")* ")")?
("{"
Expand Down
2 changes: 1 addition & 1 deletion language/src/main/grammars/de/monticore/lang/SysMLv2.mc4
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ grammar SysMLv2 extends SysMLExpressions,
* A user-defined keyword for semantic metadata may also be used to declare a
* definition or usage without using any language-defined keyword.
*/
symbol scope UserDefinedDefinition implements SysMLType =
symbol scope UserDefinedDefinition implements SysMLDefinition =
Modifier UserDefinedKeyword+ "def" Name SysMLCardinality? Specialization*
("{"
SysMLElement*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import de.monticore.ast.ASTNode;
import de.monticore.lang.sysmlbasis._ast.ASTSysMLRefinement;
import de.monticore.lang.sysmlbasis._symboltable.SysMLTypeSymbol;
import de.monticore.lang.sysmlbasis._symboltable.SysMLDefinitionSymbol;
import de.monticore.lang.sysmlparts._ast.ASTPartDef;
import de.monticore.lang.sysmlparts._cocos.SysMLPartsASTPartDefCoCo;
import de.monticore.lang.sysmlv2.SysMLv2Mill;
Expand All @@ -24,7 +24,7 @@ public void check(ASTPartDef node) {
var refinements = node.getSymbol().getTransitiveRefinements();

var cyclicRefinements = refiners.stream().filter(refinements::contains)
.map(SysMLTypeSymbol::getName)
.map(SysMLDefinitionSymbol::getName)
.collect(Collectors.toList());
var pos = node.get_SourcePositionStart();

Expand Down
6 changes: 3 additions & 3 deletions language/src/test/java/symboltable/SerializationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package symboltable;

import de.monticore.io.paths.MCPath;
import de.monticore.lang.sysmlbasis._symboltable.SysMLTypeSymbol;
import de.monticore.lang.sysmlbasis._symboltable.SysMLDefinitionSymbol;
import de.monticore.lang.sysmlparts._symboltable.PartDefSymbol;
import de.monticore.lang.sysmlparts._symboltable.PortDefSymbol;
import de.monticore.lang.sysmlparts._symboltable.PortUsageSymbol;
Expand Down Expand Up @@ -158,7 +158,7 @@ public void loadSymbolTableAndResolve(
// check inter-model resolution of fqn from the package scope of the reference artifact.
Assertions.assertThat(artifactScope.getSubScopes()).isNotEmpty();
ISysMLv2Scope packageScope = artifactScope.getSubScopes().get(0);
Optional<SysMLTypeSymbol> resolved = packageScope.resolveSysMLType(fqnSymbol);
Optional<SysMLDefinitionSymbol> resolved = packageScope.resolveSysMLDefinition(fqnSymbol);
assertThat(resolved).isPresent();

if(resolved.get() instanceof PortDefSymbol) {
Expand All @@ -168,7 +168,7 @@ public void loadSymbolTableAndResolve(
}

// resolution of relative symbols does not work if symbol is in another artifact scope (i.e. top-down resolution is required).
Optional<SysMLTypeSymbol> relativeResolved = packageScope.resolveSysMLType(relativeSymbol);
Optional<SysMLDefinitionSymbol> relativeResolved = packageScope.resolveSysMLDefinition(relativeSymbol);
assertThat(relativeResolved).isEmpty();
}

Expand Down
Loading