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 extends IContentAssistParser> bindIContentAssistParser() {
34 | return DSLParser.class;
35 | }
36 |
37 | // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
38 | public Class extends IProposalConflictHelper> bindIProposalConflictHelper() {
39 | return AntlrProposalConflictHelper.class;
40 | }
41 |
42 | // contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2
43 | public Class extends IPrefixMatcher> 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 extends ContextId>)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 extends TargetId>)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 extends ContextId>)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 extends AliasRule>)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 extends PropertyRules>)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 |
--------------------------------------------------------------------------------