Skip to content

Commit 4e06b1a

Browse files
v4.0.7
1 parent d4f1dc3 commit 4e06b1a

19 files changed

Lines changed: 185 additions & 155 deletions

File tree

build.gradle.kts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
1616
* - also set the value standalone according to your setup
1717
*/
1818
group = "com.github.tukcps"
19-
version = "4.0.6" // must be number.number.number
19+
version = "4.0.7" // must be number.number.number
2020
val aaddVersion = "0.1.11"
2121
val sysmlapiVersion = "3.9.4"
2222
val useMavenAADD = true
@@ -32,12 +32,12 @@ if (JavaVersion.current() < JavaVersion.VERSION_21) {
3232

3333
// Plugins needed: id and versions.
3434
plugins {
35-
// Plugin that checks for updates:
35+
// Plugin that checks for updates of dependencies
3636
id("com.github.ben-manes.versions") version "0.52.0"
3737
id("idea")
38-
kotlin("jvm") version "2.1.20"
39-
kotlin("plugin.serialization") version "2.1.20"
40-
id("org.springframework.boot") version "3.5.0"
38+
kotlin("jvm") version "2.2.0"
39+
kotlin("plugin.serialization") version "2.2.0"
40+
id("org.springframework.boot") version "3.5.3"
4141
id("io.spring.dependency-management") version "1.1.7"
4242
alias(libs.plugins.jetbrainsCompose) apply true
4343
alias(libs.plugins.compose.compiler) apply true
@@ -81,27 +81,27 @@ dependencies {
8181
// For UUID version 5 (name-based)
8282
implementation("com.fasterxml.uuid:java-uuid-generator:5.1.0")
8383

84-
implementation("org.jetbrains.compose.material3:material3-desktop:1.8.1")
84+
implementation("org.jetbrains.compose.material3:material3-desktop:1.8.2")
8585

8686
// These are necessary for the annotations in the models.
8787
implementation("org.springframework.boot:spring-boot-starter-web")
88-
implementation("org.hibernate.validator:hibernate-validator:8.0.2.Final")
88+
implementation("org.hibernate.validator:hibernate-validator:9.0.1.Final")
8989

9090
// Open API / Swagger
91-
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.8")
91+
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.9")
9292

9393
// Needed for annotations for Spring Boot in package rest
9494
implementation("com.fasterxml.jackson.core:jackson-databind")
9595
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
9696
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
9797

9898
// Parsing markdown to AST
99-
implementation("org.commonmark:commonmark:0.24.0")
100-
implementation("org.commonmark:commonmark-ext-gfm-tables:0.24.0")
101-
implementation("org.commonmark:commonmark-ext-image-attributes:0.24.0")
102-
implementation("org.commonmark:commonmark-ext-yaml-front-matter:0.24.0")
103-
implementation("org.commonmark:commonmark-ext-gfm-strikethrough:0.24.0")
104-
implementation("org.commonmark:commonmark-ext-ins:0.24.0")
99+
implementation("org.commonmark:commonmark:0.25.0")
100+
implementation("org.commonmark:commonmark-ext-gfm-tables:0.25.0")
101+
implementation("org.commonmark:commonmark-ext-image-attributes:0.25.0")
102+
implementation("org.commonmark:commonmark-ext-yaml-front-matter:0.25.0")
103+
implementation("org.commonmark:commonmark-ext-gfm-strikethrough:0.25.0")
104+
implementation("org.commonmark:commonmark-ext-ins:0.25.0")
105105

106106
// Some more icons ...
107107
implementation(compose.components.resources)
@@ -114,15 +114,14 @@ dependencies {
114114
// Needed for state diagrams (HOOD GmbH)
115115
implementation("org.diagramsascode:diagramsascode-image:0.1.5")
116116
implementation("org.apache.xmlgraphics:batik-transcoder:1.19")
117-
implementation("org.apache.xmlgraphics:batik-codec:1.18")
117+
implementation("org.apache.xmlgraphics:batik-codec:1.19")
118118

119119
// Use the Kotlin JUnit integration.
120-
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5:2.1.10")
121-
testImplementation(platform("org.junit:junit-bom:5.12.0"))
120+
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5:2.2.0")
122121

123122
// compose ui tests
124123
testImplementation(kotlin("test"))
125-
testImplementation("org.springframework.boot:spring-boot-starter-test:3.5.0") {
124+
testImplementation("org.springframework.boot:spring-boot-starter-test:3.5.3") {
126125
exclude(group = "org.mockito", module = "mockito-core")
127126
}
128127

@@ -156,12 +155,12 @@ tasks.test {
156155
// Generate Bytecode for v17
157156
kotlin {
158157
compilerOptions {
159-
jvmTarget.set(JvmTarget.JVM_17)
158+
jvmTarget.set(JvmTarget.JVM_21)
160159
}
161160
}
162161

163162
tasks.withType<JavaCompile> {
164-
options.release.set(17)
163+
options.release.set(21)
165164
}
166165

167166
/**

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
2-
kotlin = "2.1.20"
3-
compose-plugin = "1.8.1"
2+
kotlin = "2.2.0"
3+
compose-plugin = "1.8.2"
44

55
[plugins]
66
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }

src/main/kotlin/com/github/tukcps/sysmd/compiler/parser/kerml/KerMLCore.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import com.github.tukcps.sysmd.exceptions.SyntaxError
1111
import com.github.tukcps.sysmd.model.kerml.*
1212
import com.github.tukcps.sysmd.model.kerml.implementation.*
1313
import com.github.tukcps.sysmd.model.util.QualifiedName
14+
import com.github.tukcps.sysmd.settings
1415
import io.github.tukcps.aadd.values.IntegerRange
1516

1617
/**
@@ -68,7 +69,7 @@ fun KerML.Type() {
6869
}
6970

7071
/**
71-
* TypeDeclaration = ( 'all' )? Identification ( OwnedMultiplicity )?
72+
* TypeDeclaration = ( 'all' )? Identification (OwnedMultiplicity)?
7273
* ( SpecializationPart | ConjugationPart )+
7374
* TypeRelationshipPart*
7475
*/
@@ -392,6 +393,10 @@ fun KerML.FeatureSpecializationPart(feature: FeatureActions<Feature>) {
392393
optional( {token.kind == LCBRACE && nextToken.kind == INTEGER_LIT} ) { MultiplicityPart().also { feature.addMultiplicity(it) } }
393394
noOrMore(featureSpecializationStart) { FeatureSpecialization(feature) }
394395
}
396+
LCBRACE then TIMES starts {
397+
MultiplicityPart().also { feature.addMultiplicity(it) }
398+
noOrMore(featureSpecializationStart) { FeatureSpecialization(feature) }
399+
}
395400
LCBRACE then INTEGER_LIT starts {
396401
MultiplicityPart().also { feature.addMultiplicity(it) }
397402
noOrMore(featureSpecializationStart) { FeatureSpecialization(feature) }
@@ -439,7 +444,13 @@ fun KerML.OwnedMultiplicity(): IntegerRange {
439444
*/
440445
fun KerML.parseIntegerRange(): IntegerRange {
441446
val result = IntegerRange(IntegerRange.Integers)
442-
ConstInt().also { result.min = it; result.max = it }
447+
ConstInt().also {
448+
if (consumedToken.kind == TIMES) {
449+
result.min = -Long.MIN_VALUE; result.max = Long.MAX_VALUE
450+
} else {
451+
result.min = it; result.max = it
452+
}
453+
}
443454
optional(DOTDOT, consume = true) {
444455
ConstInt().also { result.max = it }
445456
}

src/main/kotlin/com/github/tukcps/sysmd/compiler/parser/sysmlv2/Constraint.kt

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
package com.github.tukcps.sysmd.compiler.parser.sysmlv2
44
import com.github.tukcps.sysmd.compiler.SysMLv2
5-
import com.github.tukcps.sysmd.compiler.parser.kerml.Expression
65
import com.github.tukcps.sysmd.compiler.parser.kerml.FeatureSpecializationPart
76
import com.github.tukcps.sysmd.compiler.parser.util.Unsupported
87
import com.github.tukcps.sysmd.compiler.scanner.Token.Kind.*
@@ -11,7 +10,6 @@ import com.github.tukcps.sysmd.compiler.semantics.kerml.FeatureActions
1110
import com.github.tukcps.sysmd.compiler.semantics.kerml.TypeActions
1211
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.AssertActions
1312
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.CalculationDefinitionActions
14-
import com.github.tukcps.sysmd.model.expression.AstRoot
1513
import com.github.tukcps.sysmd.model.kerml.Feature
1614
import com.github.tukcps.sysmd.model.kerml.Resolved
1715
import com.github.tukcps.sysmd.model.kerml.Type
@@ -34,10 +32,10 @@ fun SysMLv2.ConstraintDefinition() {
3432

3533
/**
3634
* AssertConstraintUsage =
37-
* OccurrenceUsagePrefix 'assert' ( isNegated ?= 'not' )?
38-
* ( ownedRelationship += OwnedReferenceSubsetting
39-
* FeatureSpecializationPart?
40-
* | 'constraint' ConstraintUsageDeclaration ) CalculationBody
35+
* OccurrenceUsagePrefix 'assert' (isNegated ?= 'not')?
36+
* (OwnedReferenceSubsetting
37+
* FeatureSpecializationPart? | 'constraint' ConstraintUsageDeclaration)
38+
* CalculationBody
4139
*/
4240

4341
/** Just checks the prefixes already parsed for compliance */
@@ -74,9 +72,9 @@ fun SysMLv2.ConstraintUsage() {
7472

7573
/**
7674
* AssertConstraintUsage =
77-
* OccurrenceUsagePrefix 'assert' ( isNegated ?= 'not' )?
78-
* ( OwnedReferenceSubsetting FeatureSpecializationPart?
79-
* | 'constraint' ConstraintUsageDeclaration )
75+
* OccurrenceUsagePrefix 'assert' (isNegated ?= 'not')?
76+
* (OwnedReferenceSubsetting FeatureSpecializationPart?
77+
* | 'constraint' ConstraintUsageDeclaration)
8078
* CalculationBody
8179
*/
8280
fun SysMLv2.AssertConstraintUsage() {
@@ -98,14 +96,5 @@ fun SysMLv2.AssertConstraintUsage() {
9896
others { }
9997
}
10098
assert.finish() // Before the Calculation Body ...
101-
// CalculationBody(Resolved(assert.created!!))
102-
// TODO ... Calculation Body
103-
LCURBRACE.consume() // TODO: Body
104-
val iBeforeExpression = token.indices.first
105-
Expression().also {
106-
assert.created?.featureWithValue = AstRoot(model, assert.created!!, it)
107-
assert.created?.indices = iBeforeExpression .. consumedToken.indices.last
108-
assert.created?.expression = input.subSequence(assert.created!!.indices!!).toString().trim()
109-
}
110-
RCURBRACE.consume()
99+
CalculationBody(Resolved(assert.created!!))
111100
}

src/main/kotlin/com/github/tukcps/sysmd/compiler/parser/sysmlv2/Definition.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ import com.github.tukcps.sysmd.model.kerml.Element
1616
import com.github.tukcps.sysmd.model.kerml.Resolved
1717
import com.github.tukcps.sysmd.model.kerml.Type
1818

19+
/**
20+
* 8.2.2.6 Definition and Usage Textual Notation
21+
* 8.2.2.6.1 Definitions
22+
*
23+
* Definition = DefinitionDeclaration DefinitionBody
24+
*/
25+
internal fun SysMLv2.Definition(typeActions: TypeActions<Type>) {
26+
DefinitionDeclaration(typeActions)
27+
DefinitionBody(Resolved(typeActions.created!!))
28+
}
29+
30+
1931
/**
2032
* DefinitionBody = ';' | '{' DefinitionBodyItem* '}'
2133
*/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@file:Suppress("FunctionName", "UNCHECKED_CAST")
2+
3+
package com.github.tukcps.sysmd.compiler.parser.sysmlv2
4+
5+
import com.github.tukcps.sysmd.compiler.SysMLv2
6+
import com.github.tukcps.sysmd.compiler.scanner.Token.Kind.*
7+
import com.github.tukcps.sysmd.compiler.semantics.kerml.FeatureActions
8+
import com.github.tukcps.sysmd.compiler.semantics.kerml.TypeActions
9+
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.PartDefinitionActions
10+
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.PartUsageActions
11+
import com.github.tukcps.sysmd.model.kerml.Feature
12+
import com.github.tukcps.sysmd.model.kerml.Type
13+
14+
/**
15+
* 8.2.2.11 Parts Textual Notation
16+
*
17+
* PartDefinition = OccurrenceDefinitionPrefix 'part' 'def' Definition
18+
*/
19+
fun SysMLv2.PartDefinition() {
20+
val partDefinition = PartDefinitionActions(semantics)
21+
PART.consume()
22+
DEF.consume()
23+
Definition(partDefinition as TypeActions<Type>)
24+
partDefinition.finish()
25+
}
26+
27+
/**
28+
* PartUsage = * OccurrenceUsagePrefix 'part' Usage
29+
*/
30+
fun SysMLv2.PartUsage() {
31+
val partUsage = PartUsageActions(semantics)
32+
PART.consume()
33+
Usage(partUsage as FeatureActions<Feature>)
34+
partUsage.finish()
35+
}

src/main/kotlin/com/github/tukcps/sysmd/compiler/parser/sysmlv2/PortAndPart.kt renamed to src/main/kotlin/com/github/tukcps/sysmd/compiler/parser/sysmlv2/Port.kt

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
@file:Suppress("FunctionName", "UNCHECKED_CAST")
1+
@file:Suppress("UNCHECKED_CAST", "FunctionName")
22

33
package com.github.tukcps.sysmd.compiler.parser.sysmlv2
44

55
import com.github.tukcps.sysmd.compiler.SysMLv2
6-
import com.github.tukcps.sysmd.compiler.scanner.Token.Kind.*
6+
import com.github.tukcps.sysmd.compiler.scanner.Token.Kind.DEF
7+
import com.github.tukcps.sysmd.compiler.scanner.Token.Kind.PORT
78
import com.github.tukcps.sysmd.compiler.semantics.kerml.FeatureActions
89
import com.github.tukcps.sysmd.compiler.semantics.kerml.TypeActions
9-
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.PartDefinitionActions
10-
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.PartUsageActions
1110
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.PortDefinitionActions
1211
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.PortUsageActions
1312
import com.github.tukcps.sysmd.model.kerml.Feature
@@ -40,31 +39,7 @@ fun SysMLv2.PortDefinition() {
4039
fun SysMLv2.PortUsage() {
4140
val portUsage = PortUsageActions(semantics)
4241
PORT.consume()
43-
UsageDeclaration(portUsage as FeatureActions<Feature>)
44-
DefinitionBody(Resolved(portUsage.created!!))
42+
Usage(portUsage as FeatureActions<Feature>)
4543
portUsage.finish()
4644
}
4745

48-
/**
49-
* 8.2.2.11 Parts Textual Notation
50-
*
51-
* PartDefinition = OccurrenceDefinitionPrefix 'part' 'def' Definition
52-
*/
53-
fun SysMLv2.PartDefinition() {
54-
val partDefinition = PartDefinitionActions(semantics)
55-
PART.consume()
56-
DEF.consume()
57-
DefinitionDeclaration(partDefinition as TypeActions<Type>)
58-
DefinitionBody(Resolved(partDefinition.created!!))
59-
partDefinition.finish()
60-
}
61-
62-
/**
63-
* PartUsage = * OccurrenceUsagePrefix 'part' Usage
64-
*/
65-
fun SysMLv2.PartUsage() {
66-
val partUsage = PartUsageActions(semantics)
67-
PART.consume()
68-
Usage(partUsage as FeatureActions<Feature>)
69-
partUsage.finish()
70-
}

src/main/kotlin/com/github/tukcps/sysmd/compiler/parser/sysmlv2/Requirement.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import com.github.tukcps.sysmd.compiler.scanner.Token.Kind.*
1010
import com.github.tukcps.sysmd.compiler.semantics.kerml.FeatureActions
1111
import com.github.tukcps.sysmd.compiler.semantics.kerml.TypeActions
1212
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.RequirementConstraintMemberActions
13-
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.RequirementConstraintUsageActions
1413
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.RequirementDefinitionActions
1514
import com.github.tukcps.sysmd.compiler.semantics.sysmlv2.RequirementUsageActions
1615
import com.github.tukcps.sysmd.model.kerml.Element

src/main/kotlin/com/github/tukcps/sysmd/compiler/parser/sysmlv2/Starts.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ val usagePrefixStart = basicUsagePrefixStart
1414

1515

1616
fun SysMLv2.usageDeclarationStarts() = setOf(LCBRACE, TYPED_BY, REFERENCES, REDEFINES).starts()
17-
|| (token.kind == NAME_LIT && nextToken.kind in setOf(TYPED_BY, LT, SEMICOLON))
17+
|| (token.kind == NAME_LIT && nextToken.kind in setOf(TYPED_BY, REDEFINES, REFERENCES, SPECIALIZES, DPGT, SEMICOLON))
1818

1919
fun SysMLv2.referenceUsageStarts() = usageStarts() // + refPrefixStart + REF

src/main/kotlin/com/github/tukcps/sysmd/compiler/parser/sysmlv2/Usage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ internal fun SysMLv2.UsageDeclaration(feature: FeatureActions<Feature>) {
8383
FeatureSpecializationPart(feature)
8484
}
8585
// SysMD proprietary extension
86-
TypeConstraint().also { feature.addTypeConstraint(it) }
86+
TypeConstraint().also { if ( it.isNotEmpty() ) feature.addTypeConstraint(it) }
8787
UnitConstraint().also { feature.addUnitConstraint(it) }
8888
}
8989

0 commit comments

Comments
 (0)