Skip to content

Commit

Permalink
First version of the DSL grammar with yaml format
Browse files Browse the repository at this point in the history
  • Loading branch information
ipa-nhg committed Nov 8, 2022
1 parent b130e8c commit 7301783
Show file tree
Hide file tree
Showing 71 changed files with 20,062 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/de.fraunhofer.ipa.ros1.xtext.ide/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?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-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
34 changes: 34 additions & 0 deletions plugins/de.fraunhofer.ipa.ros1.xtext.ide/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>de.fraunhofer.ipa.ros1.xtext.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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
17 changes: 17 additions & 0 deletions plugins/de.fraunhofer.ipa.ros1.xtext.ide/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Manifest-Version: 1.0
Automatic-Module-Name: de.fraunhofer.ipa.ros1.xtext.ide
Bundle-ManifestVersion: 2
Bundle-Name: de.fraunhofer.ipa.ros1.xtext.ide
Bundle-Vendor: My Company
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: de.fraunhofer.ipa.ros1.xtext.ide; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: de.fraunhofer.ipa.ros1.xtext,
de.fraunhofer.ipa.ros,
org.eclipse.xtext.ide,
org.eclipse.xtext.xbase.ide,
org.antlr.runtime;bundle-version="[3.2.0,3.2.1)"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: de.fraunhofer.ipa.ros1.ide.contentassist.antlr.internal,
de.fraunhofer.ipa.ros1.ide.contentassist.antlr.lexer,
de.fraunhofer.ipa.ros1.ide.contentassist.antlr
6 changes: 6 additions & 0 deletions plugins/de.fraunhofer.ipa.ros1.xtext.ide/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/,\
src-gen/,\
xtend-gen/
bin.includes = .,\
META-INF/
bin.excludes = **/*.xtend
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
de.fraunhofer.ipa.ros1.ide.Ros1IdeSetup
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* generated by Xtext 2.25.0
*/
package de.fraunhofer.ipa.ros1.ide;

import com.google.inject.Binder;
import com.google.inject.name.Names;
import de.fraunhofer.ipa.ros1.ide.contentassist.antlr.Ros1Parser;
import de.fraunhofer.ipa.ros1.ide.contentassist.antlr.lexer.InternalRos1Lexer;
import org.eclipse.xtext.ide.DefaultIdeModule;
import org.eclipse.xtext.ide.LexerIdeBindings;
import org.eclipse.xtext.ide.editor.contentassist.CompletionPrefixProvider;
import org.eclipse.xtext.ide.editor.contentassist.FQNPrefixMatcher;
import org.eclipse.xtext.ide.editor.contentassist.IPrefixMatcher;
import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper;
import org.eclipse.xtext.ide.editor.contentassist.IndentationAwareCompletionPrefixProvider;
import org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper;
import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser;
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;
import org.eclipse.xtext.ide.refactoring.IRenameStrategy2;
import org.eclipse.xtext.ide.server.rename.IRenameService2;
import org.eclipse.xtext.ide.server.rename.RenameService2;

/**
* Manual modifications go to {@link Ros1IdeModule}.
*/
@SuppressWarnings("all")
public abstract class AbstractRos1IdeModule extends DefaultIdeModule {

// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public void configureContentAssistLexer(Binder binder) {
binder.bind(Lexer.class)
.annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST))
.to(InternalRos1Lexer.class);
}

// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends IContentAssistParser> bindIContentAssistParser() {
return Ros1Parser.class;
}

// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends IProposalConflictHelper> bindIProposalConflictHelper() {
return AntlrProposalConflictHelper.class;
}

// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends CompletionPrefixProvider> bindCompletionPrefixProvider() {
return IndentationAwareCompletionPrefixProvider.class;
}

// contributed by org.eclipse.xtext.xtext.generator.exporting.QualifiedNamesFragment2
public Class<? extends IPrefixMatcher> bindIPrefixMatcher() {
return FQNPrefixMatcher.class;
}

// contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2
public Class<? extends IRenameService2> bindIRenameService2() {
return RenameService2.class;
}

// contributed by org.eclipse.xtext.xtext.generator.ui.refactoring.RefactorElementNameFragment2
public Class<? extends IRenameStrategy2> bindIRenameStrategy2() {
return IRenameStrategy2.DefaultImpl.class;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* generated by Xtext 2.25.0
*/
package de.fraunhofer.ipa.ros1.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.util.PolymorphicDispatcher;

public class PartialRos1ContentAssistParser extends Ros1Parser {

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();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* generated by Xtext 2.25.0
*/
package de.fraunhofer.ipa.ros1.ide.contentassist.antlr;

import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import de.fraunhofer.ipa.ros1.ide.contentassist.antlr.internal.InternalRos1Parser;
import de.fraunhofer.ipa.ros1.services.Ros1GrammarAccess;
import java.util.Map;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.TokenSource;
import org.eclipse.xtext.AbstractElement;
import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractContentAssistParser;

public class Ros1Parser extends AbstractContentAssistParser {

@Singleton
public static final class NameMappings {

private final Map<AbstractElement, String> mappings;

@Inject
public NameMappings(Ros1GrammarAccess grammarAccess) {
ImmutableMap.Builder<AbstractElement, String> builder = ImmutableMap.builder();
init(builder, grammarAccess);
this.mappings = builder.build();
}

public String getRuleName(AbstractElement element) {
return mappings.get(element);
}

private static void init(ImmutableMap.Builder<AbstractElement, String> builder, Ros1GrammarAccess grammarAccess) {
builder.put(grammarAccess.getDependencyAccess().getAlternatives(), "rule__Dependency__Alternatives");
builder.put(grammarAccess.getRosNamesAccess().getAlternatives(), "rule__RosNames__Alternatives");
builder.put(grammarAccess.getEStringAccess().getAlternatives(), "rule__EString__Alternatives");
builder.put(grammarAccess.getRosParamNamesAccess().getAlternatives(), "rule__RosParamNames__Alternatives");
builder.put(grammarAccess.getCatkinPackageAccess().getGroup(), "rule__CatkinPackage__Group__0");
builder.put(grammarAccess.getCatkinPackageAccess().getGroup_4(), "rule__CatkinPackage__Group_4__0");
builder.put(grammarAccess.getCatkinPackageAccess().getGroup_5(), "rule__CatkinPackage__Group_5__0");
builder.put(grammarAccess.getCatkinPackageAccess().getGroup_6(), "rule__CatkinPackage__Group_6__0");
builder.put(grammarAccess.getCatkinPackageAccess().getGroup_6_3(), "rule__CatkinPackage__Group_6_3__0");
builder.put(grammarAccess.getArtifactAccess().getGroup(), "rule__Artifact__Group__0");
builder.put(grammarAccess.getNodeAccess().getGroup(), "rule__Node__Group__0");
builder.put(grammarAccess.getNodeAccess().getGroup_3(), "rule__Node__Group_3__0");
builder.put(grammarAccess.getNodeAccess().getGroup_4(), "rule__Node__Group_4__0");
builder.put(grammarAccess.getNodeAccess().getGroup_5(), "rule__Node__Group_5__0");
builder.put(grammarAccess.getPublisherAccess().getGroup(), "rule__Publisher__Group__0");
builder.put(grammarAccess.getSubscriberAccess().getGroup(), "rule__Subscriber__Group__0");
builder.put(grammarAccess.getParameterAccess().getGroup(), "rule__Parameter__Group__0");
builder.put(grammarAccess.getExternalDependencyAccess().getGroup(), "rule__ExternalDependency__Group__0");
builder.put(grammarAccess.getCatkinPackageAccess().getNameAssignment_1(), "rule__CatkinPackage__NameAssignment_1");
builder.put(grammarAccess.getCatkinPackageAccess().getFromGitRepoAssignment_4_1(), "rule__CatkinPackage__FromGitRepoAssignment_4_1");
builder.put(grammarAccess.getCatkinPackageAccess().getArtifactAssignment_5_2(), "rule__CatkinPackage__ArtifactAssignment_5_2");
builder.put(grammarAccess.getCatkinPackageAccess().getDependencyAssignment_6_2(), "rule__CatkinPackage__DependencyAssignment_6_2");
builder.put(grammarAccess.getCatkinPackageAccess().getDependencyAssignment_6_3_1(), "rule__CatkinPackage__DependencyAssignment_6_3_1");
builder.put(grammarAccess.getArtifactAccess().getNameAssignment_1(), "rule__Artifact__NameAssignment_1");
builder.put(grammarAccess.getArtifactAccess().getNodeAssignment_4(), "rule__Artifact__NodeAssignment_4");
builder.put(grammarAccess.getNodeAccess().getNameAssignment_1(), "rule__Node__NameAssignment_1");
builder.put(grammarAccess.getNodeAccess().getPublisherAssignment_3_2(), "rule__Node__PublisherAssignment_3_2");
builder.put(grammarAccess.getNodeAccess().getSubscriberAssignment_4_2(), "rule__Node__SubscriberAssignment_4_2");
builder.put(grammarAccess.getNodeAccess().getParameterAssignment_5_2(), "rule__Node__ParameterAssignment_5_2");
builder.put(grammarAccess.getPublisherAccess().getNameAssignment_1(), "rule__Publisher__NameAssignment_1");
builder.put(grammarAccess.getPublisherAccess().getMessageAssignment_5(), "rule__Publisher__MessageAssignment_5");
builder.put(grammarAccess.getSubscriberAccess().getNameAssignment_1(), "rule__Subscriber__NameAssignment_1");
builder.put(grammarAccess.getSubscriberAccess().getMessageAssignment_5(), "rule__Subscriber__MessageAssignment_5");
builder.put(grammarAccess.getParameterAccess().getNameAssignment_1(), "rule__Parameter__NameAssignment_1");
builder.put(grammarAccess.getPackageDependencyAccess().getPackageAssignment(), "rule__PackageDependency__PackageAssignment");
builder.put(grammarAccess.getExternalDependencyAccess().getNameAssignment_2(), "rule__ExternalDependency__NameAssignment_2");
}
}

@Inject
private NameMappings nameMappings;

@Inject
private Ros1GrammarAccess grammarAccess;

@Override
protected InternalRos1Parser createParser() {
InternalRos1Parser result = new InternalRos1Parser(null);
result.setGrammarAccess(grammarAccess);
return result;
}

@Override
protected TokenSource createLexer(CharStream stream) {
return new Ros1TokenSource(super.createLexer(stream));
}

@Override
protected String getRuleName(AbstractElement element) {
return nameMappings.getRuleName(element);
}

@Override
protected String[] getInitialHiddenTokens() {
return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" };
}

public Ros1GrammarAccess getGrammarAccess() {
return this.grammarAccess;
}

public void setGrammarAccess(Ros1GrammarAccess grammarAccess) {
this.grammarAccess = grammarAccess;
}

public NameMappings getNameMappings() {
return nameMappings;
}

public void setNameMappings(NameMappings nameMappings) {
this.nameMappings = nameMappings;
}
}
Loading

0 comments on commit 7301783

Please sign in to comment.