├── workspace ├── io.entitas.lang.eclipse.feature │ ├── build.properties │ ├── .project │ └── feature.xml ├── io.entitas.lang.parent │ ├── vscode-extension-self-contained │ │ ├── .gitignore │ │ ├── .vscodeignore │ │ ├── images │ │ │ └── icon.png │ │ ├── tslint.json │ │ ├── src │ │ │ ├── tsconfig.json │ │ │ └── extension.ts │ │ ├── .project │ │ ├── entitas.configuration.json │ │ ├── syntaxes │ │ │ └── entitas.tmLanguage │ │ ├── build.gradle │ │ └── package.json │ ├── io.entitas.lang.ide │ │ ├── src │ │ │ ├── plugin.properties │ │ │ └── main │ │ │ │ ├── xtext-gen │ │ │ │ ├── META-INF │ │ │ │ │ └── services │ │ │ │ │ │ └── org.eclipse.xtext.ISetup │ │ │ │ └── io │ │ │ │ │ └── entitas │ │ │ │ │ └── lang │ │ │ │ │ └── ide │ │ │ │ │ ├── contentassist │ │ │ │ │ └── antlr │ │ │ │ │ │ ├── internal │ │ │ │ │ │ └── InternalDSL.tokens │ │ │ │ │ │ └── PartialDSLContentAssistParser.java │ │ │ │ │ └── AbstractDSLIdeModule.java │ │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── entitas │ │ │ │ └── lang │ │ │ │ └── ide │ │ │ │ ├── DSLIdeModule.xtend │ │ │ │ ├── CustomServerModule.java │ │ │ │ ├── DSLIdeSetup.xtend │ │ │ │ ├── MultiProjectServerLauncher.xtend │ │ │ │ ├── ServerLauncher.xtend │ │ │ │ └── RunServer.java │ │ ├── build.gradle │ │ ├── .project │ │ └── .classpath │ ├── settings.gradle │ ├── gradle │ │ ├── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── maven-deployment.gradle │ │ └── source-layout.gradle │ ├── io.entitas.lang │ │ ├── src │ │ │ ├── main │ │ │ │ ├── xtext-gen │ │ │ │ │ └── io │ │ │ │ │ │ └── entitas │ │ │ │ │ │ └── lang │ │ │ │ │ │ ├── DSL.xtextbin │ │ │ │ │ │ ├── scoping │ │ │ │ │ │ └── AbstractDSLScopeProvider.java │ │ │ │ │ │ ├── parser │ │ │ │ │ │ └── antlr │ │ │ │ │ │ │ ├── DSLAntlrTokenFileProvider.java │ │ │ │ │ │ │ ├── internal │ │ │ │ │ │ │ └── InternalDSL.tokens │ │ │ │ │ │ │ └── DSLParser.java │ │ │ │ │ │ ├── validation │ │ │ │ │ │ └── AbstractDSLValidator.java │ │ │ │ │ │ ├── dsl │ │ │ │ │ │ ├── Target.java │ │ │ │ │ │ ├── Context.java │ │ │ │ │ │ ├── AliasList.java │ │ │ │ │ │ ├── ContextScopes.java │ │ │ │ │ │ ├── PropertyList.java │ │ │ │ │ │ ├── Namespace.java │ │ │ │ │ │ ├── TargetParameter.java │ │ │ │ │ │ ├── PropertyPrefix.java │ │ │ │ │ │ ├── SingleAlias.java │ │ │ │ │ │ ├── ContextScope.java │ │ │ │ │ │ ├── ContextId.java │ │ │ │ │ │ ├── PropertyRules.java │ │ │ │ │ │ ├── AliasRule.java │ │ │ │ │ │ ├── MatcherRule.java │ │ │ │ │ │ ├── TargetId.java │ │ │ │ │ │ ├── Version.java │ │ │ │ │ │ ├── Alias.java │ │ │ │ │ │ ├── impl │ │ │ │ │ │ │ ├── ContextScopesImpl.java │ │ │ │ │ │ │ ├── TargetImpl.java │ │ │ │ │ │ │ ├── ContextImpl.java │ │ │ │ │ │ │ ├── AliasListImpl.java │ │ │ │ │ │ │ ├── PropertyListImpl.java │ │ │ │ │ │ │ ├── NamespaceImpl.java │ │ │ │ │ │ │ ├── TargetParameterImpl.java │ │ │ │ │ │ │ ├── PropertyPrefixImpl.java │ │ │ │ │ │ │ ├── ContextScopeImpl.java │ │ │ │ │ │ │ └── SingleAliasImpl.java │ │ │ │ │ │ ├── TriggerRule.java │ │ │ │ │ │ └── AccessRule.java │ │ │ │ │ │ └── DSLStandaloneSetupGenerated.java │ │ │ │ └── java │ │ │ │ │ └── io │ │ │ │ │ └── entitas │ │ │ │ │ └── lang │ │ │ │ │ ├── generator │ │ │ │ │ ├── DSLGenerator.xtend │ │ │ │ │ └── entitas_csharp │ │ │ │ │ │ ├── GenerationExtension.xtend │ │ │ │ │ │ ├── ContextGenerationExtension.xtend │ │ │ │ │ │ ├── MatcherGenerationExtension.xtend │ │ │ │ │ │ ├── SystemGenerationExtension.xtend │ │ │ │ │ │ ├── ComponentGenerationExtension.xtend │ │ │ │ │ │ └── FeatureGenerationExtension.xtend │ │ │ │ │ ├── extensions │ │ │ │ │ ├── TargetExtensions.xtend │ │ │ │ │ ├── ContextExtensions.xtend │ │ │ │ │ ├── AliasExtensions.xtend │ │ │ │ │ ├── AccessRuleExtensions.xtend │ │ │ │ │ ├── ComponentExtensions.xtend │ │ │ │ │ └── SystemExtensions.xtend │ │ │ │ │ ├── DSLRuntimeModule.xtend │ │ │ │ │ ├── scoping │ │ │ │ │ └── DSLScopeProvider.xtend │ │ │ │ │ ├── DSLStandaloneSetup.xtend │ │ │ │ │ ├── validation │ │ │ │ │ └── DSLValidator.xtend │ │ │ │ │ ├── GenerateDSL.mwe2 │ │ │ │ │ └── DSL.xtext │ │ │ └── test │ │ │ │ ├── java │ │ │ │ └── io │ │ │ │ │ └── entitas │ │ │ │ │ └── lang │ │ │ │ │ └── tests │ │ │ │ │ ├── ContextExtensionTest.xtend │ │ │ │ │ ├── AliasExtensionTest.xtend │ │ │ │ │ ├── FeatureGenerationExtensionTest.xtend │ │ │ │ │ ├── MatcherGenerationExtensionTest.xtend │ │ │ │ │ └── ContextGenerationExtensionTest.xtend │ │ │ │ └── xtext-gen │ │ │ │ └── io │ │ │ │ └── entitas │ │ │ │ └── lang │ │ │ │ └── tests │ │ │ │ └── DSLInjectorProvider.java │ │ ├── .project │ │ ├── .launch │ │ │ └── Generate DSL (entitas) Language Infrastructure.launch │ │ ├── build.gradle │ │ └── .classpath │ ├── .project │ ├── gradlew.bat │ ├── build.gradle │ └── gradlew ├── io.entitas.lang.eclipse.updatesite │ ├── content.jar │ ├── plugins.zip │ ├── artifacts.jar │ ├── plugins │ │ ├── io.entitas.lang.eclipse_1.0.0.201702182256.jar │ │ ├── io.entitas.lang.eclipse.ui_1.0.0.201702182256.jar │ │ └── io.entitas.lang.eclipse.ide_1.0.0.201702182256.jar │ ├── features │ │ └── io.entitas.lang.eclipse.feature_1.0.0.201702182256.jar │ ├── site.xml │ └── .project ├── io.entitas.lang.eclipse.ide │ ├── build.properties │ ├── src │ │ └── io │ │ │ └── entitas │ │ │ └── lang │ │ │ └── ide │ │ │ ├── DSLIdeModule.xtend │ │ │ └── DSLIdeSetup.xtend │ ├── .classpath │ ├── META-INF │ │ └── MANIFEST.MF │ └── .project ├── io.entitas.lang.eclipse │ ├── src │ │ └── io │ │ │ └── entitas │ │ │ └── lang │ │ │ ├── generator │ │ │ └── DSLGenerator.xtend │ │ │ ├── DSLRuntimeModule.xtend │ │ │ ├── scoping │ │ │ └── DSLScopeProvider.xtend │ │ │ ├── DSLStandaloneSetup.xtend │ │ │ ├── validation │ │ │ └── DSLValidator.xtend │ │ │ ├── GenerateDSL.mwe2 │ │ │ └── DSL.xtext │ ├── plugin.xml │ ├── plugin.xml_gen │ ├── .classpath │ ├── build.properties │ ├── META-INF │ │ └── MANIFEST.MF │ ├── .project │ └── .launch │ │ ├── Generate DSL (entitas) Language Infrastructure.launch │ │ └── Launch Runtime Eclipse.launch ├── io.entitas.lang.eclipse.ui │ ├── build.properties │ ├── src │ │ └── io │ │ │ └── entitas │ │ │ └── lang │ │ │ └── ui │ │ │ ├── DSLUiModule.xtend │ │ │ ├── contentassist │ │ │ └── DSLProposalProvider.xtend │ │ │ ├── outline │ │ │ └── DSLOutlineTreeProvider.xtend │ │ │ ├── labeling │ │ │ ├── DSLDescriptionLabelProvider.xtend │ │ │ └── DSLLabelProvider.xtend │ │ │ └── quickfix │ │ │ └── DSLQuickfixProvider.xtend │ ├── .classpath │ ├── .project │ └── META-INF │ │ └── MANIFEST.MF └── .project ├── Entitas-LangSyntaxGraph.png ├── plugins ├── io.entitas.lang.eclipse_1.0.6.201801271231.jar ├── io.entitas.lang.eclipse.ui_1.0.6.201801271231.jar └── io.entitas.lang.eclipse.ide_1.0.6.201801271231.jar ├── .project └── .gitignore /workspace/io.entitas.lang.eclipse.feature/build.properties: -------------------------------------------------------------------------------- 1 | bin.includes = feature.xml 2 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/.gitignore: -------------------------------------------------------------------------------- 1 | *.jar 2 | *.vsix 3 | .vscode -------------------------------------------------------------------------------- /Entitas-LangSyntaxGraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/Entitas-LangSyntaxGraph.png -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/plugin.properties: -------------------------------------------------------------------------------- 1 | _UI_DiagnosticRoot_diagnostic=foo -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/.vscodeignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | .gradle/** 3 | build/** 4 | *.gradle -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/xtext-gen/META-INF/services/org.eclipse.xtext.ISetup: -------------------------------------------------------------------------------- 1 | io.entitas.lang.ide.DSLIdeSetup 2 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/settings.gradle: -------------------------------------------------------------------------------- 1 | include 'io.entitas.lang' 2 | include 'io.entitas.lang.ide' 3 | include 'vscode-extension-self-contained' 4 | -------------------------------------------------------------------------------- /plugins/io.entitas.lang.eclipse_1.0.6.201801271231.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/plugins/io.entitas.lang.eclipse_1.0.6.201801271231.jar -------------------------------------------------------------------------------- /plugins/io.entitas.lang.eclipse.ui_1.0.6.201801271231.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/plugins/io.entitas.lang.eclipse.ui_1.0.6.201801271231.jar -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.updatesite/content.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.eclipse.updatesite/content.jar -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.updatesite/plugins.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.eclipse.updatesite/plugins.zip -------------------------------------------------------------------------------- /plugins/io.entitas.lang.eclipse.ide_1.0.6.201801271231.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/plugins/io.entitas.lang.eclipse.ide_1.0.6.201801271231.jar -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.updatesite/artifacts.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.eclipse.updatesite/artifacts.jar -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.parent/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ide/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = .,\ 5 | META-INF/ 6 | bin.excludes = **/*.xtend 7 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/src/io/entitas/lang/generator/DSLGenerator.xtend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.eclipse/src/io/entitas/lang/generator/DSLGenerator.xtend -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.parent/vscode-extension-self-contained/images/icon.png -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = .,\ 5 | META-INF/,\ 6 | plugin.xml 7 | bin.excludes = **/*.xtend 8 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/DSL.xtextbin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/DSL.xtextbin -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.updatesite/plugins/io.entitas.lang.eclipse_1.0.0.201702182256.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.eclipse.updatesite/plugins/io.entitas.lang.eclipse_1.0.0.201702182256.jar -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.updatesite/plugins/io.entitas.lang.eclipse.ui_1.0.0.201702182256.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.eclipse.updatesite/plugins/io.entitas.lang.eclipse.ui_1.0.0.201702182256.jar -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.updatesite/plugins/io.entitas.lang.eclipse.ide_1.0.0.201702182256.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.eclipse.updatesite/plugins/io.entitas.lang.eclipse.ide_1.0.0.201702182256.jar -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/DSLGenerator.xtend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/DSLGenerator.xtend -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Entitas-Lang 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.updatesite/features/io.entitas.lang.eclipse.feature_1.0.0.201702182256.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.eclipse.updatesite/features/io.entitas.lang.eclipse.feature_1.0.0.201702182256.jar -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.updatesite/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /workspace/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | workspace 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip 6 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ide/src/io/entitas/lang/ide/DSLIdeModule.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ide 5 | 6 | 7 | /** 8 | * Use this class to register ide components. 9 | */ 10 | class DSLIdeModule extends AbstractDSLIdeModule { 11 | } 12 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/GenerationExtension.xtend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/GenerationExtension.xtend -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/ContextGenerationExtension.xtend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/ContextGenerationExtension.xtend -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/MatcherGenerationExtension.xtend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/MatcherGenerationExtension.xtend -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/SystemGenerationExtension.xtend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/SystemGenerationExtension.xtend -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/java/io/entitas/lang/ide/DSLIdeModule.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ide 5 | 6 | 7 | /** 8 | * Use this class to register ide components. 9 | */ 10 | class DSLIdeModule extends AbstractDSLIdeModule { 11 | } 12 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/ComponentGenerationExtension.xtend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mzaks/Entitas-Lang/HEAD/workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/ComponentGenerationExtension.xtend -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/extensions/TargetExtensions.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.extensions 2 | 3 | import io.entitas.lang.dsl.TargetId 4 | 5 | class TargetExtensions { 6 | static def String getPath(TargetId targetId) { 7 | return targetId.parameters.findFirst[it.path !== null].path 8 | } 9 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-unused-expression": true, 4 | "no-duplicate-variable": true, 5 | "no-duplicate-key": true, 6 | "no-unused-variable": true, 7 | "curly": true, 8 | "class-name": true, 9 | "semicolon": ["always"], 10 | "triple-equals": true 11 | } 12 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/src/io/entitas/lang/DSLRuntimeModule.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang 5 | 6 | 7 | /** 8 | * Use this class to register components to be used at runtime / without the Equinox extension registry. 9 | */ 10 | class DSLRuntimeModule extends AbstractDSLRuntimeModule { 11 | } 12 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/gradle/maven-deployment.gradle: -------------------------------------------------------------------------------- 1 | //see https://docs.gradle.org/current/userguide/maven_plugin.html 2 | apply plugin: 'maven' 3 | 4 | uploadArchives { 5 | repositories { 6 | mavenDeployer { 7 | repository(url: "file://${buildDir}/localRepo") 8 | snapshotRepository(url: "file://${buildDir}/localRepo") 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/scoping/AbstractDSLScopeProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.scoping; 5 | 6 | import org.eclipse.xtext.scoping.impl.DelegatingScopeProvider; 7 | 8 | public abstract class AbstractDSLScopeProvider extends DelegatingScopeProvider { 9 | } 10 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/DSLRuntimeModule.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang 5 | 6 | 7 | /** 8 | * Use this class to register components to be used at runtime / without the Equinox extension registry. 9 | */ 10 | class DSLRuntimeModule extends AbstractDSLRuntimeModule { 11 | } 12 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/plugin.xml_gen: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/src/io/entitas/lang/ui/DSLUiModule.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ui 5 | 6 | import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor 7 | 8 | /** 9 | * Use this class to register components to be used within the Eclipse IDE. 10 | */ 11 | @FinalFieldsConstructor 12 | class DSLUiModule extends AbstractDSLUiModule { 13 | } 14 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "moduleResolution": "node", 6 | "sourceMap": false, 7 | "inlineSources": false, 8 | "declaration": true, 9 | "stripInternal": true, 10 | "lib": [ "es6" ], 11 | "outDir": "../out" 12 | } 13 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/src/io/entitas/lang/ui/contentassist/DSLProposalProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ui.contentassist 5 | 6 | 7 | /** 8 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#content-assist 9 | * on how to customize the content assistant. 10 | */ 11 | class DSLProposalProvider extends AbstractDSLProposalProvider { 12 | } 13 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/src/io/entitas/lang/scoping/DSLScopeProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.scoping 5 | 6 | 7 | /** 8 | * This class contains custom scoping description. 9 | * 10 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping 11 | * on how and when to use it. 12 | */ 13 | class DSLScopeProvider extends AbstractDSLScopeProvider { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/src/io/entitas/lang/DSLStandaloneSetup.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang 5 | 6 | 7 | /** 8 | * Initialization support for running Xtext languages without Equinox extension registry. 9 | */ 10 | class DSLStandaloneSetup extends DSLStandaloneSetupGenerated { 11 | 12 | def static void doSetup() { 13 | new DSLStandaloneSetup().createInjectorAndDoEMFRegistration() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/scoping/DSLScopeProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.scoping 5 | 6 | 7 | /** 8 | * This class contains custom scoping description. 9 | * 10 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping 11 | * on how and when to use it. 12 | */ 13 | class DSLScopeProvider extends AbstractDSLScopeProvider { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/DSLStandaloneSetup.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang 5 | 6 | 7 | /** 8 | * Initialization support for running Xtext languages without Equinox extension registry. 9 | */ 10 | class DSLStandaloneSetup extends DSLStandaloneSetupGenerated { 11 | 12 | def static void doSetup() { 13 | new DSLStandaloneSetup().createInjectorAndDoEMFRegistration() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.feature/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.entitas.lang.eclipse.feature 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.FeatureNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/src/io/entitas/lang/ui/outline/DSLOutlineTreeProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ui.outline 5 | 6 | import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider 7 | 8 | /** 9 | * Customization of the default outline structure. 10 | * 11 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#outline 12 | */ 13 | class DSLOutlineTreeProvider extends DefaultOutlineTreeProvider { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.updatesite/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.entitas.lang.eclipse.updatesite 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.UpdateSiteBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.pde.UpdateSiteNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.entitas.lang.parent 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ide/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/java/io/entitas/lang/ide/CustomServerModule.java: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.ide; 2 | 3 | import org.eclipse.xtext.ide.server.IWorkspaceConfigFactory; 4 | import org.eclipse.xtext.ide.server.MultiProjectWorkspaceConfigFactory; 5 | 6 | import com.google.inject.AbstractModule; 7 | 8 | public final class CustomServerModule extends AbstractModule { 9 | @Override 10 | protected void configure() { 11 | bind(IWorkspaceConfigFactory.class).to(MultiProjectWorkspaceConfigFactory.class); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | vscode-extension-self-contained 4 | Project vscode-extension-self-contained created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ide/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: io.entitas.lang.eclipse.ide 4 | Bundle-Vendor: My Company 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-SymbolicName: io.entitas.lang.eclipse.ide; singleton:=true 7 | Bundle-ActivationPolicy: lazy 8 | Require-Bundle: io.entitas.lang.eclipse, 9 | org.eclipse.xtext.ide, 10 | org.eclipse.xtext.xbase.ide, 11 | org.antlr.runtime 12 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 13 | Export-Package: io.entitas.lang.ide.contentassist.antlr.internal, 14 | io.entitas.lang.ide.contentassist.antlr 15 | 16 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ide/src/io/entitas/lang/ide/DSLIdeSetup.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ide 5 | 6 | import com.google.inject.Guice 7 | import io.entitas.lang.DSLRuntimeModule 8 | import io.entitas.lang.DSLStandaloneSetup 9 | import org.eclipse.xtext.util.Modules2 10 | 11 | /** 12 | * Initialization support for running Xtext languages as language servers. 13 | */ 14 | class DSLIdeSetup extends DSLStandaloneSetup { 15 | 16 | override createInjector() { 17 | Guice.createInjector(Modules2.mixin(new DSLRuntimeModule, new DSLIdeModule)) 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/extensions/ContextExtensions.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.extensions 2 | 3 | import io.entitas.lang.dsl.Context 4 | import io.entitas.lang.dsl.ContextId 5 | 6 | class ContextExtensions { 7 | 8 | static def defaultContextName(Context ctx){ 9 | return ctx.defaultContextNameOrNull ?: ctx.ids.get(0).name 10 | } 11 | 12 | static def defaultContextNameOrNull(Context ctx){ 13 | return ctx.ids.findFirst[it.isDefault()]?.name 14 | } 15 | 16 | static def isDefault(ContextId ctx) { 17 | ctx.parameters.contains("default") 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/entitas.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//", 4 | "blockComment": [ "/*", "*/" ] 5 | }, 6 | "brackets": [ 7 | ["{", "}"], 8 | ["[", "]"], 9 | ["(", ")"] 10 | ], 11 | "autoClosingPairs": [ 12 | ["{", "}"], 13 | ["[", "]"], 14 | ["(", ")"], 15 | ["\"", "\""], 16 | ["'", "'"] 17 | ], 18 | "surroundingPairs": [ 19 | ["{", "}"], 20 | ["[", "]"], 21 | ["(", ")"], 22 | ["\"", "\""], 23 | ["'", "'"] 24 | ] 25 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/java/io/entitas/lang/ide/DSLIdeSetup.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ide 5 | 6 | import com.google.inject.Guice 7 | import io.entitas.lang.DSLRuntimeModule 8 | import io.entitas.lang.DSLStandaloneSetup 9 | import org.eclipse.xtext.util.Modules2 10 | 11 | /** 12 | * Initialization support for running Xtext languages as language servers. 13 | */ 14 | class DSLIdeSetup extends DSLStandaloneSetup { 15 | 16 | override createInjector() { 17 | Guice.createInjector(Modules2.mixin(new DSLRuntimeModule, new DSLIdeModule)) 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/parser/antlr/DSLAntlrTokenFileProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.parser.antlr; 5 | 6 | import java.io.InputStream; 7 | import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider; 8 | 9 | public class DSLAntlrTokenFileProvider implements IAntlrTokenFileProvider { 10 | 11 | @Override 12 | public InputStream getAntlrTokenFile() { 13 | ClassLoader classLoader = getClass().getClassLoader(); 14 | return classLoader.getResourceAsStream("io/entitas/lang/parser/antlr/internal/InternalDSL.tokens"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/extensions/AliasExtensions.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.extensions 2 | 3 | import io.entitas.lang.dsl.Alias 4 | 5 | class AliasExtensions { 6 | static def typeName(Alias alias) { 7 | if (alias.singleAlias !== null){ 8 | return alias.singleAlias.typeAlias 9 | } 10 | } 11 | 12 | static def typeName(Alias alias, String targetName) { 13 | if (alias.singleAlias !== null){ 14 | return alias.singleAlias.typeAlias 15 | } 16 | for(rule : alias.listOfAliases.rules){ 17 | if(rule.target.name == targetName){ 18 | return rule.typeAlias 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/validation/AbstractDSLValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.validation; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import org.eclipse.emf.ecore.EPackage; 9 | import org.eclipse.xtext.validation.AbstractDeclarativeValidator; 10 | 11 | public abstract class AbstractDSLValidator extends AbstractDeclarativeValidator { 12 | 13 | @Override 14 | protected List getEPackages() { 15 | List result = new ArrayList(); 16 | result.add(io.entitas.lang.dsl.DslPackage.eINSTANCE); 17 | return result; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/src/io/entitas/lang/validation/DSLValidator.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.validation 5 | 6 | 7 | /** 8 | * This class contains custom validation rules. 9 | * 10 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation 11 | */ 12 | class DSLValidator extends AbstractDSLValidator { 13 | 14 | // public static val INVALID_NAME = 'invalidName' 15 | // 16 | // @Check 17 | // def checkGreetingStartsWithCapital(Greeting greeting) { 18 | // if (!Character.isUpperCase(greeting.name.charAt(0))) { 19 | // warning('Name should start with a capital', 20 | // DSLPackage.Literals.GREETING__NAME, 21 | // INVALID_NAME) 22 | // } 23 | // } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/src/io/entitas/lang/ui/labeling/DSLDescriptionLabelProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ui.labeling 5 | 6 | import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider 7 | 8 | /** 9 | * Provides labels for IEObjectDescriptions and IResourceDescriptions. 10 | * 11 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider 12 | */ 13 | class DSLDescriptionLabelProvider extends DefaultDescriptionLabelProvider { 14 | 15 | // Labels and icons can be computed like this: 16 | 17 | // override text(IEObjectDescription ele) { 18 | // ele.name.toString 19 | // } 20 | // 21 | // override image(IEObjectDescription ele) { 22 | // ele.EClass.name + '.gif' 23 | // } 24 | } 25 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/validation/DSLValidator.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.validation 5 | 6 | 7 | /** 8 | * This class contains custom validation rules. 9 | * 10 | * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation 11 | */ 12 | class DSLValidator extends AbstractDSLValidator { 13 | 14 | // public static val INVALID_NAME = 'invalidName' 15 | // 16 | // @Check 17 | // def checkGreetingStartsWithCapital(Greeting greeting) { 18 | // if (!Character.isUpperCase(greeting.name.charAt(0))) { 19 | // warning('Name should start with a capital', 20 | // DSLPackage.Literals.GREETING__NAME, 21 | // INVALID_NAME) 22 | // } 23 | // } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/gradle/source-layout.gradle: -------------------------------------------------------------------------------- 1 | sourceSets { 2 | main { 3 | java.srcDirs = ['src/main/java', 'src/main/xtext-gen'] 4 | resources.srcDirs = ['src/main/resources', 'src/main/xtext-gen'] 5 | xtendOutputDir = 'src/main/xtend-gen' 6 | } 7 | test { 8 | java.srcDirs = ['src/test/java', 'src/test/xtext-gen'] 9 | resources.srcDirs = ['src/test/resources', 'src/test/xtext-gen'] 10 | xtendOutputDir = 'src/test/xtend-gen' 11 | } 12 | } 13 | 14 | jar { 15 | from('model') { 16 | into('model') 17 | } 18 | manifest { 19 | attributes 'Bundle-SymbolicName': project.name 20 | } 21 | } 22 | 23 | plugins.withId('war') { 24 | webAppDirName = "src/main/webapp" 25 | } 26 | 27 | plugins.withId('org.xtext.idea-plugin') { 28 | assembleSandbox.metaInf.from('src/main/resources/META-INF') 29 | } 30 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/syntaxes/entitas.tmLanguage: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | *.entitas 8 | 9 | name 10 | entitas 11 | patterns 12 | 13 | 14 | name 15 | keyword.control.entitas 16 | match 17 | \b(target|namespace|context|alias|comp|in|sys|trigger|noFilter|filter|access|allOf|anyOf|noneOf|removed|added|removedOrAdded)\b 18 | 19 | 20 | scopeName 21 | text.entitas 22 | 23 | 24 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/,\ 2 | src-gen/,\ 3 | xtend-gen/ 4 | bin.includes = model/generated/,\ 5 | .,\ 6 | META-INF/,\ 7 | plugin.xml 8 | bin.excludes = **/*.mwe2,\ 9 | **/*.xtend 10 | additional.bundles = org.eclipse.xtext.xbase,\ 11 | org.eclipse.xtext.common.types,\ 12 | org.eclipse.xtext.xtext.generator,\ 13 | org.eclipse.emf.codegen.ecore,\ 14 | org.eclipse.emf.mwe.utils,\ 15 | org.eclipse.emf.mwe2.launch,\ 16 | org.eclipse.emf.mwe2.lib,\ 17 | org.objectweb.asm,\ 18 | org.apache.commons.logging,\ 19 | org.apache.log4j,\ 20 | com.ibm.icu 21 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'application' 2 | 3 | dependencies { 4 | compile project(':io.entitas.lang') 5 | compile "org.eclipse.xtext:org.eclipse.xtext.ide:${xtextVersion}" 6 | compile "org.eclipse.xtext:org.eclipse.xtext.xbase.ide:${xtextVersion}" 7 | } 8 | 9 | // Add a start script for the socket case 10 | mainClassName = 'io.entitas.lang.ide.RunServer' 11 | startScripts { 12 | applicationName = 'entitas-lang-socket' 13 | } 14 | 15 | task standaloneStartScript(type: CreateStartScripts) { 16 | mainClassName = 'io.entitas.lang.ide.ServerLauncher' 17 | applicationName = 'entitas-lang-standalone' 18 | outputDir = new File(project.buildDir, 'scripts') 19 | classpath = jar.outputs.files + project.configurations.runtime 20 | } 21 | 22 | applicationDistribution.into("bin") { 23 | from(standaloneStartScript) 24 | fileMode = 0755 25 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/src/io/entitas/lang/ui/labeling/DSLLabelProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ui.labeling 5 | 6 | import com.google.inject.Inject 7 | import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider 8 | import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider 9 | 10 | /** 11 | * Provides labels for EObjects. 12 | * 13 | * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider 14 | */ 15 | class DSLLabelProvider extends DefaultEObjectLabelProvider { 16 | 17 | @Inject 18 | new(AdapterFactoryLabelProvider delegate) { 19 | super(delegate); 20 | } 21 | 22 | // Labels and icons can be computed like this: 23 | 24 | // def text(Greeting ele) { 25 | // 'A greeting to ' + ele.name 26 | // } 27 | // 28 | // def image(Greeting ele) { 29 | // 'Greeting.gif' 30 | // } 31 | } 32 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/src/io/entitas/lang/ui/quickfix/DSLQuickfixProvider.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ui.quickfix 5 | 6 | import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider 7 | 8 | /** 9 | * Custom quickfixes. 10 | * 11 | * See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#quick-fixes 12 | */ 13 | class DSLQuickfixProvider extends DefaultQuickfixProvider { 14 | 15 | // @Fix(DSLValidator.INVALID_NAME) 16 | // def capitalizeName(Issue issue, IssueResolutionAcceptor acceptor) { 17 | // acceptor.accept(issue, 'Capitalize name', 'Capitalize the name.', 'upcase.png') [ 18 | // context | 19 | // val xtextDocument = context.xtextDocument 20 | // val firstLetter = xtextDocument.get(issue.offset, 1) 21 | // xtextDocument.replace(issue.offset, 1, firstLetter.toUpperCase) 22 | // ] 23 | // } 24 | } 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | runtime-EclipseXtext/.metadata 2 | workspace/.metadata 3 | workspace/io.entitas.lang.eclipse.ide/bin 4 | runtime-EclipseXtext 5 | workspace/io.entitas.lang.eclipse.ui/bin 6 | workspace/io.entitas.lang.eclipse/bin 7 | *._trace 8 | *.xtendbin 9 | EclipsePluginBuild 10 | workspace/io.entitas.lang.parent/build 11 | workspace/io.entitas.lang.parent/io.entitas.lang.ide/bin 12 | workspace/io.entitas.lang.parent/io.entitas.lang.ide/build 13 | workspace/io.entitas.lang.parent/io.entitas.lang/bin 14 | workspace/io.entitas.lang.parent/io.entitas.lang/build 15 | 16 | # Node 17 | node_modules 18 | 19 | # Xtext / Xtend 20 | model 21 | src-gen 22 | xtend-gen 23 | .antlr*.jar 24 | 25 | # Eclipse 26 | # .classpath 27 | # .project 28 | .settings/ 29 | .metadata/ 30 | bin/ 31 | 32 | # IntelliJ 33 | *.iml 34 | *.ipr 35 | *.iws 36 | .idea/ 37 | out/ 38 | 39 | # Gradle 40 | .gradle/ 41 | build/ 42 | !gradle-wrapper.jar 43 | Eclipse.app 44 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.entitas.lang 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.xtext.ui.shared.xtextBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.buildship.core.gradleprojectbuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.buildship.core.gradleprojectnature 26 | org.eclipse.xtext.ui.shared.xtextNature 27 | org.eclipse.jdt.core.javanature 28 | 29 | 30 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.entitas.lang.ide 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.xtext.ui.shared.xtextBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.buildship.core.gradleprojectbuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.buildship.core.gradleprojectnature 26 | org.eclipse.xtext.ui.shared.xtextNature 27 | org.eclipse.jdt.core.javanature 28 | 29 | 30 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/src/io/entitas/lang/GenerateDSL.mwe2: -------------------------------------------------------------------------------- 1 | module io.entitas.lang.GenerateDSL 2 | 3 | import org.eclipse.xtext.xtext.generator.* 4 | import org.eclipse.xtext.xtext.generator.model.project.* 5 | 6 | var rootPath = ".." 7 | 8 | Workflow { 9 | 10 | component = XtextGenerator { 11 | configuration = { 12 | project = StandardProjectConfig { 13 | baseName = "io.entitas.lang.eclipse" 14 | rootPath = rootPath 15 | eclipsePlugin = { 16 | enabled = true 17 | } 18 | createEclipseMetaData = true 19 | } 20 | code = { 21 | encoding = "UTF-8" 22 | lineDelimiter = "\n" 23 | fileHeader = "/*\n * generated by Xtext \${version}\n */" 24 | } 25 | } 26 | language = StandardLanguage { 27 | name = "io.entitas.lang.DSL" 28 | fileExtensions = "entitas" 29 | 30 | serializer = { 31 | generateStub = false 32 | } 33 | validator = { 34 | // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.entitas.lang.eclipse.ui 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.xtext.ui.shared.xtextBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.ManifestBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.pde.SchemaBuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.xtext.ui.shared.xtextNature 31 | org.eclipse.jdt.core.javanature 32 | org.eclipse.pde.PluginNature 33 | 34 | 35 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ide/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.entitas.lang.eclipse.ide 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.xtext.ui.shared.xtextBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.ManifestBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.pde.SchemaBuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.xtext.ui.shared.xtextNature 31 | org.eclipse.jdt.core.javanature 32 | org.eclipse.pde.PluginNature 33 | 34 | 35 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.ui/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: io.entitas.lang.eclipse.ui 4 | Bundle-Vendor: My Company 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-SymbolicName: io.entitas.lang.eclipse.ui; singleton:=true 7 | Bundle-ActivationPolicy: lazy 8 | Require-Bundle: io.entitas.lang.eclipse, 9 | io.entitas.lang.eclipse.ide, 10 | org.eclipse.xtext.ui, 11 | org.eclipse.xtext.ui.shared, 12 | org.eclipse.xtext.ui.codetemplates.ui, 13 | org.eclipse.ui.editors;bundle-version="3.5.0", 14 | org.eclipse.ui.ide;bundle-version="3.5.0", 15 | org.eclipse.ui, 16 | org.eclipse.compare, 17 | org.eclipse.xtext.builder, 18 | org.eclipse.xtend.lib;resolution:=optional, 19 | org.eclipse.xtext.xbase.lib 20 | Import-Package: org.apache.log4j 21 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 22 | Export-Package: io.entitas.lang.eclipse.ui.internal, 23 | io.entitas.lang.ui.contentassist, 24 | io.entitas.lang.ui.quickfix 25 | Bundle-Activator: io.entitas.lang.eclipse.ui.internal.EclipseActivator 26 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: io.entitas.lang.eclipse 4 | Bundle-Vendor: My Company 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-SymbolicName: io.entitas.lang.eclipse; singleton:=true 7 | Bundle-ActivationPolicy: lazy 8 | Require-Bundle: org.eclipse.xtext, 9 | org.eclipse.xtext.xbase, 10 | org.eclipse.equinox.common;bundle-version="3.5.0", 11 | org.eclipse.emf.ecore, 12 | org.eclipse.xtext.xbase.lib, 13 | org.antlr.runtime, 14 | org.eclipse.xtext.util, 15 | org.eclipse.xtend.lib, 16 | org.eclipse.emf.common 17 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 18 | Export-Package: io.entitas.lang.generator, 19 | io.entitas.lang.serializer, 20 | io.entitas.lang.parser.antlr.internal, 21 | io.entitas.lang.parser.antlr, 22 | io.entitas.lang.dsl, 23 | io.entitas.lang.dsl.util, 24 | io.entitas.lang, 25 | io.entitas.lang.validation, 26 | io.entitas.lang.services, 27 | io.entitas.lang.scoping, 28 | io.entitas.lang.dsl.impl 29 | Import-Package: org.apache.log4j 30 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp/FeatureGenerationExtension.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.generator.entitas_csharp 2 | 3 | class FeatureGenerationExtension { 4 | static def featureClass()''' 5 | #if (!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR) 6 | 7 | public class Feature : Entitas.VisualDebugging.Unity.DebugSystems { 8 | 9 | public Feature(string name) : base(name) { 10 | } 11 | 12 | public Feature() : base(true) { 13 | var typeName = DesperateDevs.Utils.SerializationTypeExtension.ToCompilableString(GetType()); 14 | var shortType = DesperateDevs.Utils.SerializationTypeExtension.ShortTypeName(typeName); 15 | var readableType = DesperateDevs.Utils.StringExtension.ToSpacedCamelCase(shortType); 16 | 17 | initialize(readableType); 18 | } 19 | } 20 | 21 | #else 22 | 23 | public class Feature : Entitas.Systems { 24 | 25 | public Feature(string name) { 26 | } 27 | 28 | public Feature() { 29 | } 30 | } 31 | 32 | #endif 33 | 34 | ''' 35 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/GenerateDSL.mwe2: -------------------------------------------------------------------------------- 1 | module io.entitas.lang.GenerateDSL 2 | 3 | import org.eclipse.xtext.xtext.generator.* 4 | import org.eclipse.xtext.xtext.generator.model.project.* 5 | 6 | var rootPath = ".." 7 | 8 | Workflow { 9 | 10 | component = XtextGenerator { 11 | 12 | configuration = { 13 | project = StandardProjectConfig { 14 | baseName = "io.entitas.lang" 15 | rootPath = rootPath 16 | runtimeTest = { 17 | enabled = true 18 | } 19 | genericIde = { 20 | enabled = true 21 | } 22 | mavenLayout = true 23 | } 24 | code = { 25 | encoding = "UTF-8" 26 | lineDelimiter = "\n" 27 | fileHeader = "/*\n * generated by Xtext \${version}\n */" 28 | } 29 | } 30 | language = StandardLanguage { 31 | name = "io.entitas.lang.DSL" 32 | fileExtensions = "entitas" 33 | 34 | serializer = { 35 | generateStub = false 36 | } 37 | validator = { 38 | // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/parser/antlr/internal/InternalDSL.tokens: -------------------------------------------------------------------------------- 1 | '('=13 2 | ')'=14 3 | ','=12 4 | '.'=17 5 | ':'=16 6 | 'access'=30 7 | 'added'=37 8 | 'alias'=21 9 | 'allOf'=39 10 | 'anyOf'=40 11 | 'cleanup'=32 12 | 'comp'=22 13 | 'context'=19 14 | 'default'=20 15 | 'explicit_context_list'=35 16 | 'filter'=29 17 | 'gen_path'=15 18 | 'in'=25 19 | 'init'=31 20 | 'namespace'=18 21 | 'noFilter'=28 22 | 'no_exec'=34 23 | 'noneOf'=41 24 | 'prefix'=23 25 | 'removed'=36 26 | 'removedOrAdded'=38 27 | 'sys'=26 28 | 'target'=11 29 | 'teardown'=33 30 | 'trigger'=27 31 | 'unique'=24 32 | RULE_ANY_OTHER=10 33 | RULE_ID=4 34 | RULE_INT=6 35 | RULE_ML_COMMENT=7 36 | RULE_SL_COMMENT=8 37 | RULE_STRING=5 38 | RULE_WS=9 39 | T__11=11 40 | T__12=12 41 | T__13=13 42 | T__14=14 43 | T__15=15 44 | T__16=16 45 | T__17=17 46 | T__18=18 47 | T__19=19 48 | T__20=20 49 | T__21=21 50 | T__22=22 51 | T__23=23 52 | T__24=24 53 | T__25=25 54 | T__26=26 55 | T__27=27 56 | T__28=28 57 | T__29=29 58 | T__30=30 59 | T__31=31 60 | T__32=32 61 | T__33=33 62 | T__34=34 63 | T__35=35 64 | T__36=36 65 | T__37=37 66 | T__38=38 67 | T__39=39 68 | T__40=40 69 | T__41=41 70 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/xtext-gen/io/entitas/lang/ide/contentassist/antlr/internal/InternalDSL.tokens: -------------------------------------------------------------------------------- 1 | '('=24 2 | ')'=25 3 | ','=23 4 | '.'=28 5 | ':'=27 6 | 'access'=33 7 | 'added'=40 8 | 'alias'=22 9 | 'allOf'=34 10 | 'anyOf'=35 11 | 'cleanup'=14 12 | 'comp'=30 13 | 'context'=29 14 | 'default'=11 15 | 'explicit_context_list'=17 16 | 'filter'=32 17 | 'gen_path'=26 18 | 'in'=21 19 | 'init'=13 20 | 'namespace'=19 21 | 'noFilter'=38 22 | 'no_exec'=16 23 | 'noneOf'=36 24 | 'prefix'=20 25 | 'removed'=39 26 | 'removedOrAdded'=41 27 | 'sys'=31 28 | 'target'=18 29 | 'teardown'=15 30 | 'trigger'=37 31 | 'unique'=12 32 | RULE_ANY_OTHER=10 33 | RULE_ID=4 34 | RULE_INT=6 35 | RULE_ML_COMMENT=7 36 | RULE_SL_COMMENT=8 37 | RULE_STRING=5 38 | RULE_WS=9 39 | T__11=11 40 | T__12=12 41 | T__13=13 42 | T__14=14 43 | T__15=15 44 | T__16=16 45 | T__17=17 46 | T__18=18 47 | T__19=19 48 | T__20=20 49 | T__21=21 50 | T__22=22 51 | T__23=23 52 | T__24=24 53 | T__25=25 54 | T__26=26 55 | T__27=27 56 | T__28=28 57 | T__29=29 58 | T__30=30 59 | T__31=31 60 | T__32=32 61 | T__33=33 62 | T__34=34 63 | T__35=35 64 | T__36=36 65 | T__37=37 66 | T__38=38 67 | T__39=39 68 | T__40=40 69 | T__41=41 70 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/extensions/AccessRuleExtensions.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.extensions 2 | 3 | import io.entitas.lang.dsl.AccessRule 4 | import java.util.HashSet 5 | 6 | import static extension io.entitas.lang.extensions.ComponentExtensions.* 7 | 8 | class AccessRuleExtensions { 9 | public static def contextName(AccessRule rule, String defaultContext){ 10 | if (rule.scope !== null) { 11 | return rule.scope.reference.name 12 | } 13 | if (rule.contextRef !== null){ 14 | return rule.contextRef.name 15 | } 16 | var HashSet result = null 17 | val components = newArrayList() 18 | for (comp : rule.matcherRule.allComponents){ 19 | components.add(comp) 20 | } 21 | for (comp : rule.matcherRule.anyComponents){ 22 | components.add(comp) 23 | } 24 | for (comp : rule.matcherRule.noneComponents){ 25 | components.add(comp) 26 | } 27 | for (comp : components) { 28 | if(result === null) { 29 | result = newHashSet(comp.contextNameList(defaultContext)) 30 | } else { 31 | result.retainAll(comp.contextNameList(defaultContext)) 32 | } 33 | } 34 | if (result.size != 1){ 35 | return null 36 | } 37 | return result.head 38 | } 39 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/extensions/ComponentExtensions.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.extensions 2 | 3 | import io.entitas.lang.dsl.Component 4 | 5 | class ComponentExtensions { 6 | static def componentTypeName(Component component) { 7 | if (component.name.endsWith("Component")) { 8 | return component.name.toFirstUpper 9 | } else { 10 | return component.name.toFirstUpper + "Component" 11 | } 12 | } 13 | 14 | static def componentName(Component component) { 15 | if (component.name.endsWith("Component")) { 16 | return component.name.substring(0, component.name.length - 9).toFirstUpper 17 | } else { 18 | return component.name.toFirstUpper 19 | } 20 | } 21 | 22 | static def isFlag(Component component) { 23 | component.listOfProperties === null 24 | } 25 | 26 | static def isUnique(Component component) { 27 | component.parameters.contains("unique") 28 | } 29 | 30 | static def contextNameList(Component component, String defaultContext){ 31 | if(component.scope === null){ 32 | if(defaultContext !== null){ 33 | return newLinkedList(defaultContext) 34 | } 35 | return newLinkedList() 36 | } 37 | 38 | return component.scope.references.map[it.name] 39 | } 40 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/parser/antlr/DSLParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.parser.antlr; 5 | 6 | import com.google.inject.Inject; 7 | import io.entitas.lang.parser.antlr.internal.InternalDSLParser; 8 | import io.entitas.lang.services.DSLGrammarAccess; 9 | import org.eclipse.xtext.parser.antlr.AbstractAntlrParser; 10 | import org.eclipse.xtext.parser.antlr.XtextTokenStream; 11 | 12 | public class DSLParser extends AbstractAntlrParser { 13 | 14 | @Inject 15 | private DSLGrammarAccess grammarAccess; 16 | 17 | @Override 18 | protected void setInitialHiddenTokens(XtextTokenStream tokenStream) { 19 | tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT"); 20 | } 21 | 22 | 23 | @Override 24 | protected InternalDSLParser createParser(XtextTokenStream stream) { 25 | return new InternalDSLParser(stream, getGrammarAccess()); 26 | } 27 | 28 | @Override 29 | protected String getDefaultRuleName() { 30 | return "Root"; 31 | } 32 | 33 | public DSLGrammarAccess getGrammarAccess() { 34 | return this.grammarAccess; 35 | } 36 | 37 | public void setGrammarAccess(DSLGrammarAccess grammarAccess) { 38 | this.grammarAccess = grammarAccess; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/.launch/Generate DSL (entitas) Language Infrastructure.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/build.gradle: -------------------------------------------------------------------------------- 1 | task copyApplication(type: Sync) { 2 | def installDistTask = project(':io.entitas.lang.ide').tasks.installDist 3 | dependsOn installDistTask 4 | from installDistTask.outputs 5 | into 'src/entitas_lang' 6 | } 7 | 8 | clean { 9 | doLast { 10 | delete copyApplication.outputs 11 | } 12 | } 13 | 14 | npmInstall.dependsOn copyApplication 15 | 16 | task installExtension(type: Exec, dependsOn: vscodeExtension) { 17 | if (System.properties['os.name'].toLowerCase().contains('windows')) { 18 | commandLine 'code.cmd' 19 | } else { 20 | commandLine 'code' 21 | } 22 | args '--install-extension', vscodeExtension.destPath 23 | } 24 | 25 | task startCode(type:Exec, dependsOn: installExtension) { 26 | if (System.properties['os.name'].toLowerCase().contains('windows')) { 27 | commandLine 'code.cmd' 28 | } else { 29 | commandLine 'code' 30 | } 31 | args "$rootProject.projectDir/demo/", '--new-window' 32 | } 33 | 34 | task publish(dependsOn: vscodeExtension, type: NodeTask) { 35 | script = file("$rootProject.projectDir/node_modules/vsce/out/vsce") 36 | args = [ 'publish', '-p', System.getenv('ACCESS_TOKEN'), project.version ] 37 | execOverrides { 38 | workingDir = projectDir 39 | } 40 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/test/java/io/entitas/lang/tests/ContextExtensionTest.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.tests 5 | 6 | import com.google.inject.Inject 7 | import org.eclipse.xtext.testing.InjectWith 8 | import org.eclipse.xtext.testing.XtextRunner 9 | import org.eclipse.xtext.testing.util.ParseHelper 10 | import org.junit.Assert 11 | import org.junit.Test 12 | import org.junit.runner.RunWith 13 | import io.entitas.lang.dsl.Root 14 | import static extension io.entitas.lang.extensions.ContextExtensions.* 15 | 16 | @RunWith(XtextRunner) 17 | @InjectWith(DSLInjectorProvider) 18 | class ContextExtensionTest { 19 | @Inject 20 | ParseHelper parseHelper 21 | 22 | @Test 23 | def void deafultContext() { 24 | val result = parseHelper.parse(''' 25 | target T 26 | context A, B, C(default), D 27 | ''') 28 | Assert.assertNotNull(result) 29 | Assert.assertTrue(result.eResource.errors.isEmpty) 30 | 31 | Assert.assertEquals("C", result.context.defaultContextName) 32 | } 33 | 34 | @Test 35 | def void firstContextAsDefualt() { 36 | val result = parseHelper.parse(''' 37 | target T 38 | context A, B, C, D 39 | ''') 40 | Assert.assertNotNull(result) 41 | Assert.assertTrue(result.eResource.errors.isEmpty) 42 | 43 | Assert.assertEquals("A", result.context.defaultContextName) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/Target.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.common.util.EList; 7 | 8 | import org.eclipse.emf.ecore.EObject; 9 | 10 | /** 11 | * 12 | * A representation of the model object 'Target'. 13 | * 14 | * 15 | *

16 | * The following features are supported: 17 | *

18 | *
    19 | *
  • {@link io.entitas.lang.dsl.Target#getIds Ids}
  • 20 | *
21 | * 22 | * @see io.entitas.lang.dsl.DslPackage#getTarget() 23 | * @model 24 | * @generated 25 | */ 26 | public interface Target extends EObject 27 | { 28 | /** 29 | * Returns the value of the 'Ids' containment reference list. 30 | * The list contents are of type {@link io.entitas.lang.dsl.TargetId}. 31 | * 32 | *

33 | * If the meaning of the 'Ids' containment reference list isn't clear, 34 | * there really should be more of a description here... 35 | *

36 | * 37 | * @return the value of the 'Ids' containment reference list. 38 | * @see io.entitas.lang.dsl.DslPackage#getTarget_Ids() 39 | * @model containment="true" 40 | * @generated 41 | */ 42 | EList getIds(); 43 | 44 | } // Target 45 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/Context.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.common.util.EList; 7 | 8 | import org.eclipse.emf.ecore.EObject; 9 | 10 | /** 11 | * 12 | * A representation of the model object 'Context'. 13 | * 14 | * 15 | *

16 | * The following features are supported: 17 | *

18 | *
    19 | *
  • {@link io.entitas.lang.dsl.Context#getIds Ids}
  • 20 | *
21 | * 22 | * @see io.entitas.lang.dsl.DslPackage#getContext() 23 | * @model 24 | * @generated 25 | */ 26 | public interface Context extends EObject 27 | { 28 | /** 29 | * Returns the value of the 'Ids' containment reference list. 30 | * The list contents are of type {@link io.entitas.lang.dsl.ContextId}. 31 | * 32 | *

33 | * If the meaning of the 'Ids' containment reference list isn't clear, 34 | * there really should be more of a description here... 35 | *

36 | * 37 | * @return the value of the 'Ids' containment reference list. 38 | * @see io.entitas.lang.dsl.DslPackage#getContext_Ids() 39 | * @model containment="true" 40 | * @generated 41 | */ 42 | EList getIds(); 43 | 44 | } // Context 45 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | testCompile "junit:junit:4.12" 3 | testCompile "org.eclipse.xtext:org.eclipse.xtext.testing:${xtextVersion}" 4 | testCompile "org.eclipse.xtext:org.eclipse.xtext.xbase.testing:${xtextVersion}" 5 | compile "org.eclipse.xtext:org.eclipse.xtext:${xtextVersion}" 6 | compile "org.eclipse.xtext:org.eclipse.xtext.xbase:${xtextVersion}" 7 | } 8 | configurations { 9 | mwe2 { 10 | extendsFrom compile 11 | } 12 | } 13 | 14 | dependencies { 15 | mwe2 "org.eclipse.emf:org.eclipse.emf.mwe2.launch:2.9.0.201605261059" 16 | mwe2 "org.eclipse.xtext:org.eclipse.xtext.common.types:${xtextVersion}" 17 | mwe2 "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}" 18 | mwe2 "org.eclipse.xtext:xtext-antlr-generator:[2.1.1, 3)" 19 | } 20 | 21 | task generateXtextLanguage(type: JavaExec) { 22 | main = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher' 23 | classpath = configurations.mwe2 24 | inputs.file "src/main/java/io/entitas/lang/GenerateDSL.mwe2" 25 | inputs.file "src/main/java/io/entitas/lang/DSL.xtext" 26 | outputs.dir "src/main/xtext-gen" 27 | args += "src/main/java/io/entitas/lang/GenerateDSL.mwe2" 28 | args += "-p" 29 | args += "rootPath=/${projectDir}/.." 30 | } 31 | 32 | generateXtext.dependsOn(generateXtextLanguage) 33 | clean.dependsOn(cleanGenerateXtextLanguage) 34 | eclipse.classpath.plusConfigurations += [configurations.mwe2] 35 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/AliasList.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.common.util.EList; 7 | 8 | import org.eclipse.emf.ecore.EObject; 9 | 10 | /** 11 | * 12 | * A representation of the model object 'Alias List'. 13 | * 14 | * 15 | *

16 | * The following features are supported: 17 | *

18 | *
    19 | *
  • {@link io.entitas.lang.dsl.AliasList#getRules Rules}
  • 20 | *
21 | * 22 | * @see io.entitas.lang.dsl.DslPackage#getAliasList() 23 | * @model 24 | * @generated 25 | */ 26 | public interface AliasList extends EObject 27 | { 28 | /** 29 | * Returns the value of the 'Rules' containment reference list. 30 | * The list contents are of type {@link io.entitas.lang.dsl.AliasRule}. 31 | * 32 | *

33 | * If the meaning of the 'Rules' containment reference list isn't clear, 34 | * there really should be more of a description here... 35 | *

36 | * 37 | * @return the value of the 'Rules' containment reference list. 38 | * @see io.entitas.lang.dsl.DslPackage#getAliasList_Rules() 39 | * @model containment="true" 40 | * @generated 41 | */ 42 | EList getRules(); 43 | 44 | } // AliasList 45 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/ContextScopes.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.common.util.EList; 7 | 8 | import org.eclipse.emf.ecore.EObject; 9 | 10 | /** 11 | * 12 | * A representation of the model object 'Context Scopes'. 13 | * 14 | * 15 | *

16 | * The following features are supported: 17 | *

18 | *
    19 | *
  • {@link io.entitas.lang.dsl.ContextScopes#getReferences References}
  • 20 | *
21 | * 22 | * @see io.entitas.lang.dsl.DslPackage#getContextScopes() 23 | * @model 24 | * @generated 25 | */ 26 | public interface ContextScopes extends EObject 27 | { 28 | /** 29 | * Returns the value of the 'References' reference list. 30 | * The list contents are of type {@link io.entitas.lang.dsl.ContextId}. 31 | * 32 | *

33 | * If the meaning of the 'References' reference list isn't clear, 34 | * there really should be more of a description here... 35 | *

36 | * 37 | * @return the value of the 'References' reference list. 38 | * @see io.entitas.lang.dsl.DslPackage#getContextScopes_References() 39 | * @model 40 | * @generated 41 | */ 42 | EList getReferences(); 43 | 44 | } // ContextScopes 45 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/xtext-gen/io/entitas/lang/ide/contentassist/antlr/PartialDSLContentAssistParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ide.contentassist.antlr; 5 | 6 | import java.util.Collection; 7 | import java.util.Collections; 8 | import org.eclipse.xtext.AbstractRule; 9 | import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement; 10 | import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; 11 | import org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser; 12 | import org.eclipse.xtext.util.PolymorphicDispatcher; 13 | 14 | public class PartialDSLContentAssistParser extends DSLParser implements IPartialEditingContentAssistParser { 15 | 16 | private AbstractRule rule; 17 | 18 | @Override 19 | public void initializeFor(AbstractRule rule) { 20 | this.rule = rule; 21 | } 22 | 23 | @Override 24 | protected Collection getFollowElements(AbstractInternalContentAssistParser parser) { 25 | if (rule == null || rule.eIsProxy()) 26 | return Collections.emptyList(); 27 | String methodName = "entryRule" + rule.getName(); 28 | PolymorphicDispatcher> dispatcher = 29 | new PolymorphicDispatcher>(methodName, 0, 0, Collections.singletonList(parser)); 30 | dispatcher.invoke(); 31 | return parser.getFollowElements(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/PropertyList.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.common.util.EList; 7 | 8 | import org.eclipse.emf.ecore.EObject; 9 | 10 | /** 11 | * 12 | * A representation of the model object 'Property List'. 13 | * 14 | * 15 | *

16 | * The following features are supported: 17 | *

18 | *
    19 | *
  • {@link io.entitas.lang.dsl.PropertyList#getRules Rules}
  • 20 | *
21 | * 22 | * @see io.entitas.lang.dsl.DslPackage#getPropertyList() 23 | * @model 24 | * @generated 25 | */ 26 | public interface PropertyList extends EObject 27 | { 28 | /** 29 | * Returns the value of the 'Rules' containment reference list. 30 | * The list contents are of type {@link io.entitas.lang.dsl.PropertyRules}. 31 | * 32 | *

33 | * If the meaning of the 'Rules' containment reference list isn't clear, 34 | * there really should be more of a description here... 35 | *

36 | * 37 | * @return the value of the 'Rules' containment reference list. 38 | * @see io.entitas.lang.dsl.DslPackage#getPropertyList_Rules() 39 | * @model containment="true" 40 | * @generated 41 | */ 42 | EList getRules(); 43 | 44 | } // PropertyList 45 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.entitas.lang.eclipse 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.xtext.ui.shared.xtextBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.ManifestBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.pde.SchemaBuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.xtext.ui.shared.xtextNature 31 | org.eclipse.jdt.core.javanature 32 | org.eclipse.pde.PluginNature 33 | 34 | 35 | 36 | src/io/entitas/lang/extensions 37 | 2 38 | PARENT-1-PROJECT_LOC/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/extensions 39 | 40 | 41 | src/io/entitas/lang/generator/entitas_csharp 42 | 2 43 | PARENT-1-PROJECT_LOC/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/generator/entitas_csharp 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/test/java/io/entitas/lang/tests/AliasExtensionTest.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.tests 5 | 6 | import com.google.inject.Inject 7 | import org.eclipse.xtext.testing.InjectWith 8 | import org.eclipse.xtext.testing.XtextRunner 9 | import org.eclipse.xtext.testing.util.ParseHelper 10 | import org.junit.Assert 11 | import org.junit.Test 12 | import org.junit.runner.RunWith 13 | import io.entitas.lang.dsl.Root 14 | import static extension io.entitas.lang.extensions.AliasExtensions.* 15 | 16 | @RunWith(XtextRunner) 17 | @InjectWith(DSLInjectorProvider) 18 | class AliasExtensionTest { 19 | @Inject 20 | ParseHelper parseHelper 21 | 22 | @Test 23 | def void aliasTypeSingle() { 24 | val result = parseHelper.parse(''' 25 | target A 26 | alias int : "int" 27 | ''') 28 | Assert.assertNotNull(result) 29 | Assert.assertTrue(result.eResource.errors.isEmpty) 30 | 31 | Assert.assertEquals("int", result.typeAliases.get(0).typeName) 32 | } 33 | 34 | @Test 35 | def void aliasTypeMultiple() { 36 | val result = parseHelper.parse(''' 37 | target A, B 38 | alias int 39 | A : "int" 40 | B : "Integer" 41 | ''') 42 | Assert.assertNotNull(result) 43 | Assert.assertTrue(result.eResource.errors.isEmpty) 44 | 45 | Assert.assertEquals(null, result.typeAliases.get(0).typeName) 46 | Assert.assertEquals("int", result.typeAliases.get(0).typeName("A")) 47 | Assert.assertEquals("Integer", result.typeAliases.get(0).typeName("B")) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/.launch/Generate DSL (entitas) Language Infrastructure.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/Namespace.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Namespace'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.Namespace#getName Name}
  • 18 | *
19 | * 20 | * @see io.entitas.lang.dsl.DslPackage#getNamespace() 21 | * @model 22 | * @generated 23 | */ 24 | public interface Namespace extends EObject 25 | { 26 | /** 27 | * Returns the value of the 'Name' attribute. 28 | * 29 | *

30 | * If the meaning of the 'Name' attribute isn't clear, 31 | * there really should be more of a description here... 32 | *

33 | * 34 | * @return the value of the 'Name' attribute. 35 | * @see #setName(String) 36 | * @see io.entitas.lang.dsl.DslPackage#getNamespace_Name() 37 | * @model 38 | * @generated 39 | */ 40 | String getName(); 41 | 42 | /** 43 | * Sets the value of the '{@link io.entitas.lang.dsl.Namespace#getName Name}' attribute. 44 | * 45 | * 46 | * @param value the new value of the 'Name' attribute. 47 | * @see #getName() 48 | * @generated 49 | */ 50 | void setName(String value); 51 | 52 | } // Namespace 53 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import * as path from 'path'; 4 | import * as os from 'os'; 5 | 6 | import {Trace} from 'vscode-jsonrpc'; 7 | import { workspace, ExtensionContext } from 'vscode'; 8 | import { LanguageClient, LanguageClientOptions, ServerOptions } from 'vscode-languageclient'; 9 | 10 | export function activate(context: ExtensionContext) { 11 | // The server is a locally installed in src/entitas_lang 12 | let launcher = os.platform() === 'win32' ? 'entitas-lang-standalone.bat' : 'entitas-lang-standalone'; 13 | let script = context.asAbsolutePath(path.join('src', 'entitas_lang', 'bin', launcher)); 14 | 15 | let serverOptions: ServerOptions = { 16 | run : { command: script }, 17 | debug: { command: script, args: ['-Xdebug','-Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n,quiet=y','-Xmx256m'] } 18 | }; 19 | 20 | let clientOptions: LanguageClientOptions = { 21 | documentSelector: ['entitas'], 22 | synchronize: { 23 | fileEvents: workspace.createFileSystemWatcher('**/*.*') 24 | } 25 | }; 26 | 27 | // Create the language client and start the client. 28 | let lc = new LanguageClient('Entitas Lang Server', serverOptions, clientOptions); 29 | // enable tracing (.Off, .Messages, Verbose) 30 | lc.trace = Trace.Off; 31 | let disposable = lc.start(); 32 | 33 | // Push the disposable to the context's subscriptions so that the 34 | // client can be deactivated on extension deactivation 35 | context.subscriptions.push(disposable); 36 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/TargetParameter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Target Parameter'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.TargetParameter#getPath Path}
  • 18 | *
19 | * 20 | * @see io.entitas.lang.dsl.DslPackage#getTargetParameter() 21 | * @model 22 | * @generated 23 | */ 24 | public interface TargetParameter extends EObject 25 | { 26 | /** 27 | * Returns the value of the 'Path' attribute. 28 | * 29 | *

30 | * If the meaning of the 'Path' attribute isn't clear, 31 | * there really should be more of a description here... 32 | *

33 | * 34 | * @return the value of the 'Path' attribute. 35 | * @see #setPath(String) 36 | * @see io.entitas.lang.dsl.DslPackage#getTargetParameter_Path() 37 | * @model 38 | * @generated 39 | */ 40 | String getPath(); 41 | 42 | /** 43 | * Sets the value of the '{@link io.entitas.lang.dsl.TargetParameter#getPath Path}' attribute. 44 | * 45 | * 46 | * @param value the new value of the 'Path' attribute. 47 | * @see #getPath() 48 | * @generated 49 | */ 50 | void setPath(String value); 51 | 52 | } // TargetParameter 53 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/PropertyPrefix.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Property Prefix'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.PropertyPrefix#getString String}
  • 18 | *
19 | * 20 | * @see io.entitas.lang.dsl.DslPackage#getPropertyPrefix() 21 | * @model 22 | * @generated 23 | */ 24 | public interface PropertyPrefix extends EObject 25 | { 26 | /** 27 | * Returns the value of the 'String' attribute. 28 | * 29 | *

30 | * If the meaning of the 'String' attribute isn't clear, 31 | * there really should be more of a description here... 32 | *

33 | * 34 | * @return the value of the 'String' attribute. 35 | * @see #setString(String) 36 | * @see io.entitas.lang.dsl.DslPackage#getPropertyPrefix_String() 37 | * @model 38 | * @generated 39 | */ 40 | String getString(); 41 | 42 | /** 43 | * Sets the value of the '{@link io.entitas.lang.dsl.PropertyPrefix#getString String}' attribute. 44 | * 45 | * 46 | * @param value the new value of the 'String' attribute. 47 | * @see #getString() 48 | * @generated 49 | */ 50 | void setString(String value); 51 | 52 | } // PropertyPrefix 53 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/SingleAlias.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Single Alias'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.SingleAlias#getTypeAlias Type Alias}
  • 18 | *
19 | * 20 | * @see io.entitas.lang.dsl.DslPackage#getSingleAlias() 21 | * @model 22 | * @generated 23 | */ 24 | public interface SingleAlias extends EObject 25 | { 26 | /** 27 | * Returns the value of the 'Type Alias' attribute. 28 | * 29 | *

30 | * If the meaning of the 'Type Alias' attribute isn't clear, 31 | * there really should be more of a description here... 32 | *

33 | * 34 | * @return the value of the 'Type Alias' attribute. 35 | * @see #setTypeAlias(String) 36 | * @see io.entitas.lang.dsl.DslPackage#getSingleAlias_TypeAlias() 37 | * @model 38 | * @generated 39 | */ 40 | String getTypeAlias(); 41 | 42 | /** 43 | * Sets the value of the '{@link io.entitas.lang.dsl.SingleAlias#getTypeAlias Type Alias}' attribute. 44 | * 45 | * 46 | * @param value the new value of the 'Type Alias' attribute. 47 | * @see #getTypeAlias() 48 | * @generated 49 | */ 50 | void setTypeAlias(String value); 51 | 52 | } // SingleAlias 53 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/ContextScope.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Context Scope'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.ContextScope#getReference Reference}
  • 18 | *
19 | * 20 | * @see io.entitas.lang.dsl.DslPackage#getContextScope() 21 | * @model 22 | * @generated 23 | */ 24 | public interface ContextScope extends EObject 25 | { 26 | /** 27 | * Returns the value of the 'Reference' reference. 28 | * 29 | *

30 | * If the meaning of the 'Reference' reference isn't clear, 31 | * there really should be more of a description here... 32 | *

33 | * 34 | * @return the value of the 'Reference' reference. 35 | * @see #setReference(ContextId) 36 | * @see io.entitas.lang.dsl.DslPackage#getContextScope_Reference() 37 | * @model 38 | * @generated 39 | */ 40 | ContextId getReference(); 41 | 42 | /** 43 | * Sets the value of the '{@link io.entitas.lang.dsl.ContextScope#getReference Reference}' reference. 44 | * 45 | * 46 | * @param value the new value of the 'Reference' reference. 47 | * @see #getReference() 48 | * @generated 49 | */ 50 | void setReference(ContextId value); 51 | 52 | } // ContextScope 53 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/DSLStandaloneSetupGenerated.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang; 5 | 6 | import com.google.inject.Guice; 7 | import com.google.inject.Injector; 8 | import io.entitas.lang.dsl.DslPackage; 9 | import org.eclipse.emf.ecore.EPackage; 10 | import org.eclipse.emf.ecore.resource.Resource; 11 | import org.eclipse.xtext.ISetup; 12 | import org.eclipse.xtext.common.TerminalsStandaloneSetup; 13 | import org.eclipse.xtext.resource.IResourceFactory; 14 | import org.eclipse.xtext.resource.IResourceServiceProvider; 15 | 16 | @SuppressWarnings("all") 17 | public class DSLStandaloneSetupGenerated implements ISetup { 18 | 19 | @Override 20 | public Injector createInjectorAndDoEMFRegistration() { 21 | TerminalsStandaloneSetup.doSetup(); 22 | 23 | Injector injector = createInjector(); 24 | register(injector); 25 | return injector; 26 | } 27 | 28 | public Injector createInjector() { 29 | return Guice.createInjector(new DSLRuntimeModule()); 30 | } 31 | 32 | public void register(Injector injector) { 33 | if (!EPackage.Registry.INSTANCE.containsKey("http://www.entitas.io/lang/DSL")) { 34 | EPackage.Registry.INSTANCE.put("http://www.entitas.io/lang/DSL", DslPackage.eINSTANCE); 35 | } 36 | IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class); 37 | IResourceServiceProvider serviceProvider = injector.getInstance(IResourceServiceProvider.class); 38 | 39 | Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("entitas", resourceFactory); 40 | IResourceServiceProvider.Registry.INSTANCE.getExtensionToFactoryMap().put("entitas", serviceProvider); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/test/java/io/entitas/lang/tests/FeatureGenerationExtensionTest.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.tests 5 | 6 | import com.google.inject.Inject 7 | import org.eclipse.xtext.testing.InjectWith 8 | import org.eclipse.xtext.testing.XtextRunner 9 | import org.eclipse.xtext.testing.util.ParseHelper 10 | import org.junit.Assert 11 | import org.junit.Test 12 | import org.junit.runner.RunWith 13 | import io.entitas.lang.dsl.Root 14 | import io.entitas.lang.generator.entitas_csharp.FeatureGenerationExtension 15 | 16 | @RunWith(XtextRunner) 17 | @InjectWith(DSLInjectorProvider) 18 | class FeatureGenerationExtensionTest { 19 | @Inject 20 | ParseHelper parseHelper 21 | 22 | @Test 23 | def void featureClass() { 24 | Assert.assertEquals(''' 25 | #if (!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR) 26 | 27 | public class Feature : Entitas.VisualDebugging.Unity.DebugSystems { 28 | 29 | public Feature(string name) : base(name) { 30 | } 31 | 32 | public Feature() : base(true) { 33 | var typeName = DesperateDevs.Utils.SerializationTypeExtension.ToCompilableString(GetType()); 34 | var shortType = DesperateDevs.Utils.SerializationTypeExtension.ShortTypeName(typeName); 35 | var readableType = DesperateDevs.Utils.StringExtension.ToSpacedCamelCase(shortType); 36 | 37 | initialize(readableType); 38 | } 39 | } 40 | 41 | #else 42 | 43 | public class Feature : Entitas.Systems { 44 | 45 | public Feature(string name) { 46 | } 47 | 48 | public Feature() { 49 | } 50 | } 51 | 52 | #endif 53 | 54 | '''.toString, 55 | FeatureGenerationExtension.featureClass().toString) 56 | 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/vscode-extension-self-contained/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "entitas-lang", 3 | "displayName": "Entitas Lang", 4 | "description": "Domain specific languge for Entitas framework", 5 | "version": "0.37.0", 6 | "publisher": "mzaks", 7 | "icon": "images/icon.png", 8 | "license": "MIT", 9 | "repository" : { 10 | "type" : "git", 11 | "url" : "https://github.com/mzaks/ECS-Lang.git" 12 | }, 13 | "bugs": { 14 | "url": "https://github.com/mzaks/ECS-Lang/issues" 15 | }, 16 | "engines": { 17 | "vscode": "^1.7.0" 18 | }, 19 | "categories": [ 20 | "Languages" 21 | ], 22 | "activationEvents": [ 23 | "onLanguage:entitas" 24 | ], 25 | "main": "out/extension", 26 | "contributes": { 27 | "languages": [ 28 | { 29 | "id": "entitas", 30 | "aliases": [ 31 | "entitas" 32 | ], 33 | "extensions": [ 34 | ".entitas" 35 | ], 36 | "configuration": "./entitas.configuration.json" 37 | } 38 | ], 39 | "grammars": [ 40 | { 41 | "language": "entitas", 42 | "scopeName": "text.entitas", 43 | "path": "./syntaxes/entitas.tmLanguage" 44 | } 45 | ] 46 | }, 47 | "devDependencies": { 48 | "typescript": "^2.0.3", 49 | "vscode": "^1.0.0", 50 | "@types/node": "^6.0.42" 51 | }, 52 | "dependencies": { 53 | "vscode-jsonrpc": "^3.0.1-alpha.3", 54 | "vscode-languageserver-types": "^3.0.1-alpha.5", 55 | "vscode-languageclient": "^3.0.1-alpha.7" 56 | }, 57 | "scripts": { 58 | "prepublish": "node ./node_modules/vscode/bin/install && tsc -p ./src", 59 | "compile": "tsc -p ./src", 60 | "watch": "tsc -w -p ./src", 61 | "update-vscode": "node ./node_modules/vscode/bin/install" 62 | } 63 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/xtext-gen/io/entitas/lang/ide/AbstractDSLIdeModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.ide; 5 | 6 | import com.google.inject.Binder; 7 | import com.google.inject.name.Names; 8 | import io.entitas.lang.ide.contentassist.antlr.DSLParser; 9 | import io.entitas.lang.ide.contentassist.antlr.internal.InternalDSLLexer; 10 | import org.eclipse.xtext.ide.DefaultIdeModule; 11 | import org.eclipse.xtext.ide.LexerIdeBindings; 12 | import org.eclipse.xtext.ide.editor.contentassist.FQNPrefixMatcher; 13 | import org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher; 14 | import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper; 15 | import org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper; 16 | import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser; 17 | import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; 18 | 19 | /** 20 | * Manual modifications go to {@link DSLIdeModule}. 21 | */ 22 | @SuppressWarnings("all") 23 | public abstract class AbstractDSLIdeModule extends DefaultIdeModule { 24 | 25 | // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 26 | public void configureContentAssistLexer(Binder binder) { 27 | binder.bind(Lexer.class) 28 | .annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST)) 29 | .to(InternalDSLLexer.class); 30 | } 31 | 32 | // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 33 | public Class bindIContentAssistParser() { 34 | return DSLParser.class; 35 | } 36 | 37 | // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 38 | public Class bindIProposalConflictHelper() { 39 | return AntlrProposalConflictHelper.class; 40 | } 41 | 42 | // contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2 43 | public Class bindIPrefixMatcher() { 44 | return FQNPrefixMatcher.class; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/test/xtext-gen/io/entitas/lang/tests/DSLInjectorProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.tests; 5 | 6 | import com.google.inject.Guice; 7 | import com.google.inject.Injector; 8 | import io.entitas.lang.DSLRuntimeModule; 9 | import io.entitas.lang.DSLStandaloneSetup; 10 | import org.eclipse.xtext.testing.GlobalRegistries; 11 | import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento; 12 | import org.eclipse.xtext.testing.IInjectorProvider; 13 | import org.eclipse.xtext.testing.IRegistryConfigurator; 14 | 15 | public class DSLInjectorProvider implements IInjectorProvider, IRegistryConfigurator { 16 | 17 | protected GlobalStateMemento stateBeforeInjectorCreation; 18 | protected GlobalStateMemento stateAfterInjectorCreation; 19 | protected Injector injector; 20 | 21 | static { 22 | GlobalRegistries.initializeDefaults(); 23 | } 24 | 25 | @Override 26 | public Injector getInjector() { 27 | if (injector == null) { 28 | stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); 29 | this.injector = internalCreateInjector(); 30 | stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState(); 31 | } 32 | return injector; 33 | } 34 | 35 | protected Injector internalCreateInjector() { 36 | return new DSLStandaloneSetup() { 37 | @Override 38 | public Injector createInjector() { 39 | return Guice.createInjector(createRuntimeModule()); 40 | } 41 | }.createInjectorAndDoEMFRegistration(); 42 | } 43 | 44 | protected DSLRuntimeModule createRuntimeModule() { 45 | // make it work also with Maven/Tycho and OSGI 46 | // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672 47 | return new DSLRuntimeModule() { 48 | @Override 49 | public ClassLoader bindClassLoaderToInstance() { 50 | return DSLInjectorProvider.class 51 | .getClassLoader(); 52 | } 53 | }; 54 | } 55 | 56 | @Override 57 | public void restoreRegistry() { 58 | stateBeforeInjectorCreation.restoreGlobalState(); 59 | } 60 | 61 | @Override 62 | public void setupRegistry() { 63 | getInjector(); 64 | stateAfterInjectorCreation.restoreGlobalState(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/java/io/entitas/lang/ide/MultiProjectServerLauncher.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.ide 2 | 3 | import com.google.inject.Guice 4 | import java.io.ByteArrayInputStream 5 | import java.io.ByteArrayOutputStream 6 | import java.io.FileOutputStream 7 | import java.io.InputStream 8 | import java.io.OutputStream 9 | import java.io.PrintStream 10 | import java.io.PrintWriter 11 | import java.sql.Timestamp 12 | import javax.inject.Inject 13 | import org.eclipse.lsp4j.jsonrpc.Launcher 14 | import org.eclipse.lsp4j.services.LanguageClient 15 | import org.eclipse.xtext.ide.server.LanguageServerImpl 16 | import org.eclipse.xtext.ide.server.ServerModule 17 | import com.google.inject.util.Modules 18 | 19 | class MultiProjectServerLauncher { 20 | 21 | private static boolean IS_DEBUG = false 22 | 23 | def static void main(String[] args) { 24 | val stdin = System.in 25 | val stdout = System.out 26 | redirectStandardStreams() 27 | val launcher = Guice.createInjector(Modules.override(new ServerModule()).with(new CustomServerModule())).getInstance(ServerLauncher) 28 | launcher.start(stdin, stdout) 29 | } 30 | 31 | @Inject LanguageServerImpl languageServer 32 | 33 | def void start(InputStream in, OutputStream out) { 34 | System.err.println("Starting Xtext Language Server.") 35 | val launcher = Launcher.createLauncher(languageServer, LanguageClient, in, out, true, new PrintWriter(System.out)) 36 | languageServer.connect(launcher.remoteProxy) 37 | val future = launcher.startListening 38 | System.err.println("started.") 39 | while (!future.done) { 40 | Thread.sleep(10_000l) 41 | } 42 | } 43 | 44 | def static redirectStandardStreams() { 45 | System.setIn(new ByteArrayInputStream(newByteArrayOfSize(0))) 46 | val id = org.eclipse.xtext.ide.server.ServerLauncher.name + "-" + new Timestamp(System.currentTimeMillis) 47 | if (IS_DEBUG) { 48 | val stdFileOut = new FileOutputStream("out-" + id + ".log") 49 | System.setOut(new PrintStream(stdFileOut)) 50 | val stdFileErr = new FileOutputStream("error-" + id + ".log") 51 | System.setErr(new PrintStream(stdFileErr)) 52 | } else { 53 | System.setOut(new PrintStream(new ByteArrayOutputStream())) 54 | System.setErr(new PrintStream(new ByteArrayOutputStream())) 55 | } 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/ContextId.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.common.util.EList; 7 | 8 | import org.eclipse.emf.ecore.EObject; 9 | 10 | /** 11 | * 12 | * A representation of the model object 'Context Id'. 13 | * 14 | * 15 | *

16 | * The following features are supported: 17 | *

18 | *
    19 | *
  • {@link io.entitas.lang.dsl.ContextId#getName Name}
  • 20 | *
  • {@link io.entitas.lang.dsl.ContextId#getParameters Parameters}
  • 21 | *
22 | * 23 | * @see io.entitas.lang.dsl.DslPackage#getContextId() 24 | * @model 25 | * @generated 26 | */ 27 | public interface ContextId extends EObject 28 | { 29 | /** 30 | * Returns the value of the 'Name' attribute. 31 | * 32 | *

33 | * If the meaning of the 'Name' attribute isn't clear, 34 | * there really should be more of a description here... 35 | *

36 | * 37 | * @return the value of the 'Name' attribute. 38 | * @see #setName(String) 39 | * @see io.entitas.lang.dsl.DslPackage#getContextId_Name() 40 | * @model 41 | * @generated 42 | */ 43 | String getName(); 44 | 45 | /** 46 | * Sets the value of the '{@link io.entitas.lang.dsl.ContextId#getName Name}' attribute. 47 | * 48 | * 49 | * @param value the new value of the 'Name' attribute. 50 | * @see #getName() 51 | * @generated 52 | */ 53 | void setName(String value); 54 | 55 | /** 56 | * Returns the value of the 'Parameters' attribute list. 57 | * The list contents are of type {@link java.lang.String}. 58 | * 59 | *

60 | * If the meaning of the 'Parameters' attribute list isn't clear, 61 | * there really should be more of a description here... 62 | *

63 | * 64 | * @return the value of the 'Parameters' attribute list. 65 | * @see io.entitas.lang.dsl.DslPackage#getContextId_Parameters() 66 | * @model unique="false" 67 | * @generated 68 | */ 69 | EList getParameters(); 70 | 71 | } // ContextId 72 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/java/io/entitas/lang/ide/ServerLauncher.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.ide 2 | 3 | import com.google.inject.Guice 4 | import com.google.inject.Inject 5 | import java.io.ByteArrayInputStream 6 | import java.io.ByteArrayOutputStream 7 | import java.io.InputStream 8 | import java.io.OutputStream 9 | import java.io.PrintStream 10 | import org.eclipse.lsp4j.jsonrpc.Launcher 11 | import org.eclipse.lsp4j.services.LanguageClient 12 | import org.eclipse.xtext.ide.server.LanguageServerImpl 13 | import org.eclipse.xtext.ide.server.ServerModule 14 | 15 | class ServerLauncher { 16 | 17 | // private static boolean IS_DEBUG = true 18 | 19 | def static void main(String[] args) { 20 | //IS_DEBUG = args.exists[it == 'debug'] 21 | val stdin = System.in 22 | val stdout = System.out 23 | redirectStandardStreams() 24 | val launcher = Guice.createInjector(new ServerModule()).getInstance(ServerLauncher) 25 | launcher.start(stdin, stdout) 26 | } 27 | 28 | @Inject LanguageServerImpl languageServer 29 | 30 | def void start(InputStream in, OutputStream out) { 31 | System.err.println("Starting Xtext Language Server.") 32 | // val id = ServerLauncher.name + "-" + (new Timestamp(System.currentTimeMillis)).toString.replaceAll(" ","_") 33 | val launcher = Launcher.createLauncher(languageServer, LanguageClient, in, out, true, null/*new PrintWriter(new FileOutputStream("/Users/dietrich/logs/xxx-"+id+".log"), true)*/) 34 | languageServer.connect(launcher.remoteProxy) 35 | val future = launcher.startListening 36 | System.err.println("started.") 37 | while (!future.done) { 38 | Thread.sleep(10_000l) 39 | } 40 | } 41 | 42 | def static redirectStandardStreams() { 43 | System.setIn(new ByteArrayInputStream(newByteArrayOfSize(0))) 44 | // val id = ServerLauncher.name + "-" + (new Timestamp(System.currentTimeMillis)).toString.replaceAll(" ","_") 45 | // if (IS_DEBUG) { 46 | // val stdFileOut = new FileOutputStream("/Users/dietrich/logs/out-" + id + ".log") 47 | // System.setOut(new PrintStream(stdFileOut, true)) 48 | // val stdFileErr = new FileOutputStream("/Users/dietrich/logs/error-" + id + ".log") 49 | // System.setErr(new PrintStream(stdFileErr, true)) 50 | // } else { 51 | System.setOut(new PrintStream(new ByteArrayOutputStream())) 52 | System.setErr(new PrintStream(new ByteArrayOutputStream())) 53 | // } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse.feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | [Enter Feature Description here.] 9 | 10 | 11 | 12 | [Enter Copyright Description here.] 13 | 14 | 15 | 16 | [Enter License Description here.] 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 50 | 51 | 57 | 58 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/.launch/Launch Runtime Eclipse.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang.ide/src/main/java/io/entitas/lang/ide/RunServer.java: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.ide; 2 | import java.io.IOException; 3 | import java.net.InetSocketAddress; 4 | import java.net.SocketAddress; 5 | import java.nio.channels.AsynchronousServerSocketChannel; 6 | import java.nio.channels.AsynchronousSocketChannel; 7 | import java.nio.channels.Channels; 8 | import java.util.concurrent.ExecutionException; 9 | import java.util.concurrent.ExecutorService; 10 | import java.util.concurrent.Executors; 11 | import java.util.concurrent.Future; 12 | import java.util.function.Function; 13 | 14 | import org.eclipse.lsp4j.jsonrpc.Launcher; 15 | import org.eclipse.lsp4j.jsonrpc.MessageConsumer; 16 | import org.eclipse.lsp4j.services.LanguageClient; 17 | import org.eclipse.xtext.ide.server.LanguageServerImpl; 18 | import org.eclipse.xtext.ide.server.ServerModule; 19 | 20 | import com.google.inject.Guice; 21 | import com.google.inject.Injector; 22 | 23 | public class RunServer { 24 | 25 | public static void main(String[] args) throws InterruptedException, IOException { 26 | Injector injector = Guice.createInjector(new ServerModule()); 27 | LanguageServerImpl languageServer = injector.getInstance(LanguageServerImpl.class); 28 | Function wrapper = consumer -> { 29 | MessageConsumer result = consumer; 30 | return result; 31 | }; 32 | Launcher launcher = createSocketLauncher(languageServer, LanguageClient.class, new InetSocketAddress("localhost", 5007), Executors.newCachedThreadPool(), wrapper); 33 | languageServer.connect(launcher.getRemoteProxy()); 34 | Future future = launcher.startListening(); 35 | while (!future.isDone()) { 36 | Thread.sleep(10_000l); 37 | } 38 | } 39 | 40 | static Launcher createSocketLauncher(Object localService, Class remoteInterface, SocketAddress socketAddress, ExecutorService executorService, Function wrapper) throws IOException { 41 | AsynchronousServerSocketChannel serverSocket = AsynchronousServerSocketChannel.open().bind(socketAddress); 42 | AsynchronousSocketChannel socketChannel; 43 | try { 44 | socketChannel = serverSocket.accept().get(); 45 | return Launcher.createIoLauncher(localService, remoteInterface, Channels.newInputStream(socketChannel), Channels.newOutputStream(socketChannel), executorService, wrapper); 46 | } catch (InterruptedException | ExecutionException e) { 47 | e.printStackTrace(); 48 | } 49 | return null; 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/PropertyRules.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Property Rules'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.PropertyRules#getName Name}
  • 18 | *
  • {@link io.entitas.lang.dsl.PropertyRules#getAlias Alias}
  • 19 | *
20 | * 21 | * @see io.entitas.lang.dsl.DslPackage#getPropertyRules() 22 | * @model 23 | * @generated 24 | */ 25 | public interface PropertyRules extends EObject 26 | { 27 | /** 28 | * Returns the value of the 'Name' attribute. 29 | * 30 | *

31 | * If the meaning of the 'Name' attribute isn't clear, 32 | * there really should be more of a description here... 33 | *

34 | * 35 | * @return the value of the 'Name' attribute. 36 | * @see #setName(String) 37 | * @see io.entitas.lang.dsl.DslPackage#getPropertyRules_Name() 38 | * @model 39 | * @generated 40 | */ 41 | String getName(); 42 | 43 | /** 44 | * Sets the value of the '{@link io.entitas.lang.dsl.PropertyRules#getName Name}' attribute. 45 | * 46 | * 47 | * @param value the new value of the 'Name' attribute. 48 | * @see #getName() 49 | * @generated 50 | */ 51 | void setName(String value); 52 | 53 | /** 54 | * Returns the value of the 'Alias' reference. 55 | * 56 | *

57 | * If the meaning of the 'Alias' reference isn't clear, 58 | * there really should be more of a description here... 59 | *

60 | * 61 | * @return the value of the 'Alias' reference. 62 | * @see #setAlias(Alias) 63 | * @see io.entitas.lang.dsl.DslPackage#getPropertyRules_Alias() 64 | * @model 65 | * @generated 66 | */ 67 | Alias getAlias(); 68 | 69 | /** 70 | * Sets the value of the '{@link io.entitas.lang.dsl.PropertyRules#getAlias Alias}' reference. 71 | * 72 | * 73 | * @param value the new value of the 'Alias' reference. 74 | * @see #getAlias() 75 | * @generated 76 | */ 77 | void setAlias(Alias value); 78 | 79 | } // PropertyRules 80 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/AliasRule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Alias Rule'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.AliasRule#getTarget Target}
  • 18 | *
  • {@link io.entitas.lang.dsl.AliasRule#getTypeAlias Type Alias}
  • 19 | *
20 | * 21 | * @see io.entitas.lang.dsl.DslPackage#getAliasRule() 22 | * @model 23 | * @generated 24 | */ 25 | public interface AliasRule extends EObject 26 | { 27 | /** 28 | * Returns the value of the 'Target' reference. 29 | * 30 | *

31 | * If the meaning of the 'Target' reference isn't clear, 32 | * there really should be more of a description here... 33 | *

34 | * 35 | * @return the value of the 'Target' reference. 36 | * @see #setTarget(TargetId) 37 | * @see io.entitas.lang.dsl.DslPackage#getAliasRule_Target() 38 | * @model 39 | * @generated 40 | */ 41 | TargetId getTarget(); 42 | 43 | /** 44 | * Sets the value of the '{@link io.entitas.lang.dsl.AliasRule#getTarget Target}' reference. 45 | * 46 | * 47 | * @param value the new value of the 'Target' reference. 48 | * @see #getTarget() 49 | * @generated 50 | */ 51 | void setTarget(TargetId value); 52 | 53 | /** 54 | * Returns the value of the 'Type Alias' attribute. 55 | * 56 | *

57 | * If the meaning of the 'Type Alias' attribute isn't clear, 58 | * there really should be more of a description here... 59 | *

60 | * 61 | * @return the value of the 'Type Alias' attribute. 62 | * @see #setTypeAlias(String) 63 | * @see io.entitas.lang.dsl.DslPackage#getAliasRule_TypeAlias() 64 | * @model 65 | * @generated 66 | */ 67 | String getTypeAlias(); 68 | 69 | /** 70 | * Sets the value of the '{@link io.entitas.lang.dsl.AliasRule#getTypeAlias Type Alias}' attribute. 71 | * 72 | * 73 | * @param value the new value of the 'Type Alias' attribute. 74 | * @see #getTypeAlias() 75 | * @generated 76 | */ 77 | void setTypeAlias(String value); 78 | 79 | } // AliasRule 80 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/test/java/io/entitas/lang/tests/MatcherGenerationExtensionTest.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.tests 2 | 3 | import com.google.inject.Inject 4 | import org.eclipse.xtext.testing.InjectWith 5 | import org.eclipse.xtext.testing.XtextRunner 6 | import org.eclipse.xtext.testing.util.ParseHelper 7 | import org.junit.Assert 8 | import org.junit.Test 9 | import org.junit.runner.RunWith 10 | import io.entitas.lang.dsl.Root 11 | import io.entitas.lang.generator.entitas_csharp.MatcherGenerationExtension 12 | 13 | @RunWith(XtextRunner) 14 | @InjectWith(DSLInjectorProvider) 15 | class MatcherGenerationExtensionTest { 16 | @Inject 17 | ParseHelper parseHelper 18 | 19 | @Test 20 | def void matchersClass() { 21 | val result = parseHelper.parse(''' 22 | target A 23 | context Core, Input, Map 24 | ''') 25 | 26 | Assert.assertEquals(''' 27 | public sealed partial class CoreMatcher { 28 | public static Entitas.IAllOfMatcher AllOf(params int[] indices) { 29 | return Entitas.Matcher.AllOf(indices); 30 | } 31 | 32 | public static Entitas.IAllOfMatcher AllOf(params Entitas.IMatcher[] matchers) { 33 | return Entitas.Matcher.AllOf(matchers); 34 | } 35 | 36 | public static Entitas.IAnyOfMatcher AnyOf(params Entitas.IMatcher[] matchers) { 37 | return Entitas.Matcher.AnyOf(matchers); 38 | } 39 | } 40 | public sealed partial class InputMatcher { 41 | public static Entitas.IAllOfMatcher AllOf(params int[] indices) { 42 | return Entitas.Matcher.AllOf(indices); 43 | } 44 | 45 | public static Entitas.IAllOfMatcher AllOf(params Entitas.IMatcher[] matchers) { 46 | return Entitas.Matcher.AllOf(matchers); 47 | } 48 | 49 | public static Entitas.IAnyOfMatcher AnyOf(params Entitas.IMatcher[] matchers) { 50 | return Entitas.Matcher.AnyOf(matchers); 51 | } 52 | } 53 | public sealed partial class MapMatcher { 54 | public static Entitas.IAllOfMatcher AllOf(params int[] indices) { 55 | return Entitas.Matcher.AllOf(indices); 56 | } 57 | 58 | public static Entitas.IAllOfMatcher AllOf(params Entitas.IMatcher[] matchers) { 59 | return Entitas.Matcher.AllOf(matchers); 60 | } 61 | 62 | public static Entitas.IAnyOfMatcher AnyOf(params Entitas.IMatcher[] matchers) { 63 | return Entitas.Matcher.AnyOf(matchers); 64 | } 65 | } 66 | '''.toString, 67 | MatcherGenerationExtension.matchersClass(result.context).toString) 68 | 69 | 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/MatcherRule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.common.util.EList; 7 | 8 | import org.eclipse.emf.ecore.EObject; 9 | 10 | /** 11 | * 12 | * A representation of the model object 'Matcher Rule'. 13 | * 14 | * 15 | *

16 | * The following features are supported: 17 | *

18 | *
    19 | *
  • {@link io.entitas.lang.dsl.MatcherRule#getAllComponents All Components}
  • 20 | *
  • {@link io.entitas.lang.dsl.MatcherRule#getAnyComponents Any Components}
  • 21 | *
  • {@link io.entitas.lang.dsl.MatcherRule#getNoneComponents None Components}
  • 22 | *
23 | * 24 | * @see io.entitas.lang.dsl.DslPackage#getMatcherRule() 25 | * @model 26 | * @generated 27 | */ 28 | public interface MatcherRule extends EObject 29 | { 30 | /** 31 | * Returns the value of the 'All Components' reference list. 32 | * The list contents are of type {@link io.entitas.lang.dsl.Component}. 33 | * 34 | *

35 | * If the meaning of the 'All Components' reference list isn't clear, 36 | * there really should be more of a description here... 37 | *

38 | * 39 | * @return the value of the 'All Components' reference list. 40 | * @see io.entitas.lang.dsl.DslPackage#getMatcherRule_AllComponents() 41 | * @model 42 | * @generated 43 | */ 44 | EList getAllComponents(); 45 | 46 | /** 47 | * Returns the value of the 'Any Components' reference list. 48 | * The list contents are of type {@link io.entitas.lang.dsl.Component}. 49 | * 50 | *

51 | * If the meaning of the 'Any Components' reference list isn't clear, 52 | * there really should be more of a description here... 53 | *

54 | * 55 | * @return the value of the 'Any Components' reference list. 56 | * @see io.entitas.lang.dsl.DslPackage#getMatcherRule_AnyComponents() 57 | * @model 58 | * @generated 59 | */ 60 | EList getAnyComponents(); 61 | 62 | /** 63 | * Returns the value of the 'None Components' reference list. 64 | * The list contents are of type {@link io.entitas.lang.dsl.Component}. 65 | * 66 | *

67 | * If the meaning of the 'None Components' reference list isn't clear, 68 | * there really should be more of a description here... 69 | *

70 | * 71 | * @return the value of the 'None Components' reference list. 72 | * @see io.entitas.lang.dsl.DslPackage#getMatcherRule_NoneComponents() 73 | * @model 74 | * @generated 75 | */ 76 | EList getNoneComponents(); 77 | 78 | } // MatcherRule 79 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.eclipse/src/io/entitas/lang/DSL.xtext: -------------------------------------------------------------------------------- 1 | grammar io.entitas.lang.DSL with org.eclipse.xtext.common.Terminals 2 | 3 | generate dsl "http://www.entitas.io/lang/DSL" 4 | 5 | Root: 6 | target = Target? 7 | namespace = Namespace? 8 | context = Context? 9 | typeAliases += Alias* 10 | 11 | components += Component* 12 | 13 | systems += System* 14 | ; 15 | 16 | Target: 17 | 'target' (ids += TargetId ','?)+ 18 | ; 19 | 20 | TargetId: 21 | name = ID ('(' parameters += TargetParameter ','? ')')? (version = Version)? 22 | ; 23 | 24 | TargetParameter: 25 | 'path' ':' path = STRING 26 | ; 27 | 28 | Version:{Version} 29 | major = INT ('.' minor = INT ('.' patch = INT)?)? 30 | ; 31 | 32 | Namespace: 33 | 'namespace' name = QualifiedName 34 | ; 35 | 36 | Context: 37 | 'context' (ids += ContextId ','?)+ 38 | ; 39 | 40 | ContextId: 41 | name = ID ('(' parameters += ContextParameter ','? ')')? 42 | ; 43 | 44 | ContextParameter: 45 | 'default' 46 | ; 47 | 48 | Alias: 49 | 'alias' name = ID (listOfAliases = AliasList | singleAlias = SingleAlias) 50 | ; 51 | 52 | AliasList: 53 | rules += AliasRule+ 54 | ; 55 | 56 | AliasRule: 57 | target = [TargetId] ':' typeAlias = STRING 58 | ; 59 | 60 | SingleAlias: 61 | ':' typeAlias = STRING 62 | ; 63 | 64 | 65 | Component: 66 | 'comp' name = ValidID ('(' (parameters += ComponentParameter ','?)+ ')')? (scope=ContextScopes)? (listOfProperties = PropertyList | propertyPrefix = PropertyPrefix)? 67 | ; 68 | 69 | PropertyList: 70 | rules += PropertyRules+ 71 | ; 72 | 73 | PropertyRules: 74 | name = ID ':' alias = [Alias] (',')? 75 | ; 76 | 77 | PropertyPrefix: 78 | 'prefix' '(' string = STRING ')' 79 | ; 80 | 81 | ComponentParameter: 82 | 'unique' 83 | ; 84 | 85 | ContextScopes: 86 | 'in' (references += [ContextId] ','?)+ 87 | ; 88 | 89 | System: 90 | 'sys' name = ID ('(' (parameters += SystemParameter ','?)+ ')')? 91 | ( 92 | reactive ?= 'trigger' (scope = ContextScope)? ':' 93 | (triggerRules += TriggerRule ','?)+ 94 | ( noFilter ?= 'noFilter' | 95 | 'filter' matcherRules = MatcherRule 96 | )? 97 | )? 98 | ( 99 | 'access' ':' 100 | accessRules += AccessRule+ 101 | )? 102 | ; 103 | 104 | AccessRule: 105 | name = ID ':' 106 | ( ( ((matcherRule = MatcherRule) /* | ( ':' componentRef = [Component])*/ ) (scope = ContextScope)? ) 107 | | contextRef = [ContextId] 108 | ) 109 | ; 110 | 111 | SystemParameter: 112 | 'init' | 'cleanup' | 'teardown' | 'no_exec' | 'explicit_context_list' 113 | ; 114 | 115 | TriggerRule: 116 | ( removed?='removed' | added?='added' | removedOrAdded?='removedOrAdded') '(' (components += [Component] ','? )+ ')' 117 | ; 118 | 119 | MatcherRule:{MatcherRule} 120 | ('allOf' '(' (allComponents += [Component] ','? )+ ')')? ('anyOf' '(' (anyComponents += [Component] ','? )+ ')')? ('noneOf' '(' (noneComponents += [Component] ','? )+ ')')? 121 | ; 122 | 123 | ContextScope: 124 | 'in' reference = [ContextId] 125 | ; 126 | 127 | QualifiedName: 128 | ValidID ('.' ValidID)*; 129 | 130 | ValidID: 131 | ID | 'target' | 'namespace' | 'default' | 'unique' | 'prefix' | 'in' | 'alias' 132 | ; -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/DSL.xtext: -------------------------------------------------------------------------------- 1 | grammar io.entitas.lang.DSL with org.eclipse.xtext.common.Terminals 2 | 3 | generate dsl "http://www.entitas.io/lang/DSL" 4 | 5 | Root: 6 | target = Target? 7 | namespace = Namespace? 8 | context = Context? 9 | typeAliases += Alias* 10 | 11 | components += Component* 12 | 13 | systems += System* 14 | ; 15 | 16 | Target: 17 | 'target' (ids += TargetId ','?)+ 18 | ; 19 | 20 | TargetId: 21 | name = ID ('(' parameters += TargetParameter ','? ')')? (version = Version)? 22 | ; 23 | 24 | TargetParameter: 25 | 'gen_path' ':' path = STRING 26 | ; 27 | 28 | Version:{Version} 29 | major = INT ('.' minor = INT ('.' patch = INT)?)? 30 | ; 31 | 32 | Namespace: 33 | 'namespace' name = QualifiedName 34 | ; 35 | 36 | Context: 37 | 'context' (ids += ContextId ','?)+ 38 | ; 39 | 40 | ContextId: 41 | name = ID ('(' parameters += ContextParameter ','? ')')? 42 | ; 43 | 44 | ContextParameter: 45 | 'default' 46 | ; 47 | 48 | Alias: 49 | 'alias' name = ID (listOfAliases = AliasList | singleAlias = SingleAlias) 50 | ; 51 | 52 | AliasList: 53 | rules += AliasRule+ 54 | ; 55 | 56 | AliasRule: 57 | target = [TargetId] ':' typeAlias = STRING 58 | ; 59 | 60 | SingleAlias: 61 | ':' typeAlias = STRING 62 | ; 63 | 64 | 65 | Component: 66 | 'comp' name = ValidID ('(' (parameters += ComponentParameter ','?)+ ')')? (scope=ContextScopes)? (listOfProperties = PropertyList | propertyPrefix = PropertyPrefix)? 67 | ; 68 | 69 | PropertyList: 70 | rules += PropertyRules+ 71 | ; 72 | 73 | PropertyRules: 74 | name = ID ':' alias = [Alias] (',')? 75 | ; 76 | 77 | PropertyPrefix: 78 | 'prefix' '(' string = STRING ')' 79 | ; 80 | 81 | ComponentParameter: 82 | 'unique' 83 | ; 84 | 85 | ContextScopes: 86 | 'in' (references += [ContextId] ','?)+ 87 | ; 88 | 89 | System: 90 | 'sys' name = ID ('(' (parameters += SystemParameter ','?)+ ')')? 91 | ( 92 | reactive ?= 'trigger' (scope = ContextScope)? ':' 93 | (triggerRules += TriggerRule ','?)+ 94 | ( noFilter ?= 'noFilter' | 95 | 'filter' matcherRules = MatcherRule 96 | )? 97 | )? 98 | ( 99 | 'access' ':' 100 | accessRules += AccessRule+ 101 | )? 102 | ; 103 | 104 | AccessRule: 105 | name = ID ':' 106 | ( ( ((matcherRule = MatcherRule) /* | ( ':' componentRef = [Component])*/ ) (scope = ContextScope)? ) 107 | | contextRef = [ContextId] 108 | ) 109 | ; 110 | 111 | SystemParameter: 112 | 'init' | 'cleanup' | 'teardown' | 'no_exec' | 'explicit_context_list' 113 | ; 114 | 115 | TriggerRule: 116 | ( removed?='removed' | added?='added' | removedOrAdded?='removedOrAdded') '(' (components += [Component] ','? )+ ')' 117 | ; 118 | 119 | MatcherRule:{MatcherRule} 120 | ('allOf' '(' (allComponents += [Component] ','? )+ ')')? ('anyOf' '(' (anyComponents += [Component] ','? )+ ')')? ('noneOf' '(' (noneComponents += [Component] ','? )+ ')')? 121 | ; 122 | 123 | ContextScope: 124 | 'in' reference = [ContextId] 125 | ; 126 | 127 | QualifiedName: 128 | ValidID ('.' ValidID)*; 129 | 130 | ValidID: 131 | ID | 'target' | 'namespace' | 'default' | 'unique' | 'prefix' | 'in' | 'alias' 132 | ; -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/TargetId.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.common.util.EList; 7 | 8 | import org.eclipse.emf.ecore.EObject; 9 | 10 | /** 11 | * 12 | * A representation of the model object 'Target Id'. 13 | * 14 | * 15 | *

16 | * The following features are supported: 17 | *

18 | *
    19 | *
  • {@link io.entitas.lang.dsl.TargetId#getName Name}
  • 20 | *
  • {@link io.entitas.lang.dsl.TargetId#getParameters Parameters}
  • 21 | *
  • {@link io.entitas.lang.dsl.TargetId#getVersion Version}
  • 22 | *
23 | * 24 | * @see io.entitas.lang.dsl.DslPackage#getTargetId() 25 | * @model 26 | * @generated 27 | */ 28 | public interface TargetId extends EObject 29 | { 30 | /** 31 | * Returns the value of the 'Name' attribute. 32 | * 33 | *

34 | * If the meaning of the 'Name' attribute isn't clear, 35 | * there really should be more of a description here... 36 | *

37 | * 38 | * @return the value of the 'Name' attribute. 39 | * @see #setName(String) 40 | * @see io.entitas.lang.dsl.DslPackage#getTargetId_Name() 41 | * @model 42 | * @generated 43 | */ 44 | String getName(); 45 | 46 | /** 47 | * Sets the value of the '{@link io.entitas.lang.dsl.TargetId#getName Name}' attribute. 48 | * 49 | * 50 | * @param value the new value of the 'Name' attribute. 51 | * @see #getName() 52 | * @generated 53 | */ 54 | void setName(String value); 55 | 56 | /** 57 | * Returns the value of the 'Parameters' containment reference list. 58 | * The list contents are of type {@link io.entitas.lang.dsl.TargetParameter}. 59 | * 60 | *

61 | * If the meaning of the 'Parameters' containment reference list isn't clear, 62 | * there really should be more of a description here... 63 | *

64 | * 65 | * @return the value of the 'Parameters' containment reference list. 66 | * @see io.entitas.lang.dsl.DslPackage#getTargetId_Parameters() 67 | * @model containment="true" 68 | * @generated 69 | */ 70 | EList getParameters(); 71 | 72 | /** 73 | * Returns the value of the 'Version' containment reference. 74 | * 75 | *

76 | * If the meaning of the 'Version' containment reference isn't clear, 77 | * there really should be more of a description here... 78 | *

79 | * 80 | * @return the value of the 'Version' containment reference. 81 | * @see #setVersion(Version) 82 | * @see io.entitas.lang.dsl.DslPackage#getTargetId_Version() 83 | * @model containment="true" 84 | * @generated 85 | */ 86 | Version getVersion(); 87 | 88 | /** 89 | * Sets the value of the '{@link io.entitas.lang.dsl.TargetId#getVersion Version}' containment reference. 90 | * 91 | * 92 | * @param value the new value of the 'Version' containment reference. 93 | * @see #getVersion() 94 | * @generated 95 | */ 96 | void setVersion(Version value); 97 | 98 | } // TargetId 99 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/Version.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Version'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.Version#getMajor Major}
  • 18 | *
  • {@link io.entitas.lang.dsl.Version#getMinor Minor}
  • 19 | *
  • {@link io.entitas.lang.dsl.Version#getPatch Patch}
  • 20 | *
21 | * 22 | * @see io.entitas.lang.dsl.DslPackage#getVersion() 23 | * @model 24 | * @generated 25 | */ 26 | public interface Version extends EObject 27 | { 28 | /** 29 | * Returns the value of the 'Major' attribute. 30 | * 31 | *

32 | * If the meaning of the 'Major' attribute isn't clear, 33 | * there really should be more of a description here... 34 | *

35 | * 36 | * @return the value of the 'Major' attribute. 37 | * @see #setMajor(int) 38 | * @see io.entitas.lang.dsl.DslPackage#getVersion_Major() 39 | * @model 40 | * @generated 41 | */ 42 | int getMajor(); 43 | 44 | /** 45 | * Sets the value of the '{@link io.entitas.lang.dsl.Version#getMajor Major}' attribute. 46 | * 47 | * 48 | * @param value the new value of the 'Major' attribute. 49 | * @see #getMajor() 50 | * @generated 51 | */ 52 | void setMajor(int value); 53 | 54 | /** 55 | * Returns the value of the 'Minor' attribute. 56 | * 57 | *

58 | * If the meaning of the 'Minor' attribute isn't clear, 59 | * there really should be more of a description here... 60 | *

61 | * 62 | * @return the value of the 'Minor' attribute. 63 | * @see #setMinor(int) 64 | * @see io.entitas.lang.dsl.DslPackage#getVersion_Minor() 65 | * @model 66 | * @generated 67 | */ 68 | int getMinor(); 69 | 70 | /** 71 | * Sets the value of the '{@link io.entitas.lang.dsl.Version#getMinor Minor}' attribute. 72 | * 73 | * 74 | * @param value the new value of the 'Minor' attribute. 75 | * @see #getMinor() 76 | * @generated 77 | */ 78 | void setMinor(int value); 79 | 80 | /** 81 | * Returns the value of the 'Patch' attribute. 82 | * 83 | *

84 | * If the meaning of the 'Patch' attribute isn't clear, 85 | * there really should be more of a description here... 86 | *

87 | * 88 | * @return the value of the 'Patch' attribute. 89 | * @see #setPatch(int) 90 | * @see io.entitas.lang.dsl.DslPackage#getVersion_Patch() 91 | * @model 92 | * @generated 93 | */ 94 | int getPatch(); 95 | 96 | /** 97 | * Sets the value of the '{@link io.entitas.lang.dsl.Version#getPatch Patch}' attribute. 98 | * 99 | * 100 | * @param value the new value of the 'Patch' attribute. 101 | * @see #getPatch() 102 | * @generated 103 | */ 104 | void setPatch(int value); 105 | 106 | } // Version 107 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/Alias.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Alias'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.Alias#getName Name}
  • 18 | *
  • {@link io.entitas.lang.dsl.Alias#getListOfAliases List Of Aliases}
  • 19 | *
  • {@link io.entitas.lang.dsl.Alias#getSingleAlias Single Alias}
  • 20 | *
21 | * 22 | * @see io.entitas.lang.dsl.DslPackage#getAlias() 23 | * @model 24 | * @generated 25 | */ 26 | public interface Alias extends EObject 27 | { 28 | /** 29 | * Returns the value of the 'Name' attribute. 30 | * 31 | *

32 | * If the meaning of the 'Name' attribute isn't clear, 33 | * there really should be more of a description here... 34 | *

35 | * 36 | * @return the value of the 'Name' attribute. 37 | * @see #setName(String) 38 | * @see io.entitas.lang.dsl.DslPackage#getAlias_Name() 39 | * @model 40 | * @generated 41 | */ 42 | String getName(); 43 | 44 | /** 45 | * Sets the value of the '{@link io.entitas.lang.dsl.Alias#getName Name}' attribute. 46 | * 47 | * 48 | * @param value the new value of the 'Name' attribute. 49 | * @see #getName() 50 | * @generated 51 | */ 52 | void setName(String value); 53 | 54 | /** 55 | * Returns the value of the 'List Of Aliases' containment reference. 56 | * 57 | *

58 | * If the meaning of the 'List Of Aliases' containment reference isn't clear, 59 | * there really should be more of a description here... 60 | *

61 | * 62 | * @return the value of the 'List Of Aliases' containment reference. 63 | * @see #setListOfAliases(AliasList) 64 | * @see io.entitas.lang.dsl.DslPackage#getAlias_ListOfAliases() 65 | * @model containment="true" 66 | * @generated 67 | */ 68 | AliasList getListOfAliases(); 69 | 70 | /** 71 | * Sets the value of the '{@link io.entitas.lang.dsl.Alias#getListOfAliases List Of Aliases}' containment reference. 72 | * 73 | * 74 | * @param value the new value of the 'List Of Aliases' containment reference. 75 | * @see #getListOfAliases() 76 | * @generated 77 | */ 78 | void setListOfAliases(AliasList value); 79 | 80 | /** 81 | * Returns the value of the 'Single Alias' containment reference. 82 | * 83 | *

84 | * If the meaning of the 'Single Alias' containment reference isn't clear, 85 | * there really should be more of a description here... 86 | *

87 | * 88 | * @return the value of the 'Single Alias' containment reference. 89 | * @see #setSingleAlias(SingleAlias) 90 | * @see io.entitas.lang.dsl.DslPackage#getAlias_SingleAlias() 91 | * @model containment="true" 92 | * @generated 93 | */ 94 | SingleAlias getSingleAlias(); 95 | 96 | /** 97 | * Sets the value of the '{@link io.entitas.lang.dsl.Alias#getSingleAlias Single Alias}' containment reference. 98 | * 99 | * 100 | * @param value the new value of the 'Single Alias' containment reference. 101 | * @see #getSingleAlias() 102 | * @generated 103 | */ 104 | void setSingleAlias(SingleAlias value); 105 | 106 | } // Alias 107 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/ContextScopesImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.ContextId; 7 | import io.entitas.lang.dsl.ContextScopes; 8 | import io.entitas.lang.dsl.DslPackage; 9 | 10 | import java.util.Collection; 11 | 12 | import org.eclipse.emf.common.util.EList; 13 | 14 | import org.eclipse.emf.ecore.EClass; 15 | 16 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 17 | 18 | import org.eclipse.emf.ecore.util.EObjectResolvingEList; 19 | 20 | /** 21 | * 22 | * An implementation of the model object 'Context Scopes'. 23 | * 24 | *

25 | * The following features are implemented: 26 | *

27 | *
    28 | *
  • {@link io.entitas.lang.dsl.impl.ContextScopesImpl#getReferences References}
  • 29 | *
30 | * 31 | * @generated 32 | */ 33 | public class ContextScopesImpl extends MinimalEObjectImpl.Container implements ContextScopes 34 | { 35 | /** 36 | * The cached value of the '{@link #getReferences() References}' reference list. 37 | * 38 | * 39 | * @see #getReferences() 40 | * @generated 41 | * @ordered 42 | */ 43 | protected EList references; 44 | 45 | /** 46 | * 47 | * 48 | * @generated 49 | */ 50 | protected ContextScopesImpl() 51 | { 52 | super(); 53 | } 54 | 55 | /** 56 | * 57 | * 58 | * @generated 59 | */ 60 | @Override 61 | protected EClass eStaticClass() 62 | { 63 | return DslPackage.Literals.CONTEXT_SCOPES; 64 | } 65 | 66 | /** 67 | * 68 | * 69 | * @generated 70 | */ 71 | public EList getReferences() 72 | { 73 | if (references == null) 74 | { 75 | references = new EObjectResolvingEList(ContextId.class, this, DslPackage.CONTEXT_SCOPES__REFERENCES); 76 | } 77 | return references; 78 | } 79 | 80 | /** 81 | * 82 | * 83 | * @generated 84 | */ 85 | @Override 86 | public Object eGet(int featureID, boolean resolve, boolean coreType) 87 | { 88 | switch (featureID) 89 | { 90 | case DslPackage.CONTEXT_SCOPES__REFERENCES: 91 | return getReferences(); 92 | } 93 | return super.eGet(featureID, resolve, coreType); 94 | } 95 | 96 | /** 97 | * 98 | * 99 | * @generated 100 | */ 101 | @SuppressWarnings("unchecked") 102 | @Override 103 | public void eSet(int featureID, Object newValue) 104 | { 105 | switch (featureID) 106 | { 107 | case DslPackage.CONTEXT_SCOPES__REFERENCES: 108 | getReferences().clear(); 109 | getReferences().addAll((Collection)newValue); 110 | return; 111 | } 112 | super.eSet(featureID, newValue); 113 | } 114 | 115 | /** 116 | * 117 | * 118 | * @generated 119 | */ 120 | @Override 121 | public void eUnset(int featureID) 122 | { 123 | switch (featureID) 124 | { 125 | case DslPackage.CONTEXT_SCOPES__REFERENCES: 126 | getReferences().clear(); 127 | return; 128 | } 129 | super.eUnset(featureID); 130 | } 131 | 132 | /** 133 | * 134 | * 135 | * @generated 136 | */ 137 | @Override 138 | public boolean eIsSet(int featureID) 139 | { 140 | switch (featureID) 141 | { 142 | case DslPackage.CONTEXT_SCOPES__REFERENCES: 143 | return references != null && !references.isEmpty(); 144 | } 145 | return super.eIsSet(featureID); 146 | } 147 | 148 | } //ContextScopesImpl 149 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | dependencies { 6 | classpath 'org.xtext:xtext-gradle-plugin:1.0.15' 7 | classpath 'com.moowork.gradle:gradle-node-plugin:0.13' 8 | } 9 | } 10 | 11 | plugins { 12 | id 'com.moowork.node' version '0.13' 13 | id 'net.researchgate.release' version '2.4.0' 14 | } 15 | 16 | node { 17 | version = '6.2.2' 18 | npmVersion = '3.10.6' 19 | download = true 20 | } 21 | 22 | // Configuration for Xtext projects 23 | configure(subprojects.findAll { it.name.startsWith('io.entitas') }) { 24 | ext.xtextVersion = '2.11.0' 25 | repositories { 26 | jcenter() 27 | } 28 | 29 | apply plugin: 'java' 30 | apply plugin: 'org.xtext.xtend' 31 | apply from: "${rootDir}/gradle/source-layout.gradle" 32 | apply from: "${rootDir}/gradle/maven-deployment.gradle" 33 | apply plugin: 'eclipse' 34 | apply plugin: 'idea' 35 | 36 | group = 'io.entitas.lang' 37 | version = '1.0.0-SNAPSHOT' 38 | 39 | sourceCompatibility = '1.8' 40 | targetCompatibility = '1.8' 41 | 42 | configurations.all { 43 | exclude group: 'asm' 44 | } 45 | } 46 | 47 | task npmInstallVsce(type: NpmTask, dependsOn: npmSetup) { 48 | ext.destPath = "$rootProject.projectDir/node_modules/vsce" 49 | outputs.dir(destPath) 50 | group 'Node' 51 | description 'Installs the NodeJS package "Visual Studio Code Extension Manager"' 52 | args = [ 'install', 'vsce' ] 53 | } 54 | 55 | // Configuration for vscode projects 56 | configure(subprojects.findAll { it.name.startsWith('vscode') }) { 57 | 58 | apply plugin: 'com.moowork.node' 59 | 60 | def inputFiles = fileTree( 61 | dir: projectDir, 62 | excludes: [ 'out/**', '.gitignore', '.gradle/**', 'build/**', '*.gradle' ] 63 | ) 64 | 65 | npmInstall { 66 | inputs.files(inputFiles) 67 | outputs.dir('out') 68 | } 69 | 70 | task vscodeExtension(dependsOn: [npmInstall, npmInstallVsce], type: NodeTask) { 71 | ext.destDir = new File(buildDir, 'vscode') 72 | ext.archiveName = "$project.name-${project.version}.vsix" 73 | ext.destPath = "$destDir/$archiveName" 74 | inputs.with { 75 | files inputFiles 76 | dir npmInstallVsce.destPath 77 | } 78 | outputs.dir destDir 79 | doFirst { 80 | destDir.mkdirs() 81 | } 82 | script = file("$npmInstallVsce.destPath/out/vsce") 83 | args = [ 'package', '--out', destPath ] 84 | execOverrides { 85 | workingDir = projectDir 86 | } 87 | } 88 | 89 | task clean { 90 | doLast { 91 | delete vscodeExtension.destDir 92 | delete 'out' // output of npmInstall - don't want to delete node_modules 93 | } 94 | 95 | } 96 | 97 | } 98 | 99 | plugins.withType(com.moowork.gradle.node.NodePlugin) { 100 | node { 101 | workDir = file("$rootProject.buildDir/nodejs") 102 | nodeModulesDir = rootProject.projectDir 103 | } 104 | } 105 | 106 | task updateVersions { 107 | doLast { 108 | def versionPattern = /\d+.\d+(.\d+)?/ 109 | def encoding = 'UTF-8' 110 | def filesToUpdate = [ 111 | // new File('vscode-extension', 'package.json'), 112 | new File('vscode-extension-self-contained', 'package.json') 113 | ] 114 | 115 | // String replacements - isn't long enough to justify advanced code ;) 116 | filesToUpdate.forEach { file -> 117 | String text = file.getText(encoding) 118 | text = text.replaceAll("\"version\": \"$versionPattern\",", "\"version\": \"$project.version\",") 119 | file.setText(text, encoding) 120 | } 121 | } 122 | } 123 | 124 | release { 125 | tagTemplate = 'v${version}' 126 | preTagCommitMessage = '[release] pre tag commit: ' 127 | tagCommitMessage = '[release] creating tag: ' 128 | newVersionCommitMessage = '[release] new version commit: ' 129 | failOnSnapshotDependencies = false 130 | } 131 | updateVersions.shouldRunAfter tasks.getByName('confirmReleaseVersion') 132 | tasks.getByName('commitNewVersion').dependsOn updateVersions 133 | 134 | // Workaround for issue https://github.com/researchgate/gradle-release/issues/144 135 | task build { 136 | dependsOn subprojects.findResults { it.tasks.findByName('build') } 137 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/TargetImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.DslPackage; 7 | import io.entitas.lang.dsl.Target; 8 | import io.entitas.lang.dsl.TargetId; 9 | 10 | import java.util.Collection; 11 | 12 | import org.eclipse.emf.common.notify.NotificationChain; 13 | 14 | import org.eclipse.emf.common.util.EList; 15 | 16 | import org.eclipse.emf.ecore.EClass; 17 | import org.eclipse.emf.ecore.InternalEObject; 18 | 19 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 20 | 21 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; 22 | import org.eclipse.emf.ecore.util.InternalEList; 23 | 24 | /** 25 | * 26 | * An implementation of the model object 'Target'. 27 | * 28 | *

29 | * The following features are implemented: 30 | *

31 | *
    32 | *
  • {@link io.entitas.lang.dsl.impl.TargetImpl#getIds Ids}
  • 33 | *
34 | * 35 | * @generated 36 | */ 37 | public class TargetImpl extends MinimalEObjectImpl.Container implements Target 38 | { 39 | /** 40 | * The cached value of the '{@link #getIds() Ids}' containment reference list. 41 | * 42 | * 43 | * @see #getIds() 44 | * @generated 45 | * @ordered 46 | */ 47 | protected EList ids; 48 | 49 | /** 50 | * 51 | * 52 | * @generated 53 | */ 54 | protected TargetImpl() 55 | { 56 | super(); 57 | } 58 | 59 | /** 60 | * 61 | * 62 | * @generated 63 | */ 64 | @Override 65 | protected EClass eStaticClass() 66 | { 67 | return DslPackage.Literals.TARGET; 68 | } 69 | 70 | /** 71 | * 72 | * 73 | * @generated 74 | */ 75 | public EList getIds() 76 | { 77 | if (ids == null) 78 | { 79 | ids = new EObjectContainmentEList(TargetId.class, this, DslPackage.TARGET__IDS); 80 | } 81 | return ids; 82 | } 83 | 84 | /** 85 | * 86 | * 87 | * @generated 88 | */ 89 | @Override 90 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) 91 | { 92 | switch (featureID) 93 | { 94 | case DslPackage.TARGET__IDS: 95 | return ((InternalEList)getIds()).basicRemove(otherEnd, msgs); 96 | } 97 | return super.eInverseRemove(otherEnd, featureID, msgs); 98 | } 99 | 100 | /** 101 | * 102 | * 103 | * @generated 104 | */ 105 | @Override 106 | public Object eGet(int featureID, boolean resolve, boolean coreType) 107 | { 108 | switch (featureID) 109 | { 110 | case DslPackage.TARGET__IDS: 111 | return getIds(); 112 | } 113 | return super.eGet(featureID, resolve, coreType); 114 | } 115 | 116 | /** 117 | * 118 | * 119 | * @generated 120 | */ 121 | @SuppressWarnings("unchecked") 122 | @Override 123 | public void eSet(int featureID, Object newValue) 124 | { 125 | switch (featureID) 126 | { 127 | case DslPackage.TARGET__IDS: 128 | getIds().clear(); 129 | getIds().addAll((Collection)newValue); 130 | return; 131 | } 132 | super.eSet(featureID, newValue); 133 | } 134 | 135 | /** 136 | * 137 | * 138 | * @generated 139 | */ 140 | @Override 141 | public void eUnset(int featureID) 142 | { 143 | switch (featureID) 144 | { 145 | case DslPackage.TARGET__IDS: 146 | getIds().clear(); 147 | return; 148 | } 149 | super.eUnset(featureID); 150 | } 151 | 152 | /** 153 | * 154 | * 155 | * @generated 156 | */ 157 | @Override 158 | public boolean eIsSet(int featureID) 159 | { 160 | switch (featureID) 161 | { 162 | case DslPackage.TARGET__IDS: 163 | return ids != null && !ids.isEmpty(); 164 | } 165 | return super.eIsSet(featureID); 166 | } 167 | 168 | } //TargetImpl 169 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/ContextImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.Context; 7 | import io.entitas.lang.dsl.ContextId; 8 | import io.entitas.lang.dsl.DslPackage; 9 | 10 | import java.util.Collection; 11 | 12 | import org.eclipse.emf.common.notify.NotificationChain; 13 | 14 | import org.eclipse.emf.common.util.EList; 15 | 16 | import org.eclipse.emf.ecore.EClass; 17 | import org.eclipse.emf.ecore.InternalEObject; 18 | 19 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 20 | 21 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; 22 | import org.eclipse.emf.ecore.util.InternalEList; 23 | 24 | /** 25 | * 26 | * An implementation of the model object 'Context'. 27 | * 28 | *

29 | * The following features are implemented: 30 | *

31 | *
    32 | *
  • {@link io.entitas.lang.dsl.impl.ContextImpl#getIds Ids}
  • 33 | *
34 | * 35 | * @generated 36 | */ 37 | public class ContextImpl extends MinimalEObjectImpl.Container implements Context 38 | { 39 | /** 40 | * The cached value of the '{@link #getIds() Ids}' containment reference list. 41 | * 42 | * 43 | * @see #getIds() 44 | * @generated 45 | * @ordered 46 | */ 47 | protected EList ids; 48 | 49 | /** 50 | * 51 | * 52 | * @generated 53 | */ 54 | protected ContextImpl() 55 | { 56 | super(); 57 | } 58 | 59 | /** 60 | * 61 | * 62 | * @generated 63 | */ 64 | @Override 65 | protected EClass eStaticClass() 66 | { 67 | return DslPackage.Literals.CONTEXT; 68 | } 69 | 70 | /** 71 | * 72 | * 73 | * @generated 74 | */ 75 | public EList getIds() 76 | { 77 | if (ids == null) 78 | { 79 | ids = new EObjectContainmentEList(ContextId.class, this, DslPackage.CONTEXT__IDS); 80 | } 81 | return ids; 82 | } 83 | 84 | /** 85 | * 86 | * 87 | * @generated 88 | */ 89 | @Override 90 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) 91 | { 92 | switch (featureID) 93 | { 94 | case DslPackage.CONTEXT__IDS: 95 | return ((InternalEList)getIds()).basicRemove(otherEnd, msgs); 96 | } 97 | return super.eInverseRemove(otherEnd, featureID, msgs); 98 | } 99 | 100 | /** 101 | * 102 | * 103 | * @generated 104 | */ 105 | @Override 106 | public Object eGet(int featureID, boolean resolve, boolean coreType) 107 | { 108 | switch (featureID) 109 | { 110 | case DslPackage.CONTEXT__IDS: 111 | return getIds(); 112 | } 113 | return super.eGet(featureID, resolve, coreType); 114 | } 115 | 116 | /** 117 | * 118 | * 119 | * @generated 120 | */ 121 | @SuppressWarnings("unchecked") 122 | @Override 123 | public void eSet(int featureID, Object newValue) 124 | { 125 | switch (featureID) 126 | { 127 | case DslPackage.CONTEXT__IDS: 128 | getIds().clear(); 129 | getIds().addAll((Collection)newValue); 130 | return; 131 | } 132 | super.eSet(featureID, newValue); 133 | } 134 | 135 | /** 136 | * 137 | * 138 | * @generated 139 | */ 140 | @Override 141 | public void eUnset(int featureID) 142 | { 143 | switch (featureID) 144 | { 145 | case DslPackage.CONTEXT__IDS: 146 | getIds().clear(); 147 | return; 148 | } 149 | super.eUnset(featureID); 150 | } 151 | 152 | /** 153 | * 154 | * 155 | * @generated 156 | */ 157 | @Override 158 | public boolean eIsSet(int featureID) 159 | { 160 | switch (featureID) 161 | { 162 | case DslPackage.CONTEXT__IDS: 163 | return ids != null && !ids.isEmpty(); 164 | } 165 | return super.eIsSet(featureID); 166 | } 167 | 168 | } //ContextImpl 169 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/AliasListImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.AliasList; 7 | import io.entitas.lang.dsl.AliasRule; 8 | import io.entitas.lang.dsl.DslPackage; 9 | 10 | import java.util.Collection; 11 | 12 | import org.eclipse.emf.common.notify.NotificationChain; 13 | 14 | import org.eclipse.emf.common.util.EList; 15 | 16 | import org.eclipse.emf.ecore.EClass; 17 | import org.eclipse.emf.ecore.InternalEObject; 18 | 19 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 20 | 21 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; 22 | import org.eclipse.emf.ecore.util.InternalEList; 23 | 24 | /** 25 | * 26 | * An implementation of the model object 'Alias List'. 27 | * 28 | *

29 | * The following features are implemented: 30 | *

31 | *
    32 | *
  • {@link io.entitas.lang.dsl.impl.AliasListImpl#getRules Rules}
  • 33 | *
34 | * 35 | * @generated 36 | */ 37 | public class AliasListImpl extends MinimalEObjectImpl.Container implements AliasList 38 | { 39 | /** 40 | * The cached value of the '{@link #getRules() Rules}' containment reference list. 41 | * 42 | * 43 | * @see #getRules() 44 | * @generated 45 | * @ordered 46 | */ 47 | protected EList rules; 48 | 49 | /** 50 | * 51 | * 52 | * @generated 53 | */ 54 | protected AliasListImpl() 55 | { 56 | super(); 57 | } 58 | 59 | /** 60 | * 61 | * 62 | * @generated 63 | */ 64 | @Override 65 | protected EClass eStaticClass() 66 | { 67 | return DslPackage.Literals.ALIAS_LIST; 68 | } 69 | 70 | /** 71 | * 72 | * 73 | * @generated 74 | */ 75 | public EList getRules() 76 | { 77 | if (rules == null) 78 | { 79 | rules = new EObjectContainmentEList(AliasRule.class, this, DslPackage.ALIAS_LIST__RULES); 80 | } 81 | return rules; 82 | } 83 | 84 | /** 85 | * 86 | * 87 | * @generated 88 | */ 89 | @Override 90 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) 91 | { 92 | switch (featureID) 93 | { 94 | case DslPackage.ALIAS_LIST__RULES: 95 | return ((InternalEList)getRules()).basicRemove(otherEnd, msgs); 96 | } 97 | return super.eInverseRemove(otherEnd, featureID, msgs); 98 | } 99 | 100 | /** 101 | * 102 | * 103 | * @generated 104 | */ 105 | @Override 106 | public Object eGet(int featureID, boolean resolve, boolean coreType) 107 | { 108 | switch (featureID) 109 | { 110 | case DslPackage.ALIAS_LIST__RULES: 111 | return getRules(); 112 | } 113 | return super.eGet(featureID, resolve, coreType); 114 | } 115 | 116 | /** 117 | * 118 | * 119 | * @generated 120 | */ 121 | @SuppressWarnings("unchecked") 122 | @Override 123 | public void eSet(int featureID, Object newValue) 124 | { 125 | switch (featureID) 126 | { 127 | case DslPackage.ALIAS_LIST__RULES: 128 | getRules().clear(); 129 | getRules().addAll((Collection)newValue); 130 | return; 131 | } 132 | super.eSet(featureID, newValue); 133 | } 134 | 135 | /** 136 | * 137 | * 138 | * @generated 139 | */ 140 | @Override 141 | public void eUnset(int featureID) 142 | { 143 | switch (featureID) 144 | { 145 | case DslPackage.ALIAS_LIST__RULES: 146 | getRules().clear(); 147 | return; 148 | } 149 | super.eUnset(featureID); 150 | } 151 | 152 | /** 153 | * 154 | * 155 | * @generated 156 | */ 157 | @Override 158 | public boolean eIsSet(int featureID) 159 | { 160 | switch (featureID) 161 | { 162 | case DslPackage.ALIAS_LIST__RULES: 163 | return rules != null && !rules.isEmpty(); 164 | } 165 | return super.eIsSet(featureID); 166 | } 167 | 168 | } //AliasListImpl 169 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/TriggerRule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.common.util.EList; 7 | 8 | import org.eclipse.emf.ecore.EObject; 9 | 10 | /** 11 | * 12 | * A representation of the model object 'Trigger Rule'. 13 | * 14 | * 15 | *

16 | * The following features are supported: 17 | *

18 | *
    19 | *
  • {@link io.entitas.lang.dsl.TriggerRule#isRemoved Removed}
  • 20 | *
  • {@link io.entitas.lang.dsl.TriggerRule#isAdded Added}
  • 21 | *
  • {@link io.entitas.lang.dsl.TriggerRule#isRemovedOrAdded Removed Or Added}
  • 22 | *
  • {@link io.entitas.lang.dsl.TriggerRule#getComponents Components}
  • 23 | *
24 | * 25 | * @see io.entitas.lang.dsl.DslPackage#getTriggerRule() 26 | * @model 27 | * @generated 28 | */ 29 | public interface TriggerRule extends EObject 30 | { 31 | /** 32 | * Returns the value of the 'Removed' attribute. 33 | * 34 | *

35 | * If the meaning of the 'Removed' attribute isn't clear, 36 | * there really should be more of a description here... 37 | *

38 | * 39 | * @return the value of the 'Removed' attribute. 40 | * @see #setRemoved(boolean) 41 | * @see io.entitas.lang.dsl.DslPackage#getTriggerRule_Removed() 42 | * @model 43 | * @generated 44 | */ 45 | boolean isRemoved(); 46 | 47 | /** 48 | * Sets the value of the '{@link io.entitas.lang.dsl.TriggerRule#isRemoved Removed}' attribute. 49 | * 50 | * 51 | * @param value the new value of the 'Removed' attribute. 52 | * @see #isRemoved() 53 | * @generated 54 | */ 55 | void setRemoved(boolean value); 56 | 57 | /** 58 | * Returns the value of the 'Added' attribute. 59 | * 60 | *

61 | * If the meaning of the 'Added' attribute isn't clear, 62 | * there really should be more of a description here... 63 | *

64 | * 65 | * @return the value of the 'Added' attribute. 66 | * @see #setAdded(boolean) 67 | * @see io.entitas.lang.dsl.DslPackage#getTriggerRule_Added() 68 | * @model 69 | * @generated 70 | */ 71 | boolean isAdded(); 72 | 73 | /** 74 | * Sets the value of the '{@link io.entitas.lang.dsl.TriggerRule#isAdded Added}' attribute. 75 | * 76 | * 77 | * @param value the new value of the 'Added' attribute. 78 | * @see #isAdded() 79 | * @generated 80 | */ 81 | void setAdded(boolean value); 82 | 83 | /** 84 | * Returns the value of the 'Removed Or Added' attribute. 85 | * 86 | *

87 | * If the meaning of the 'Removed Or Added' attribute isn't clear, 88 | * there really should be more of a description here... 89 | *

90 | * 91 | * @return the value of the 'Removed Or Added' attribute. 92 | * @see #setRemovedOrAdded(boolean) 93 | * @see io.entitas.lang.dsl.DslPackage#getTriggerRule_RemovedOrAdded() 94 | * @model 95 | * @generated 96 | */ 97 | boolean isRemovedOrAdded(); 98 | 99 | /** 100 | * Sets the value of the '{@link io.entitas.lang.dsl.TriggerRule#isRemovedOrAdded Removed Or Added}' attribute. 101 | * 102 | * 103 | * @param value the new value of the 'Removed Or Added' attribute. 104 | * @see #isRemovedOrAdded() 105 | * @generated 106 | */ 107 | void setRemovedOrAdded(boolean value); 108 | 109 | /** 110 | * Returns the value of the 'Components' reference list. 111 | * The list contents are of type {@link io.entitas.lang.dsl.Component}. 112 | * 113 | *

114 | * If the meaning of the 'Components' reference list isn't clear, 115 | * there really should be more of a description here... 116 | *

117 | * 118 | * @return the value of the 'Components' reference list. 119 | * @see io.entitas.lang.dsl.DslPackage#getTriggerRule_Components() 120 | * @model 121 | * @generated 122 | */ 123 | EList getComponents(); 124 | 125 | } // TriggerRule 126 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/PropertyListImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.DslPackage; 7 | import io.entitas.lang.dsl.PropertyList; 8 | import io.entitas.lang.dsl.PropertyRules; 9 | 10 | import java.util.Collection; 11 | 12 | import org.eclipse.emf.common.notify.NotificationChain; 13 | 14 | import org.eclipse.emf.common.util.EList; 15 | 16 | import org.eclipse.emf.ecore.EClass; 17 | import org.eclipse.emf.ecore.InternalEObject; 18 | 19 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 20 | 21 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; 22 | import org.eclipse.emf.ecore.util.InternalEList; 23 | 24 | /** 25 | * 26 | * An implementation of the model object 'Property List'. 27 | * 28 | *

29 | * The following features are implemented: 30 | *

31 | *
    32 | *
  • {@link io.entitas.lang.dsl.impl.PropertyListImpl#getRules Rules}
  • 33 | *
34 | * 35 | * @generated 36 | */ 37 | public class PropertyListImpl extends MinimalEObjectImpl.Container implements PropertyList 38 | { 39 | /** 40 | * The cached value of the '{@link #getRules() Rules}' containment reference list. 41 | * 42 | * 43 | * @see #getRules() 44 | * @generated 45 | * @ordered 46 | */ 47 | protected EList rules; 48 | 49 | /** 50 | * 51 | * 52 | * @generated 53 | */ 54 | protected PropertyListImpl() 55 | { 56 | super(); 57 | } 58 | 59 | /** 60 | * 61 | * 62 | * @generated 63 | */ 64 | @Override 65 | protected EClass eStaticClass() 66 | { 67 | return DslPackage.Literals.PROPERTY_LIST; 68 | } 69 | 70 | /** 71 | * 72 | * 73 | * @generated 74 | */ 75 | public EList getRules() 76 | { 77 | if (rules == null) 78 | { 79 | rules = new EObjectContainmentEList(PropertyRules.class, this, DslPackage.PROPERTY_LIST__RULES); 80 | } 81 | return rules; 82 | } 83 | 84 | /** 85 | * 86 | * 87 | * @generated 88 | */ 89 | @Override 90 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) 91 | { 92 | switch (featureID) 93 | { 94 | case DslPackage.PROPERTY_LIST__RULES: 95 | return ((InternalEList)getRules()).basicRemove(otherEnd, msgs); 96 | } 97 | return super.eInverseRemove(otherEnd, featureID, msgs); 98 | } 99 | 100 | /** 101 | * 102 | * 103 | * @generated 104 | */ 105 | @Override 106 | public Object eGet(int featureID, boolean resolve, boolean coreType) 107 | { 108 | switch (featureID) 109 | { 110 | case DslPackage.PROPERTY_LIST__RULES: 111 | return getRules(); 112 | } 113 | return super.eGet(featureID, resolve, coreType); 114 | } 115 | 116 | /** 117 | * 118 | * 119 | * @generated 120 | */ 121 | @SuppressWarnings("unchecked") 122 | @Override 123 | public void eSet(int featureID, Object newValue) 124 | { 125 | switch (featureID) 126 | { 127 | case DslPackage.PROPERTY_LIST__RULES: 128 | getRules().clear(); 129 | getRules().addAll((Collection)newValue); 130 | return; 131 | } 132 | super.eSet(featureID, newValue); 133 | } 134 | 135 | /** 136 | * 137 | * 138 | * @generated 139 | */ 140 | @Override 141 | public void eUnset(int featureID) 142 | { 143 | switch (featureID) 144 | { 145 | case DslPackage.PROPERTY_LIST__RULES: 146 | getRules().clear(); 147 | return; 148 | } 149 | super.eUnset(featureID); 150 | } 151 | 152 | /** 153 | * 154 | * 155 | * @generated 156 | */ 157 | @Override 158 | public boolean eIsSet(int featureID) 159 | { 160 | switch (featureID) 161 | { 162 | case DslPackage.PROPERTY_LIST__RULES: 163 | return rules != null && !rules.isEmpty(); 164 | } 165 | return super.eIsSet(featureID); 166 | } 167 | 168 | } //PropertyListImpl 169 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/NamespaceImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.DslPackage; 7 | import io.entitas.lang.dsl.Namespace; 8 | 9 | import org.eclipse.emf.common.notify.Notification; 10 | 11 | import org.eclipse.emf.ecore.EClass; 12 | 13 | import org.eclipse.emf.ecore.impl.ENotificationImpl; 14 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 15 | 16 | /** 17 | * 18 | * An implementation of the model object 'Namespace'. 19 | * 20 | *

21 | * The following features are implemented: 22 | *

23 | *
    24 | *
  • {@link io.entitas.lang.dsl.impl.NamespaceImpl#getName Name}
  • 25 | *
26 | * 27 | * @generated 28 | */ 29 | public class NamespaceImpl extends MinimalEObjectImpl.Container implements Namespace 30 | { 31 | /** 32 | * The default value of the '{@link #getName() Name}' attribute. 33 | * 34 | * 35 | * @see #getName() 36 | * @generated 37 | * @ordered 38 | */ 39 | protected static final String NAME_EDEFAULT = null; 40 | 41 | /** 42 | * The cached value of the '{@link #getName() Name}' attribute. 43 | * 44 | * 45 | * @see #getName() 46 | * @generated 47 | * @ordered 48 | */ 49 | protected String name = NAME_EDEFAULT; 50 | 51 | /** 52 | * 53 | * 54 | * @generated 55 | */ 56 | protected NamespaceImpl() 57 | { 58 | super(); 59 | } 60 | 61 | /** 62 | * 63 | * 64 | * @generated 65 | */ 66 | @Override 67 | protected EClass eStaticClass() 68 | { 69 | return DslPackage.Literals.NAMESPACE; 70 | } 71 | 72 | /** 73 | * 74 | * 75 | * @generated 76 | */ 77 | public String getName() 78 | { 79 | return name; 80 | } 81 | 82 | /** 83 | * 84 | * 85 | * @generated 86 | */ 87 | public void setName(String newName) 88 | { 89 | String oldName = name; 90 | name = newName; 91 | if (eNotificationRequired()) 92 | eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.NAMESPACE__NAME, oldName, name)); 93 | } 94 | 95 | /** 96 | * 97 | * 98 | * @generated 99 | */ 100 | @Override 101 | public Object eGet(int featureID, boolean resolve, boolean coreType) 102 | { 103 | switch (featureID) 104 | { 105 | case DslPackage.NAMESPACE__NAME: 106 | return getName(); 107 | } 108 | return super.eGet(featureID, resolve, coreType); 109 | } 110 | 111 | /** 112 | * 113 | * 114 | * @generated 115 | */ 116 | @Override 117 | public void eSet(int featureID, Object newValue) 118 | { 119 | switch (featureID) 120 | { 121 | case DslPackage.NAMESPACE__NAME: 122 | setName((String)newValue); 123 | return; 124 | } 125 | super.eSet(featureID, newValue); 126 | } 127 | 128 | /** 129 | * 130 | * 131 | * @generated 132 | */ 133 | @Override 134 | public void eUnset(int featureID) 135 | { 136 | switch (featureID) 137 | { 138 | case DslPackage.NAMESPACE__NAME: 139 | setName(NAME_EDEFAULT); 140 | return; 141 | } 142 | super.eUnset(featureID); 143 | } 144 | 145 | /** 146 | * 147 | * 148 | * @generated 149 | */ 150 | @Override 151 | public boolean eIsSet(int featureID) 152 | { 153 | switch (featureID) 154 | { 155 | case DslPackage.NAMESPACE__NAME: 156 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); 157 | } 158 | return super.eIsSet(featureID); 159 | } 160 | 161 | /** 162 | * 163 | * 164 | * @generated 165 | */ 166 | @Override 167 | public String toString() 168 | { 169 | if (eIsProxy()) return super.toString(); 170 | 171 | StringBuffer result = new StringBuffer(super.toString()); 172 | result.append(" (name: "); 173 | result.append(name); 174 | result.append(')'); 175 | return result.toString(); 176 | } 177 | 178 | } //NamespaceImpl 179 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/java/io/entitas/lang/extensions/SystemExtensions.xtend: -------------------------------------------------------------------------------- 1 | package io.entitas.lang.extensions 2 | 3 | import static extension io.entitas.lang.extensions.ComponentExtensions.* 4 | import static extension io.entitas.lang.extensions.AccessRuleExtensions.* 5 | import java.util.HashSet 6 | 7 | class SystemExtensions { 8 | static def systemTypeName(io.entitas.lang.dsl.System system) { 9 | if (system.name.endsWith("System")) { 10 | return system.name.toFirstUpper 11 | } else { 12 | return system.name.toFirstUpper + "System" 13 | } 14 | } 15 | 16 | static def systemName(io.entitas.lang.dsl.System system) { 17 | if (system.name.endsWith("System")) { 18 | return system.name.substring(0, system.name.length - 6).toFirstUpper 19 | } else { 20 | return system.name.toFirstUpper 21 | } 22 | } 23 | 24 | static def isInit(io.entitas.lang.dsl.System system) { 25 | system.parameters.contains("init") 26 | } 27 | 28 | static def isExecute(io.entitas.lang.dsl.System system) { 29 | system.parameters.contains("no_exec") == false 30 | } 31 | 32 | static def isCleanup(io.entitas.lang.dsl.System system) { 33 | system.parameters.contains("cleanup") 34 | } 35 | 36 | static def isTeardown(io.entitas.lang.dsl.System system) { 37 | system.parameters.contains("teardown") 38 | } 39 | 40 | static def isExplicitContextList(io.entitas.lang.dsl.System system) { 41 | system.parameters.contains("explicit_context_list") 42 | } 43 | 44 | static def String triggerContextName(io.entitas.lang.dsl.System system, String defaultContextName) { 45 | if (system.scope !== null){ 46 | return system.scope.reference.name.toFirstUpper 47 | } 48 | return system.triggerContextNameWithoutConcideringScope(defaultContextName) 49 | } 50 | 51 | static def String triggerContextNameWithoutConcideringScope(io.entitas.lang.dsl.System system, String defaultContextName) { 52 | 53 | if (system.triggerRules.isNullOrEmpty){ 54 | return null 55 | } 56 | var HashSet result = null 57 | for(rule : system.triggerRules){ 58 | for (component : rule.components){ 59 | if (result === null){ 60 | result = newHashSet(component.contextNameList(defaultContextName)) 61 | } else { 62 | result.retainAll(component.contextNameList(defaultContextName)) 63 | } 64 | } 65 | } 66 | if(system.matcherRules !== null) { 67 | for(component : system.matcherRules.allComponents){ 68 | result.retainAll(component.contextNameList(defaultContextName)) 69 | } 70 | } 71 | 72 | if (result.size != 1){ 73 | return null 74 | } 75 | result.head 76 | } 77 | 78 | static def interfacesToImplement(io.entitas.lang.dsl.System system, String defaultContextName){ 79 | var result = newArrayList() 80 | if (system.isReactive){ 81 | result.add("ReactiveSystem<" + system.triggerContextName(defaultContextName) + "Entity>") 82 | } else { 83 | if (system.isExecute){ 84 | result.add("IExecuteSystem") 85 | } 86 | } 87 | if (system.isInit){ 88 | result.add("IInitializeSystem") 89 | } 90 | if (system.isCleanup){ 91 | result.add("ICleanupSystem") 92 | } 93 | if (system.isTeardown){ 94 | result.add("ITearDownSystem") 95 | } 96 | return result 97 | } 98 | 99 | static def contextNameList(io.entitas.lang.dsl.System system, String defaultContextName){ 100 | var result = newHashSet() 101 | if (system.isReactive){ 102 | result.add(system.triggerContextName(defaultContextName)) 103 | } 104 | for (rule : system.accessRules){ 105 | result.add(rule.contextName(defaultContextName)) 106 | } 107 | return result.sort 108 | } 109 | 110 | static def abstractMethods(io.entitas.lang.dsl.System system, String defaultContextName){ 111 | var result = newArrayList() 112 | if (system.isReactive){ 113 | result.add("protected abstract override void Execute(System.Collections.Generic.List<" + system.triggerContextName(defaultContextName) + "Entity> entities);") 114 | if(system.noFilter == false && system.matcherRules === null){ 115 | result.add("protected abstract override bool Filter(" + system.triggerContextName(defaultContextName) + "Entity entity);") 116 | } 117 | } else { 118 | if (system.isExecute){ 119 | result.add("public abstract void Execute();") 120 | } 121 | } 122 | if (system.isInit){ 123 | result.add("public abstract void Initialize();") 124 | } 125 | if (system.isCleanup){ 126 | result.add("public abstract void Cleanup();") 127 | } 128 | if (system.isTeardown){ 129 | result.add("public abstract void TearDown();") 130 | } 131 | return result 132 | } 133 | } -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/TargetParameterImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.DslPackage; 7 | import io.entitas.lang.dsl.TargetParameter; 8 | 9 | import org.eclipse.emf.common.notify.Notification; 10 | 11 | import org.eclipse.emf.ecore.EClass; 12 | 13 | import org.eclipse.emf.ecore.impl.ENotificationImpl; 14 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 15 | 16 | /** 17 | * 18 | * An implementation of the model object 'Target Parameter'. 19 | * 20 | *

21 | * The following features are implemented: 22 | *

23 | *
    24 | *
  • {@link io.entitas.lang.dsl.impl.TargetParameterImpl#getPath Path}
  • 25 | *
26 | * 27 | * @generated 28 | */ 29 | public class TargetParameterImpl extends MinimalEObjectImpl.Container implements TargetParameter 30 | { 31 | /** 32 | * The default value of the '{@link #getPath() Path}' attribute. 33 | * 34 | * 35 | * @see #getPath() 36 | * @generated 37 | * @ordered 38 | */ 39 | protected static final String PATH_EDEFAULT = null; 40 | 41 | /** 42 | * The cached value of the '{@link #getPath() Path}' attribute. 43 | * 44 | * 45 | * @see #getPath() 46 | * @generated 47 | * @ordered 48 | */ 49 | protected String path = PATH_EDEFAULT; 50 | 51 | /** 52 | * 53 | * 54 | * @generated 55 | */ 56 | protected TargetParameterImpl() 57 | { 58 | super(); 59 | } 60 | 61 | /** 62 | * 63 | * 64 | * @generated 65 | */ 66 | @Override 67 | protected EClass eStaticClass() 68 | { 69 | return DslPackage.Literals.TARGET_PARAMETER; 70 | } 71 | 72 | /** 73 | * 74 | * 75 | * @generated 76 | */ 77 | public String getPath() 78 | { 79 | return path; 80 | } 81 | 82 | /** 83 | * 84 | * 85 | * @generated 86 | */ 87 | public void setPath(String newPath) 88 | { 89 | String oldPath = path; 90 | path = newPath; 91 | if (eNotificationRequired()) 92 | eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.TARGET_PARAMETER__PATH, oldPath, path)); 93 | } 94 | 95 | /** 96 | * 97 | * 98 | * @generated 99 | */ 100 | @Override 101 | public Object eGet(int featureID, boolean resolve, boolean coreType) 102 | { 103 | switch (featureID) 104 | { 105 | case DslPackage.TARGET_PARAMETER__PATH: 106 | return getPath(); 107 | } 108 | return super.eGet(featureID, resolve, coreType); 109 | } 110 | 111 | /** 112 | * 113 | * 114 | * @generated 115 | */ 116 | @Override 117 | public void eSet(int featureID, Object newValue) 118 | { 119 | switch (featureID) 120 | { 121 | case DslPackage.TARGET_PARAMETER__PATH: 122 | setPath((String)newValue); 123 | return; 124 | } 125 | super.eSet(featureID, newValue); 126 | } 127 | 128 | /** 129 | * 130 | * 131 | * @generated 132 | */ 133 | @Override 134 | public void eUnset(int featureID) 135 | { 136 | switch (featureID) 137 | { 138 | case DslPackage.TARGET_PARAMETER__PATH: 139 | setPath(PATH_EDEFAULT); 140 | return; 141 | } 142 | super.eUnset(featureID); 143 | } 144 | 145 | /** 146 | * 147 | * 148 | * @generated 149 | */ 150 | @Override 151 | public boolean eIsSet(int featureID) 152 | { 153 | switch (featureID) 154 | { 155 | case DslPackage.TARGET_PARAMETER__PATH: 156 | return PATH_EDEFAULT == null ? path != null : !PATH_EDEFAULT.equals(path); 157 | } 158 | return super.eIsSet(featureID); 159 | } 160 | 161 | /** 162 | * 163 | * 164 | * @generated 165 | */ 166 | @Override 167 | public String toString() 168 | { 169 | if (eIsProxy()) return super.toString(); 170 | 171 | StringBuffer result = new StringBuffer(super.toString()); 172 | result.append(" (path: "); 173 | result.append(path); 174 | result.append(')'); 175 | return result.toString(); 176 | } 177 | 178 | } //TargetParameterImpl 179 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/PropertyPrefixImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.DslPackage; 7 | import io.entitas.lang.dsl.PropertyPrefix; 8 | 9 | import org.eclipse.emf.common.notify.Notification; 10 | 11 | import org.eclipse.emf.ecore.EClass; 12 | 13 | import org.eclipse.emf.ecore.impl.ENotificationImpl; 14 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 15 | 16 | /** 17 | * 18 | * An implementation of the model object 'Property Prefix'. 19 | * 20 | *

21 | * The following features are implemented: 22 | *

23 | *
    24 | *
  • {@link io.entitas.lang.dsl.impl.PropertyPrefixImpl#getString String}
  • 25 | *
26 | * 27 | * @generated 28 | */ 29 | public class PropertyPrefixImpl extends MinimalEObjectImpl.Container implements PropertyPrefix 30 | { 31 | /** 32 | * The default value of the '{@link #getString() String}' attribute. 33 | * 34 | * 35 | * @see #getString() 36 | * @generated 37 | * @ordered 38 | */ 39 | protected static final String STRING_EDEFAULT = null; 40 | 41 | /** 42 | * The cached value of the '{@link #getString() String}' attribute. 43 | * 44 | * 45 | * @see #getString() 46 | * @generated 47 | * @ordered 48 | */ 49 | protected String string = STRING_EDEFAULT; 50 | 51 | /** 52 | * 53 | * 54 | * @generated 55 | */ 56 | protected PropertyPrefixImpl() 57 | { 58 | super(); 59 | } 60 | 61 | /** 62 | * 63 | * 64 | * @generated 65 | */ 66 | @Override 67 | protected EClass eStaticClass() 68 | { 69 | return DslPackage.Literals.PROPERTY_PREFIX; 70 | } 71 | 72 | /** 73 | * 74 | * 75 | * @generated 76 | */ 77 | public String getString() 78 | { 79 | return string; 80 | } 81 | 82 | /** 83 | * 84 | * 85 | * @generated 86 | */ 87 | public void setString(String newString) 88 | { 89 | String oldString = string; 90 | string = newString; 91 | if (eNotificationRequired()) 92 | eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.PROPERTY_PREFIX__STRING, oldString, string)); 93 | } 94 | 95 | /** 96 | * 97 | * 98 | * @generated 99 | */ 100 | @Override 101 | public Object eGet(int featureID, boolean resolve, boolean coreType) 102 | { 103 | switch (featureID) 104 | { 105 | case DslPackage.PROPERTY_PREFIX__STRING: 106 | return getString(); 107 | } 108 | return super.eGet(featureID, resolve, coreType); 109 | } 110 | 111 | /** 112 | * 113 | * 114 | * @generated 115 | */ 116 | @Override 117 | public void eSet(int featureID, Object newValue) 118 | { 119 | switch (featureID) 120 | { 121 | case DslPackage.PROPERTY_PREFIX__STRING: 122 | setString((String)newValue); 123 | return; 124 | } 125 | super.eSet(featureID, newValue); 126 | } 127 | 128 | /** 129 | * 130 | * 131 | * @generated 132 | */ 133 | @Override 134 | public void eUnset(int featureID) 135 | { 136 | switch (featureID) 137 | { 138 | case DslPackage.PROPERTY_PREFIX__STRING: 139 | setString(STRING_EDEFAULT); 140 | return; 141 | } 142 | super.eUnset(featureID); 143 | } 144 | 145 | /** 146 | * 147 | * 148 | * @generated 149 | */ 150 | @Override 151 | public boolean eIsSet(int featureID) 152 | { 153 | switch (featureID) 154 | { 155 | case DslPackage.PROPERTY_PREFIX__STRING: 156 | return STRING_EDEFAULT == null ? string != null : !STRING_EDEFAULT.equals(string); 157 | } 158 | return super.eIsSet(featureID); 159 | } 160 | 161 | /** 162 | * 163 | * 164 | * @generated 165 | */ 166 | @Override 167 | public String toString() 168 | { 169 | if (eIsProxy()) return super.toString(); 170 | 171 | StringBuffer result = new StringBuffer(super.toString()); 172 | result.append(" (string: "); 173 | result.append(string); 174 | result.append(')'); 175 | return result.toString(); 176 | } 177 | 178 | } //PropertyPrefixImpl 179 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/ContextScopeImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.ContextId; 7 | import io.entitas.lang.dsl.ContextScope; 8 | import io.entitas.lang.dsl.DslPackage; 9 | 10 | import org.eclipse.emf.common.notify.Notification; 11 | 12 | import org.eclipse.emf.ecore.EClass; 13 | import org.eclipse.emf.ecore.InternalEObject; 14 | 15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; 16 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 17 | 18 | /** 19 | * 20 | * An implementation of the model object 'Context Scope'. 21 | * 22 | *

23 | * The following features are implemented: 24 | *

25 | *
    26 | *
  • {@link io.entitas.lang.dsl.impl.ContextScopeImpl#getReference Reference}
  • 27 | *
28 | * 29 | * @generated 30 | */ 31 | public class ContextScopeImpl extends MinimalEObjectImpl.Container implements ContextScope 32 | { 33 | /** 34 | * The cached value of the '{@link #getReference() Reference}' reference. 35 | * 36 | * 37 | * @see #getReference() 38 | * @generated 39 | * @ordered 40 | */ 41 | protected ContextId reference; 42 | 43 | /** 44 | * 45 | * 46 | * @generated 47 | */ 48 | protected ContextScopeImpl() 49 | { 50 | super(); 51 | } 52 | 53 | /** 54 | * 55 | * 56 | * @generated 57 | */ 58 | @Override 59 | protected EClass eStaticClass() 60 | { 61 | return DslPackage.Literals.CONTEXT_SCOPE; 62 | } 63 | 64 | /** 65 | * 66 | * 67 | * @generated 68 | */ 69 | public ContextId getReference() 70 | { 71 | if (reference != null && reference.eIsProxy()) 72 | { 73 | InternalEObject oldReference = (InternalEObject)reference; 74 | reference = (ContextId)eResolveProxy(oldReference); 75 | if (reference != oldReference) 76 | { 77 | if (eNotificationRequired()) 78 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, DslPackage.CONTEXT_SCOPE__REFERENCE, oldReference, reference)); 79 | } 80 | } 81 | return reference; 82 | } 83 | 84 | /** 85 | * 86 | * 87 | * @generated 88 | */ 89 | public ContextId basicGetReference() 90 | { 91 | return reference; 92 | } 93 | 94 | /** 95 | * 96 | * 97 | * @generated 98 | */ 99 | public void setReference(ContextId newReference) 100 | { 101 | ContextId oldReference = reference; 102 | reference = newReference; 103 | if (eNotificationRequired()) 104 | eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.CONTEXT_SCOPE__REFERENCE, oldReference, reference)); 105 | } 106 | 107 | /** 108 | * 109 | * 110 | * @generated 111 | */ 112 | @Override 113 | public Object eGet(int featureID, boolean resolve, boolean coreType) 114 | { 115 | switch (featureID) 116 | { 117 | case DslPackage.CONTEXT_SCOPE__REFERENCE: 118 | if (resolve) return getReference(); 119 | return basicGetReference(); 120 | } 121 | return super.eGet(featureID, resolve, coreType); 122 | } 123 | 124 | /** 125 | * 126 | * 127 | * @generated 128 | */ 129 | @Override 130 | public void eSet(int featureID, Object newValue) 131 | { 132 | switch (featureID) 133 | { 134 | case DslPackage.CONTEXT_SCOPE__REFERENCE: 135 | setReference((ContextId)newValue); 136 | return; 137 | } 138 | super.eSet(featureID, newValue); 139 | } 140 | 141 | /** 142 | * 143 | * 144 | * @generated 145 | */ 146 | @Override 147 | public void eUnset(int featureID) 148 | { 149 | switch (featureID) 150 | { 151 | case DslPackage.CONTEXT_SCOPE__REFERENCE: 152 | setReference((ContextId)null); 153 | return; 154 | } 155 | super.eUnset(featureID); 156 | } 157 | 158 | /** 159 | * 160 | * 161 | * @generated 162 | */ 163 | @Override 164 | public boolean eIsSet(int featureID) 165 | { 166 | switch (featureID) 167 | { 168 | case DslPackage.CONTEXT_SCOPE__REFERENCE: 169 | return reference != null; 170 | } 171 | return super.eIsSet(featureID); 172 | } 173 | 174 | } //ContextScopeImpl 175 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/impl/SingleAliasImpl.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl.impl; 5 | 6 | import io.entitas.lang.dsl.DslPackage; 7 | import io.entitas.lang.dsl.SingleAlias; 8 | 9 | import org.eclipse.emf.common.notify.Notification; 10 | 11 | import org.eclipse.emf.ecore.EClass; 12 | 13 | import org.eclipse.emf.ecore.impl.ENotificationImpl; 14 | import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; 15 | 16 | /** 17 | * 18 | * An implementation of the model object 'Single Alias'. 19 | * 20 | *

21 | * The following features are implemented: 22 | *

23 | *
    24 | *
  • {@link io.entitas.lang.dsl.impl.SingleAliasImpl#getTypeAlias Type Alias}
  • 25 | *
26 | * 27 | * @generated 28 | */ 29 | public class SingleAliasImpl extends MinimalEObjectImpl.Container implements SingleAlias 30 | { 31 | /** 32 | * The default value of the '{@link #getTypeAlias() Type Alias}' attribute. 33 | * 34 | * 35 | * @see #getTypeAlias() 36 | * @generated 37 | * @ordered 38 | */ 39 | protected static final String TYPE_ALIAS_EDEFAULT = null; 40 | 41 | /** 42 | * The cached value of the '{@link #getTypeAlias() Type Alias}' attribute. 43 | * 44 | * 45 | * @see #getTypeAlias() 46 | * @generated 47 | * @ordered 48 | */ 49 | protected String typeAlias = TYPE_ALIAS_EDEFAULT; 50 | 51 | /** 52 | * 53 | * 54 | * @generated 55 | */ 56 | protected SingleAliasImpl() 57 | { 58 | super(); 59 | } 60 | 61 | /** 62 | * 63 | * 64 | * @generated 65 | */ 66 | @Override 67 | protected EClass eStaticClass() 68 | { 69 | return DslPackage.Literals.SINGLE_ALIAS; 70 | } 71 | 72 | /** 73 | * 74 | * 75 | * @generated 76 | */ 77 | public String getTypeAlias() 78 | { 79 | return typeAlias; 80 | } 81 | 82 | /** 83 | * 84 | * 85 | * @generated 86 | */ 87 | public void setTypeAlias(String newTypeAlias) 88 | { 89 | String oldTypeAlias = typeAlias; 90 | typeAlias = newTypeAlias; 91 | if (eNotificationRequired()) 92 | eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.SINGLE_ALIAS__TYPE_ALIAS, oldTypeAlias, typeAlias)); 93 | } 94 | 95 | /** 96 | * 97 | * 98 | * @generated 99 | */ 100 | @Override 101 | public Object eGet(int featureID, boolean resolve, boolean coreType) 102 | { 103 | switch (featureID) 104 | { 105 | case DslPackage.SINGLE_ALIAS__TYPE_ALIAS: 106 | return getTypeAlias(); 107 | } 108 | return super.eGet(featureID, resolve, coreType); 109 | } 110 | 111 | /** 112 | * 113 | * 114 | * @generated 115 | */ 116 | @Override 117 | public void eSet(int featureID, Object newValue) 118 | { 119 | switch (featureID) 120 | { 121 | case DslPackage.SINGLE_ALIAS__TYPE_ALIAS: 122 | setTypeAlias((String)newValue); 123 | return; 124 | } 125 | super.eSet(featureID, newValue); 126 | } 127 | 128 | /** 129 | * 130 | * 131 | * @generated 132 | */ 133 | @Override 134 | public void eUnset(int featureID) 135 | { 136 | switch (featureID) 137 | { 138 | case DslPackage.SINGLE_ALIAS__TYPE_ALIAS: 139 | setTypeAlias(TYPE_ALIAS_EDEFAULT); 140 | return; 141 | } 142 | super.eUnset(featureID); 143 | } 144 | 145 | /** 146 | * 147 | * 148 | * @generated 149 | */ 150 | @Override 151 | public boolean eIsSet(int featureID) 152 | { 153 | switch (featureID) 154 | { 155 | case DslPackage.SINGLE_ALIAS__TYPE_ALIAS: 156 | return TYPE_ALIAS_EDEFAULT == null ? typeAlias != null : !TYPE_ALIAS_EDEFAULT.equals(typeAlias); 157 | } 158 | return super.eIsSet(featureID); 159 | } 160 | 161 | /** 162 | * 163 | * 164 | * @generated 165 | */ 166 | @Override 167 | public String toString() 168 | { 169 | if (eIsProxy()) return super.toString(); 170 | 171 | StringBuffer result = new StringBuffer(super.toString()); 172 | result.append(" (typeAlias: "); 173 | result.append(typeAlias); 174 | result.append(')'); 175 | return result.toString(); 176 | } 177 | 178 | } //SingleAliasImpl 179 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/main/xtext-gen/io/entitas/lang/dsl/AccessRule.java: -------------------------------------------------------------------------------- 1 | /** 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.dsl; 5 | 6 | import org.eclipse.emf.ecore.EObject; 7 | 8 | /** 9 | * 10 | * A representation of the model object 'Access Rule'. 11 | * 12 | * 13 | *

14 | * The following features are supported: 15 | *

16 | *
    17 | *
  • {@link io.entitas.lang.dsl.AccessRule#getName Name}
  • 18 | *
  • {@link io.entitas.lang.dsl.AccessRule#getMatcherRule Matcher Rule}
  • 19 | *
  • {@link io.entitas.lang.dsl.AccessRule#getScope Scope}
  • 20 | *
  • {@link io.entitas.lang.dsl.AccessRule#getContextRef Context Ref}
  • 21 | *
22 | * 23 | * @see io.entitas.lang.dsl.DslPackage#getAccessRule() 24 | * @model 25 | * @generated 26 | */ 27 | public interface AccessRule extends EObject 28 | { 29 | /** 30 | * Returns the value of the 'Name' attribute. 31 | * 32 | *

33 | * If the meaning of the 'Name' attribute isn't clear, 34 | * there really should be more of a description here... 35 | *

36 | * 37 | * @return the value of the 'Name' attribute. 38 | * @see #setName(String) 39 | * @see io.entitas.lang.dsl.DslPackage#getAccessRule_Name() 40 | * @model 41 | * @generated 42 | */ 43 | String getName(); 44 | 45 | /** 46 | * Sets the value of the '{@link io.entitas.lang.dsl.AccessRule#getName Name}' attribute. 47 | * 48 | * 49 | * @param value the new value of the 'Name' attribute. 50 | * @see #getName() 51 | * @generated 52 | */ 53 | void setName(String value); 54 | 55 | /** 56 | * Returns the value of the 'Matcher Rule' containment reference. 57 | * 58 | *

59 | * If the meaning of the 'Matcher Rule' containment reference isn't clear, 60 | * there really should be more of a description here... 61 | *

62 | * 63 | * @return the value of the 'Matcher Rule' containment reference. 64 | * @see #setMatcherRule(MatcherRule) 65 | * @see io.entitas.lang.dsl.DslPackage#getAccessRule_MatcherRule() 66 | * @model containment="true" 67 | * @generated 68 | */ 69 | MatcherRule getMatcherRule(); 70 | 71 | /** 72 | * Sets the value of the '{@link io.entitas.lang.dsl.AccessRule#getMatcherRule Matcher Rule}' containment reference. 73 | * 74 | * 75 | * @param value the new value of the 'Matcher Rule' containment reference. 76 | * @see #getMatcherRule() 77 | * @generated 78 | */ 79 | void setMatcherRule(MatcherRule value); 80 | 81 | /** 82 | * Returns the value of the 'Scope' containment reference. 83 | * 84 | *

85 | * If the meaning of the 'Scope' containment reference isn't clear, 86 | * there really should be more of a description here... 87 | *

88 | * 89 | * @return the value of the 'Scope' containment reference. 90 | * @see #setScope(ContextScope) 91 | * @see io.entitas.lang.dsl.DslPackage#getAccessRule_Scope() 92 | * @model containment="true" 93 | * @generated 94 | */ 95 | ContextScope getScope(); 96 | 97 | /** 98 | * Sets the value of the '{@link io.entitas.lang.dsl.AccessRule#getScope Scope}' containment reference. 99 | * 100 | * 101 | * @param value the new value of the 'Scope' containment reference. 102 | * @see #getScope() 103 | * @generated 104 | */ 105 | void setScope(ContextScope value); 106 | 107 | /** 108 | * Returns the value of the 'Context Ref' reference. 109 | * 110 | *

111 | * If the meaning of the 'Context Ref' reference isn't clear, 112 | * there really should be more of a description here... 113 | *

114 | * 115 | * @return the value of the 'Context Ref' reference. 116 | * @see #setContextRef(ContextId) 117 | * @see io.entitas.lang.dsl.DslPackage#getAccessRule_ContextRef() 118 | * @model 119 | * @generated 120 | */ 121 | ContextId getContextRef(); 122 | 123 | /** 124 | * Sets the value of the '{@link io.entitas.lang.dsl.AccessRule#getContextRef Context Ref}' reference. 125 | * 126 | * 127 | * @param value the new value of the 'Context Ref' reference. 128 | * @see #getContextRef() 129 | * @generated 130 | */ 131 | void setContextRef(ContextId value); 132 | 133 | } // AccessRule 134 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/io.entitas.lang/src/test/java/io/entitas/lang/tests/ContextGenerationExtensionTest.xtend: -------------------------------------------------------------------------------- 1 | /* 2 | * generated by Xtext 2.11.0 3 | */ 4 | package io.entitas.lang.tests 5 | 6 | import com.google.inject.Inject 7 | import org.eclipse.xtext.testing.InjectWith 8 | import org.eclipse.xtext.testing.XtextRunner 9 | import org.eclipse.xtext.testing.util.ParseHelper 10 | import org.junit.Assert 11 | import org.junit.Test 12 | import org.junit.runner.RunWith 13 | import io.entitas.lang.dsl.Root 14 | import static extension io.entitas.lang.generator.entitas_csharp.ContextGenerationExtension.* 15 | 16 | @RunWith(XtextRunner) 17 | @InjectWith(DSLInjectorProvider) 18 | class ContextGenerationExtensionTest { 19 | @Inject 20 | ParseHelper parseHelper 21 | 22 | @Test 23 | def void entityClassGenerationt() { 24 | val result = parseHelper.parse(''' 25 | target A 26 | context Core, Input, Map 27 | ''') 28 | Assert.assertNotNull(result) 29 | Assert.assertTrue(result.eResource.errors.isEmpty) 30 | 31 | Assert.assertEquals(''' 32 | public sealed partial class CoreEntity : Entity {} 33 | public sealed partial class InputEntity : Entity {} 34 | public sealed partial class MapEntity : Entity {} 35 | '''.toString, 36 | result.context.entityClassDefinitions.toString 37 | ) 38 | } 39 | 40 | @Test 41 | def void contextClassGenerationt() { 42 | val result = parseHelper.parse(''' 43 | target A 44 | context Core, Input, Map 45 | ''') 46 | Assert.assertNotNull(result) 47 | Assert.assertTrue(result.eResource.errors.isEmpty) 48 | 49 | Assert.assertEquals(''' 50 | public sealed partial class CoreContext : Context { 51 | 52 | public CoreContext() : base( 53 | CoreComponentsLookup.TotalComponents, 54 | 0, 55 | new ContextInfo( 56 | "Core Context", 57 | CoreComponentsLookup.componentNames, 58 | CoreComponentsLookup.componentTypes 59 | ), 60 | (entity) => 61 | 62 | #if (ENTITAS_FAST_AND_UNSAFE) 63 | new Entitas.UnsafeAERC() 64 | #else 65 | new Entitas.SafeAERC(entity) 66 | #endif 67 | ) {} 68 | } 69 | public sealed partial class InputContext : Context { 70 | 71 | public InputContext() : base( 72 | InputComponentsLookup.TotalComponents, 73 | 0, 74 | new ContextInfo( 75 | "Input Context", 76 | InputComponentsLookup.componentNames, 77 | InputComponentsLookup.componentTypes 78 | ), 79 | (entity) => 80 | 81 | #if (ENTITAS_FAST_AND_UNSAFE) 82 | new Entitas.UnsafeAERC() 83 | #else 84 | new Entitas.SafeAERC(entity) 85 | #endif 86 | ) {} 87 | } 88 | public sealed partial class MapContext : Context { 89 | 90 | public MapContext() : base( 91 | MapComponentsLookup.TotalComponents, 92 | 0, 93 | new ContextInfo( 94 | "Map Context", 95 | MapComponentsLookup.componentNames, 96 | MapComponentsLookup.componentTypes 97 | ), 98 | (entity) => 99 | 100 | #if (ENTITAS_FAST_AND_UNSAFE) 101 | new Entitas.UnsafeAERC() 102 | #else 103 | new Entitas.SafeAERC(entity) 104 | #endif 105 | ) {} 106 | } 107 | '''.toString, 108 | result.context.contextClassDefinitions.toString 109 | ) 110 | } 111 | 112 | @Test 113 | def void contextsHelperClassGenerationt() { 114 | val result = parseHelper.parse(''' 115 | target A 116 | context Core, Input, Map 117 | ''') 118 | Assert.assertNotNull(result) 119 | Assert.assertTrue(result.eResource.errors.isEmpty) 120 | 121 | Assert.assertEquals(''' 122 | public partial class Contexts : IContexts { 123 | 124 | public static Contexts sharedInstance { 125 | get { 126 | if(_sharedInstance == null) { 127 | _sharedInstance = new Contexts(); 128 | } 129 | 130 | return _sharedInstance; 131 | } 132 | set { _sharedInstance = value; } 133 | } 134 | 135 | static Contexts _sharedInstance; 136 | 137 | 138 | public CoreContext core { get; set; } 139 | public InputContext input { get; set; } 140 | public MapContext map { get; set; } 141 | 142 | public IContext[] allContexts { get { return new IContext [] { core, input, map }; } } 143 | 144 | 145 | public Contexts() { 146 | 147 | core = new CoreContext(); 148 | input = new InputContext(); 149 | map = new MapContext(); 150 | 151 | var postConstructors = System.Linq.Enumerable.Where( 152 | GetType().GetMethods(), 153 | method => System.Attribute.IsDefined(method, typeof(Entitas.CodeGeneration.Attributes.PostConstructorAttribute)) 154 | ); 155 | 156 | foreach (var postConstructor in postConstructors) { 157 | postConstructor.Invoke(this, null); 158 | } 159 | } 160 | 161 | public void Reset() { 162 | var contexts = allContexts; 163 | for (int i = 0; i < contexts.Length; i++) { 164 | contexts[i].Reset(); 165 | } 166 | } 167 | 168 | } 169 | 170 | public partial class Contexts { 171 | 172 | #if (!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR) 173 | 174 | [Entitas.CodeGeneration.Attributes.PostConstructor] 175 | public void InitializeContexObservers() { 176 | try { 177 | CreateContextObserver(core); 178 | CreateContextObserver(input); 179 | CreateContextObserver(map); 180 | } catch(System.Exception) { 181 | } 182 | } 183 | 184 | public void CreateContextObserver(Entitas.IContext context) { 185 | if (UnityEngine.Application.isPlaying) { 186 | var observer = new Entitas.VisualDebugging.Unity.ContextObserver(context); 187 | UnityEngine.Object.DontDestroyOnLoad(observer.gameObject); 188 | } 189 | } 190 | 191 | #endif 192 | } 193 | 194 | '''.toString, 195 | result.context.contextsHelperClassDefinition.toString 196 | ) 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /workspace/io.entitas.lang.parent/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | --------------------------------------------------------------------------------