Skip to content
Snippets Groups Projects
Commit 02b1e448 authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

added the config dsl and changed it a little bit

parent a9bfef06
No related branches found
No related tags found
No related merge requests found
Pipeline #
Showing
with 9065 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>teetime.configuration.dsl.ide</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: teetime.configuration.dsl.ide
Bundle-Vendor: My Company
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: teetime.configuration.dsl.ide; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: teetime.configuration.dsl,
org.eclipse.xtext.ide,
org.eclipse.xtext.xbase.ide
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: teetime.configuration.dsl.ide.contentassist.antlr,
teetime.configuration.dsl.ide.contentassist.antlr.internal
source.. = src/,\
src-gen/,\
xtend-gen/
bin.includes = .,\
META-INF/
/*
* generated by Xtext 2.9.2
*/
package teetime.configuration.dsl.ide.contentassist.antlr;
import com.google.inject.Inject;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.antlr.runtime.RecognitionException;
import org.eclipse.xtext.AbstractElement;
import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser;
import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement;
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
import teetime.configuration.dsl.ide.contentassist.antlr.internal.InternalConfigParser;
import teetime.configuration.dsl.services.ConfigGrammarAccess;
public class ConfigParser extends AbstractContentAssistParser {
@Inject
private ConfigGrammarAccess grammarAccess;
private Map<AbstractElement, String> nameMappings;
@Override
protected InternalConfigParser createParser() {
InternalConfigParser result = new InternalConfigParser(null);
result.setGrammarAccess(grammarAccess);
return result;
}
@Override
protected String getRuleName(AbstractElement element) {
if (nameMappings == null) {
nameMappings = new HashMap<AbstractElement, String>() {
private static final long serialVersionUID = 1L;
{
put(grammarAccess.getConfigurationElementAccess().getAlternatives(), "rule__ConfigurationElement__Alternatives");
put(grammarAccess.getConfigurationAccess().getGroup(), "rule__Configuration__Group__0");
put(grammarAccess.getStageAccess().getGroup(), "rule__Stage__Group__0");
put(grammarAccess.getStageAccess().getGroup_4(), "rule__Stage__Group_4__0");
put(grammarAccess.getImportDeclarationAccess().getGroup(), "rule__ImportDeclaration__Group__0");
put(grammarAccess.getPortQualifierAccess().getGroup(), "rule__PortQualifier__Group__0");
put(grammarAccess.getPortQualifierAccess().getGroup_1(), "rule__PortQualifier__Group_1__0");
put(grammarAccess.getConnectionAccess().getGroup(), "rule__Connection__Group__0");
put(grammarAccess.getConnectionAccess().getGroup_1(), "rule__Connection__Group_1__0");
put(grammarAccess.getQualifiedNameAccess().getGroup(), "rule__QualifiedName__Group__0");
put(grammarAccess.getQualifiedNameAccess().getGroup_1(), "rule__QualifiedName__Group_1__0");
put(grammarAccess.getQualifiedNameListAccess().getGroup(), "rule__QualifiedNameList__Group__0");
put(grammarAccess.getQualifiedNameListAccess().getGroup_1(), "rule__QualifiedNameList__Group_1__0");
put(grammarAccess.getArgumentDeclarationListAccess().getGroup(), "rule__ArgumentDeclarationList__Group__0");
put(grammarAccess.getArgumentDeclarationListAccess().getGroup_2(), "rule__ArgumentDeclarationList__Group_2__0");
put(grammarAccess.getArgumentDeclarationAccess().getGroup(), "rule__ArgumentDeclaration__Group__0");
put(grammarAccess.getParameterAccess().getGroup(), "rule__Parameter__Group__0");
put(grammarAccess.getConfigurationAccess().getPackageAssignment_0(), "rule__Configuration__PackageAssignment_0");
put(grammarAccess.getConfigurationAccess().getTypeAssignment_1(), "rule__Configuration__TypeAssignment_1");
put(grammarAccess.getConfigurationAccess().getArgumentListAssignment_2(), "rule__Configuration__ArgumentListAssignment_2");
put(grammarAccess.getConfigurationAccess().getElementsAssignment_4(), "rule__Configuration__ElementsAssignment_4");
put(grammarAccess.getStageAccess().getActiveAssignment_0(), "rule__Stage__ActiveAssignment_0");
put(grammarAccess.getStageAccess().getTypeAssignment_1(), "rule__Stage__TypeAssignment_1");
put(grammarAccess.getStageAccess().getParameterAssignment_2(), "rule__Stage__ParameterAssignment_2");
put(grammarAccess.getStageAccess().getIdAssignment_3(), "rule__Stage__IdAssignment_3");
put(grammarAccess.getStageAccess().getArgumentListAssignment_4_1(), "rule__Stage__ArgumentListAssignment_4_1");
put(grammarAccess.getImportDeclarationAccess().getImportedPackageAssignment_1(), "rule__ImportDeclaration__ImportedPackageAssignment_1");
put(grammarAccess.getPortQualifierAccess().getStartStageIdAssignment_0(), "rule__PortQualifier__StartStageIdAssignment_0");
put(grammarAccess.getPortQualifierAccess().getOutputPortIdAssignment_1_1(), "rule__PortQualifier__OutputPortIdAssignment_1_1");
put(grammarAccess.getConnectionAccess().getStartStageAssignment_0(), "rule__Connection__StartStageAssignment_0");
put(grammarAccess.getConnectionAccess().getNextStagesAssignment_1_1(), "rule__Connection__NextStagesAssignment_1_1");
put(grammarAccess.getQualifiedNameListAccess().getName1Assignment_0(), "rule__QualifiedNameList__Name1Assignment_0");
put(grammarAccess.getQualifiedNameListAccess().getOthernamesAssignment_1_1(), "rule__QualifiedNameList__OthernamesAssignment_1_1");
put(grammarAccess.getArgumentDeclarationListAccess().getArg1Assignment_1(), "rule__ArgumentDeclarationList__Arg1Assignment_1");
put(grammarAccess.getArgumentDeclarationListAccess().getOtherargsAssignment_2_1(), "rule__ArgumentDeclarationList__OtherargsAssignment_2_1");
put(grammarAccess.getArgumentDeclarationAccess().getQualifiednameAssignment_0(), "rule__ArgumentDeclaration__QualifiednameAssignment_0");
put(grammarAccess.getArgumentDeclarationAccess().getIdAssignment_1(), "rule__ArgumentDeclaration__IdAssignment_1");
put(grammarAccess.getParameterAccess().getQualifiedNameListAssignment_1(), "rule__Parameter__QualifiedNameListAssignment_1");
}
};
}
return nameMappings.get(element);
}
@Override
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
try {
InternalConfigParser typedParser = (InternalConfigParser) parser;
typedParser.entryRuleConfiguration();
return typedParser.getFollowElements();
} catch(RecognitionException ex) {
throw new RuntimeException(ex);
}
}
@Override
protected String[] getInitialHiddenTokens() {
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
}
public ConfigGrammarAccess getGrammarAccess() {
return this.grammarAccess;
}
public void setGrammarAccess(ConfigGrammarAccess grammarAccess) {
this.grammarAccess = grammarAccess;
}
}
/*
* generated by Xtext 2.9.2
*/
package teetime.configuration.dsl.ide.contentassist.antlr;
import java.util.Collection;
import java.util.Collections;
import org.eclipse.xtext.AbstractRule;
import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement;
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
import org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser;
import org.eclipse.xtext.util.PolymorphicDispatcher;
public class PartialConfigContentAssistParser extends ConfigParser implements IPartialEditingContentAssistParser {
private AbstractRule rule;
@Override
public void initializeFor(AbstractRule rule) {
this.rule = rule;
}
@Override
protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
if (rule == null || rule.eIsProxy())
return Collections.emptyList();
String methodName = "entryRule" + rule.getName();
PolymorphicDispatcher<Collection<FollowElement>> dispatcher =
new PolymorphicDispatcher<Collection<FollowElement>>(methodName, 0, 0, Collections.singletonList(parser));
dispatcher.invoke();
return parser.getFollowElements();
}
}
'('=13
')'=14
','=19
'->'=18
'.'=17
';'=16
'<'=20
'>'=21
'active'=22
'import'=15
'{'=11
'}'=12
RULE_ANY_OTHER=10
RULE_ID=4
RULE_INT=5
RULE_ML_COMMENT=7
RULE_SL_COMMENT=8
RULE_STRING=6
RULE_WS=9
T__11=11
T__12=12
T__13=13
T__14=14
T__15=15
T__16=16
T__17=17
T__18=18
T__19=19
T__20=20
T__21=21
T__22=22
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>teetime.configuration.dsl.tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: teetime.configuration.dsl.tests
Bundle-Vendor: My Company
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: teetime.configuration.dsl.tests; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: teetime.configuration.dsl,
org.junit;bundle-version="4.7.0",
org.eclipse.xtext.junit4,
org.eclipse.xtext.xbase.junit,
org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: teetime.configuration.dsl.tests
Import-Package: org.hamcrest.core,
org.junit;version="4.5.0",
org.junit.runners.model;version="4.5.0",
org.junit.runner;version="4.5.0",
org.junit.runners;version="4.5.0",
org.junit.runner.manipulation;version="4.5.0",
org.junit.runner.notification;version="4.5.0"
source.. = src/,\
src-gen/,\
xtend-gen/
bin.includes = .,\
META-INF/
/*
* generated by Xtext 2.9.2
*/
package teetime.configuration.dsl.tests;
import com.google.inject.Injector;
import org.eclipse.xtext.junit4.GlobalRegistries;
import org.eclipse.xtext.junit4.GlobalRegistries.GlobalStateMemento;
import org.eclipse.xtext.junit4.IInjectorProvider;
import org.eclipse.xtext.junit4.IRegistryConfigurator;
import teetime.configuration.dsl.ConfigStandaloneSetup;
public class ConfigInjectorProvider implements IInjectorProvider, IRegistryConfigurator {
protected GlobalStateMemento stateBeforeInjectorCreation;
protected GlobalStateMemento stateAfterInjectorCreation;
protected Injector injector;
static {
GlobalRegistries.initializeDefaults();
}
@Override
public Injector getInjector() {
if (injector == null) {
stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
this.injector = internalCreateInjector();
stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
}
return injector;
}
protected Injector internalCreateInjector() {
return new ConfigStandaloneSetup().createInjectorAndDoEMFRegistration();
}
@Override
public void restoreRegistry() {
stateBeforeInjectorCreation.restoreGlobalState();
}
@Override
public void setupRegistry() {
getInjector();
stateAfterInjectorCreation.restoreGlobalState();
}
}
/*
* generated by Xtext 2.9.2
*/
package teetime.configuration.dsl.tests
import com.google.inject.Inject
import org.eclipse.xtext.junit4.InjectWith
import org.eclipse.xtext.junit4.XtextRunner
import org.eclipse.xtext.junit4.util.ParseHelper
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import teetime.configuration.dsl.config.Configuration
@RunWith(XtextRunner)
@InjectWith(ConfigInjectorProvider)
class ConfigParsingTest{
@Inject
ParseHelper<Configuration> parseHelper;
@Test
def void loadModel() {
val result = parseHelper.parse('''
Hello Xtext!
''')
Assert.assertNotNull(result)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment