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: 0 additions & 2 deletions XPlus.setup
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,6 @@
url="https://download.eclipse.org/releases/2024-09"/>
<repository
url="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-09"/>
<repository
url="http://hallvard.github.io/plantuml"/>
<repository
url="https://download.eclipse.org/justj/jres/21/updates/release/latest"/>
<repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,58 @@ class ExpressionEvaluatorFunctionTest extends ExpressionEvaluatorTestBase {
}
''')
}


@Test
def void testListOfLists() {
assertEval('''
record Config {
string [ ] [ ] listOfListOfStrings string [ ]
listOfStrings
string aString
}
Config config = Config {
listOfListOfStrings = <string[][]>[
<string[]>['0a','0b','0c'],
<string[]>['1a','1b','1c'],
<string[]>['2a','2b','2c']
],
listOfStrings = null,
aString = null
}
Config out = Config {
listOfListOfStrings = null ,
listOfStrings = < string [ ] > [ "0a" , "0b" , "0c" ] ,
aString = "0a"
}

string s = "0a"
string [ ] sArray = < string [ ] > [ "0a" , "0b" , "0c" ]
''', '''
record Config {
string[][] listOfListOfStrings
string[] listOfStrings
string aString
}
Config config = Config {
listOfListOfStrings = <string[][]>[
<string[]>['0a','0b','0c'],
<string[]>['1a','1b','1c'],
<string[]>['2a','2b','2c']
],
listOfStrings = null,
aString = null
}
Config out = Config {
listOfListOfStrings = null,
listOfStrings = get(config.listOfListOfStrings, 0), // expected returned value: ['0a', '0b', '0c']
aString = get(get(config.listOfListOfStrings, 0), 0)
}
string s = out.aString
string[] sArray = out.listOfStrings
''')

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,34 @@ class ExpressionValidationTest {
int d = 2 ^ 3 ^ 2
''')
}

@Test
def void testListOfLists(){
validate('''
record Config {
string[][] listOfListOfStrings
string[] listOfStrings
string aString
}
Config config = Config {
listOfListOfStrings = <string[][]>[
<string[]>['0a','0b','0c'],
<string[]>['1a','1b','1c'],
<string[]>['2a','2b','2c']
],
listOfStrings = null,
aString = null
}
Config out = Config {
listOfListOfStrings = null,
listOfStrings = get(config.listOfListOfStrings, 0), // expected returned value: ['0a', '0b', '0c']
aString = get(get(config.listOfListOfStrings, 0), 0)
}

string s = out.aString
string[] s1 = out.listOfStrings
''')
}

private def validate(String text) {
val result = parseHelper.parse(text)
Expand Down
81 changes: 23 additions & 58 deletions bundles/nl.esi.xtext.expressions/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@ Bundle-ManifestVersion: 2
Bundle-Name: Expression Lang Core
Bundle-Vendor: TNO-ESI
Bundle-Version: 0.4.0.qualifier
Export-Package: nl.esi.xtext.expressions,
nl.esi.xtext.expressions,
nl.esi.xtext.expressions.conversion,
nl.esi.xtext.expressions.evaluation,
nl.esi.xtext.expressions.evaluation,
nl.esi.xtext.expressions.expression,
nl.esi.xtext.expressions.expression.impl,
nl.esi.xtext.expressions.expression.util,
nl.esi.xtext.expressions.formatting2,
nl.esi.xtext.expressions.functions,
nl.esi.xtext.expressions.generator,
nl.esi.xtext.expressions.generator,
nl.esi.xtext.expressions.generator.plantuml,
nl.esi.xtext.expressions.parser.antlr,
nl.esi.xtext.expressions.parser.antlr.internal,
nl.esi.xtext.expressions.scoping,
nl.esi.xtext.expressions.scoping,
nl.esi.xtext.expressions.serializer,
nl.esi.xtext.expressions.services,
nl.esi.xtext.expressions.utilities,
nl.esi.xtext.expressions.utilities,
nl.esi.xtext.expressions.validation,
nl.esi.xtext.expressions.validation
Bundle-SymbolicName: nl.esi.xtext.expressions; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: nl.esi.xtext.types;visibility:=reexport,
Expand All @@ -17,63 +40,5 @@ Require-Bundle: nl.esi.xtext.types;visibility:=reexport,
org.eclipse.emf.common,
org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-21
Export-Package: nl.esi.xtext.expressions,
nl.esi.xtext.expressions.conversion,
nl.esi.xtext.expressions.evaluation,
nl.esi.xtext.expressions.functions,
nl.esi.xtext.expressions.expression;
uses:="org.eclipse.emf.ecore,
org.eclipse.emf.common.util,
nl.esi.xtext.types.types",
nl.esi.xtext.expressions.expression.impl;
uses:="org.eclipse.emf.ecore,
org.eclipse.emf.ecore.impl,
org.eclipse.emf.common.util,
org.eclipse.emf.common.notify,
nl.esi.xtext.types.types,
nl.esi.xtext.types.types.impl,
nl.esi.xtext.expressions.expression",
nl.esi.xtext.expressions.expression.util;
uses:="org.eclipse.emf.ecore,
org.eclipse.emf.common.notify,
org.eclipse.emf.common.notify.impl,
org.eclipse.emf.ecore.util,
nl.esi.xtext.types.types,
nl.esi.xtext.expressions.expression",
nl.esi.xtext.expressions.formatting2;uses:="nl.esi.xtext.types.formatting2,org.eclipse.xtext.formatting2,nl.esi.xtext.expressions.expression",
nl.esi.xtext.expressions.generator;
uses:="nl.esi.xtext.types.generator,
org.eclipse.xtext.generator,
org.eclipse.emf.ecore.resource,
nl.esi.xtext.expressions.expression",
nl.esi.xtext.expressions.generator.plantuml;uses:="nl.esi.xtext.types.generator,org.eclipse.xtext.generator,nl.esi.xtext.expressions.expression",
nl.esi.xtext.expressions.parser.antlr;uses:="org.eclipse.xtext.parser.antlr,nl.esi.xtext.expressions.parser.antlr.internal,nl.esi.xtext.expressions.services",
nl.esi.xtext.expressions.parser.antlr.internal;
uses:="org.eclipse.emf.ecore,
org.eclipse.emf.common.util,
org.eclipse.xtext.parser.antlr,
nl.esi.xtext.expressions.services,
org.antlr.runtime",
nl.esi.xtext.expressions.scoping;
uses:="org.eclipse.emf.ecore,
org.eclipse.xtext.scoping,
nl.esi.xtext.expressions.expression",
nl.esi.xtext.expressions.serializer;
uses:="org.eclipse.emf.ecore,
org.eclipse.xtext.nodemodel,
org.eclipse.xtext.serializer.analysis,
nl.esi.xtext.types.serializer,
nl.esi.xtext.expressions.services,
org.eclipse.xtext.serializer.sequencer,
org.eclipse.xtext,
org.eclipse.xtext.serializer,
nl.esi.xtext.expressions.expression",
nl.esi.xtext.expressions.services;uses:="nl.esi.xtext.types.services,org.eclipse.xtext.service,org.eclipse.xtext",
nl.esi.xtext.expressions.utilities;uses:="org.eclipse.emf.ecore,nl.esi.xtext.types.utilities,nl.esi.xtext.expressions.expression",
nl.esi.xtext.expressions.validation;
uses:="org.eclipse.emf.ecore,
org.eclipse.xtext.scoping,
nl.esi.xtext.types.types,
nl.esi.xtext.expressions.expression"
Import-Package: org.apache.log4j
Automatic-Module-Name: nl.esi.xtext.expressions
Original file line number Diff line number Diff line change
Expand Up @@ -322,23 +322,27 @@ class ExpressionsUtilities {
/**
* Recursively substitute generic type parameters in a type structure.
*/
private def static Type substituteGenerics(Type type, Map<GenericsTypeParam, Type> resolutionMap) {
if (type === null) return null
return switch (type) {
private def static Type substituteGenerics(Type targetType, Map<GenericsTypeParam, Type> resolutionMap) {
if (targetType === null) return null
return switch (targetType) {
VectorTypeConstructor: createVectorTypeConstructor => [
type = substituteGenerics(type.typeObject.elementType.asType, resolutionMap).type
dimensions += type.dimensions.copyAll
val substituteType = resolutionMap.get(targetType.type)
type = substituteGenerics(targetType.typeObject.elementType.asType, resolutionMap).type
if(substituteType.isVectorType) {
dimensions += substituteType.dimensions.copyAll
}
dimensions += targetType.dimensions.copyAll
]
MapTypeConstructor: createMapTypeConstructor => [
type = substituteGenerics(type.typeObject.keyType.asType, resolutionMap).type
valueType = substituteGenerics(type.typeObject.valueType.asType, resolutionMap).asExprType
type = substituteGenerics(targetType.typeObject.keyType.asType, resolutionMap).type
valueType = substituteGenerics(targetType.typeObject.valueType.asType, resolutionMap).asExprType
]
TypeReference: {
// resolve generics or just the original type decl
return resolutionMap.getOrDefault(type.type,type)
return resolutionMap.getOrDefault(targetType.type,targetType)
}
default:
type
targetType
}
}

Expand Down
7 changes: 0 additions & 7 deletions bundles/nl.esi.xtext.launch/Launch Runtime Eclipse.launch
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@
<setEntry value="junit-platform-suite-commons@default:default"/>
<setEntry value="junit-platform-suite-engine@default:default"/>
<setEntry value="junit-vintage-engine@default:default"/>
<setEntry value="net.sourceforge.plantuml.eclipse.imagecontrol@default:default"/>
<setEntry value="net.sourceforge.plantuml.eclipse@default:default"/>
<setEntry value="net.sourceforge.plantuml.ecore@default:default"/>
<setEntry value="net.sourceforge.plantuml.jdt@default:default"/>
<setEntry value="net.sourceforge.plantuml.lib@default:default"/>
<setEntry value="net.sourceforge.plantuml.svg@default:default"/>
<setEntry value="net.sourceforge.plantuml.text@default:default"/>
<setEntry value="org.antlr.generator@default:default"/>
<setEntry value="org.antlr.runtime@default:default"/>
<setEntry value="org.aopalliance@default:default"/>
Expand Down
1 change: 0 additions & 1 deletion bundles/nl.esi.xtext.types/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Require-Bundle: nl.esi.xtext.common.lang;visibility:=reexport,
org.eclipse.xtext.xbase.lib;bundle-version="2.15.0",
org.apache.commons.lang;bundle-version="2.6.0",
org.apache.commons.cli,
net.sourceforge.plantuml.lib;bundle-version="1.2017.15",
org.eclipse.core.runtime;bundle-version="3.16.0",
org.eclipse.e4.core.di;bundle-version="1.7.400",
org.eclipse.core.resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import nl.esi.xtext.types.types.VectorTypeConstructor
import nl.esi.xtext.types.types.VectorTypeDecl
import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.emf.ecore.util.EcoreUtil
import nl.esi.xtext.types.types.Dimension

class TypeUtilities {
/*
Expand Down Expand Up @@ -61,6 +62,16 @@ class TypeUtilities {
def static boolean isVectorType(Type t){
return t.getTypeObject.isVectorType
}

def static List<Dimension> getDimensions(Type t){
if(t instanceof VectorTypeConstructor) {
return t.dimensions
}
if (t instanceof VectorTypeDecl) {
return t.constructor.dimensions
}
return List.of
}

def static boolean isVectorType(TypeObject t){
t instanceof VectorTypeConstructor || t instanceof VectorTypeDecl
Expand Down
4 changes: 0 additions & 4 deletions features/nl.esi.xplus.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ Languages.
%license
</license>

<requires>
<import plugin="net.sourceforge.plantuml.lib" version="1.2024.5" match="compatible"/>
</requires>

<plugin
id="nl.esi.xtext.types.ide"
version="0.0.0"/>
Expand Down
3 changes: 0 additions & 3 deletions releng/nl.esi.xplus.standard.site/category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
<bundle id="Java-WebSocket.source">
<category name="libs"/>
</bundle>
<bundle id="net.sourceforge.plantuml.lib">
<category name="libs"/>
</bundle>
<category-def name="XPlus" label="XPlus">
<description>
XPlus Framework
Expand Down
6 changes: 1 addition & 5 deletions releng/nl.esi.xplus.target/nl.esi.xplus.target.target
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-09"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="net.sourceforge.plantuml.lib" version="0.0.0"/>
<repository location="http://hallvard.github.io/plantuml"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="a.jre.org.eclipse.justj.openjdk.hotspot.jre.full.stripped" version="0.0.0"/>
<unit id="a.jre.org.eclipse.justj.openjdk.hotspot.jre.full" version="0.0.0"/>
<repository location="https://download.eclipse.org/justj/jres/21/updates/release/latest"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
Expand Down
Loading